Blacklist for prototypes turrets shouldn't attack
Posted: Sun Jun 21, 2020 7:21 am
I'd like to prevent that water turrets can attack certain entities. Currently, if an entity (character/unit-spawner/turret) or unit from an enemy force is in range of a water turret, this water turret will attack it.
Let's say I don't want water turrets to attack spawners and worms. Currently, I listen to on_entity_damaged; if the damage was dealt by a water turret and if the damaged entity was a spawner or a turret (the prototype worms are based on), I restore the health and set turret.shooting_target = nil. I believe it would be way cheaper UPS-wise if I could just set a property like "turret.blacklist_targets = { "unit-spawner", "turret" } directly in the prototype, so the turret wouldn't even try to attack such entities. (Something to that effect already exists in vanilla, with artillery turrets that automatically targeting spawners/worms only.)
It would be even better if we could make that like a filter:
This would allow to filter complete classes of entities (e.g. all spawners, including modded ones), but also specific prototypes (e.g. if mods have to abuse some unrelated prototype to make a new entity for some special behavior).
Is there any chance to get that implemented?
Let's say I don't want water turrets to attack spawners and worms. Currently, I listen to on_entity_damaged; if the damage was dealt by a water turret and if the damaged entity was a spawner or a turret (the prototype worms are based on), I restore the health and set turret.shooting_target = nil. I believe it would be way cheaper UPS-wise if I could just set a property like "turret.blacklist_targets = { "unit-spawner", "turret" } directly in the prototype, so the turret wouldn't even try to attack such entities. (Something to that effect already exists in vanilla, with artillery turrets that automatically targeting spawners/worms only.)
It would be even better if we could make that like a filter:
Code: Select all
turret.blacklist_targets = {
{filter = "type", type = "unit-spawner"},
{filter = "type", type = "turret", mode = "or"},
{filter = "name", name = "small-worm", mode = "and"}
}
Is there any chance to get that implemented?