Types/BaseAttackParameters: warmup and cooldown

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1757
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Types/BaseAttackParameters: warmup and cooldown

Post by Pi-C »

Gun prototypes have attack_parameters.cooldown and may have attack_parameters.warmup. I wonder how they are supposed to be used:

(1) Only use WARMUP ticks after setting a new target (aim, wait WARMUP ticks, shoot, wait COOLDOWN ticks, shoot, wait COOLDOWN ticks, shoot, …).
(2) Use WARMUP ticks before every shot (aim, wait WARMUP ticks, shoot, wait COOLDOWN ticks, wait WARMUP ticks, shoot, wait COOLDOWN ticks, …).

To me, (1) makes more sense, I just want to make sure that is correct. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 583
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Types/BaseAttackParameters: warmup and cooldown

Post by Silari »

They're documented: Warmup occurs AFTER attempting to shoot. So it'd actually be attempt to shoot, warmup, shoot, cooldown, attempt to shoot, warmup, shoot, cooldown, etc.

Not sure if the movement penalty applies during the warmup period - it should for the whole cooldown. Docs are lacking on anything about movement penalty.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1757
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Types/BaseAttackParameters: warmup and cooldown

Post by Pi-C »

Silari wrote: Sun Jun 11, 2023 3:58 pm They're documented: Warmup occurs AFTER attempting to shoot. So it'd actually be attempt to shoot, warmup, shoot, cooldown, attempt to shoot, warmup, shoot, cooldown, etc.
Thanks! I think this makes it even easier to achieve what I want: In Autodrive, vehicles that have at least one loaded weapon and are equipped with an enemy sensor will automatically shoot at the nearest enemy that is within their weapon's range. This happens on every tick, so a tank with a machine gun loaded with the most simple ammo will kill small to medium nests of spawners and worms because they shoot at the ridiculous speed of 60 shots/second. My goal is to nerf the shooting speed by adding a delay between shots. Now it seems it's sufficient to forbid shooting until warmup + cooldown ticks have passed.

(Just thought of this: There are researches for increasing shooting speed. Therefore, I'd also need to keep track of the research level for each force, as well as which ammo item needs what resarch -- think "flammables" vs. "projectiles". Holy shit, I think I'd better unthink this and simply ignore researches altogether! :-D)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”