[1.1.36] Cannon/Tank Gun Projectiles Ignore Ammo's range_modifier

Place to get help with not working mods / modding interface.
Post Reply
wretlaw120
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Jan 14, 2021 10:16 pm
Contact:

[1.1.36] Cannon/Tank Gun Projectiles Ignore Ammo's range_modifier

Post by wretlaw120 »

Story time: I was messing with the True Nukes mod, and found that the nuclear cannon shells (which have a range modifier of 200%) were not actually firing any farther than the normal cannon shells.
So, I made a mod that takes the normal cannon shells and adds range modifiers, to see if it was just True Nukes being goofy. The issue persisted...
I then tested it with rockets and firearm ammo, and found that they worked how you would expect, and changed how far the bullet/rocket can travel by the range_modifier property.
I also added K2 Turrets, because that mod has turrets which can fire rockets and cannon shells, to see how cannon shells behave in a turret.
It turns out that the cannon shells with range modifiers do modify the range of the turret they're in (in this case the Railgun from K2 Turrets), but not the distance that the projectile travels, so it was targeting enemies, but couldn't hit them because the cannon projectile didn't live long enough.
For giggles, I made a cannon shell that has 50% range, and threw it in the tank, only to discover that it still travelled the same distance as a cannon shell with 100% range.

Essentially this is what it comes to: Cannon projectiles ignore the range_modifier property and always travel the unmodified range of the gun they're being fired out of, when you would expect their range to change in relation to the range_modifier property.

I've attached a video of me demonstrating this. There's also the attached log file.
Yes, I have other mods installed in the video, but the issue is the same when the only active mod is the one that adds modified cannon shells.
(here's the mod: https://mods.factorio.com/mod/long_range_ammo)
Video:
cannon range demonstration.mp4
(29.39 MiB) Downloaded 109 times
Attachments
factorio-current - Copy.log
(20.7 KiB) Downloaded 102 times

wretlaw120
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Jan 14, 2021 10:16 pm
Contact:

Re: [1.1.36] Cannon/Tank Gun Projectiles Ignore Ammo's range_modifier

Post by wretlaw120 »

I figured it out. I was deepcopying explosive-cannon-projectile and changing it's range_modifier, because I was under the impression that the distance that a projectile could travel was determined by the range of the turret that fired it. After changing the range of the gun that I was using, I found that the projectile still wasn't travelling farther than before. So I looked into the game code to see if I was missing something (which yes, I should have done before submitting a bug report) and found that the distance that the cannon projectile could travel is defined by the projectile itself, not the turret. Which means I should have been using xyx.ammo_type.action.action_delivery.max_range = 70 instead of xyz.ammo_type.range_modifier = 2. Because that actually works.

So I guess it's not a bug... oh well. Someone should probably throw this thread into the good 'ol "Not a bug" subforum, then.

Post Reply

Return to “Modding help”