Target masks again

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

Target masks again

Post by Pi-C »

I have these dummy entities that should be attacked just by my turrets, nothing else. So I've defined a trigger_target_type and set it as the only value in entity.trigger_target_mask, my turrets' attack_target_mask, and all other turrets' (ammo-turret, fluid-turret, electric-turret) ignore_target_mask. This works as expected -- insofar as just my turrets will attack the dummies while they are ignored by all other ammo, fluid, and electric turrets.

However, there are other things in the game that can shoot: e.g. artillery-turrets, cars, or active-defense-equipment. These prototypes don't have attack_target_mask and ignore_target_mask. But artillery-turrets have "gun" (name of a gun prototype) and cars have "guns" (an array of names of gun prototypes). Both data.raw.gun and data.raw["active-defense-equipment"] have attack_parameters, which may contain ammo_type -- and ammo_type has the property action.trigger_target_mask.

According to the description of TriggerItem, the default of trigger_target_mask is "everything". It wouldn't make sense that you can shoot at ammo, so I assumed that it would contain the names of trigger_target_types the ammo is allowed to shoot at. But apparently, this doesn't work: I've removed my dummies' trigger_target_type from ammo_type.action.trigger_target_mask of all ammo types, but cars, artillery turrets etc. still shoot at the dummies. How can I prevent this?
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”