Target masks and artillery/PLD

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

Target masks and artillery/PLD

Post by Pi-C »

For Water Turret, I've created dummy entities as markers for fire or acid splashes. They have their own trigger_target_type, and their trigger_target_mask contains only this trigger. Also, I've made sure to use this trigger in ignore_target_mask of all other turret prototypes. The dummies are on their own force, which is enemy to any force with players and on ceasefire with the force "enemy". This seemed to work, but now I've got an interesting bug report:
So what happen was, that because of the mod my artillery and also personal laser started firing at acid splashes, which in return (with atillery) destroyed my turrets that got spit on, which is uhm not good for my defense line.
Artillery turrets seem to be different from the other turret types in that they don't have an ignore/attack mask. That would be OK, because they seem to have spawners and worms hard-coded as the only allowed targets. But why on Nauvis would they start to shoot at a dummy that's just a simple-entity-with-force?

The PLD is also a problem. It doesn't have target masks either, and if I equip it and walk past an acid splash, the PLD will start shooting at it. As the dummies are immune to all damage kinds but the damages of my turrets, this is pointless: The PLD will never look for another target until the dummy is out of range because it can't kill it. Also, if the splash is on one of my entities, it could kill that instead.

Does anybody have an idea how to cope with these problems?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

Pi-C wrote:
Wed Oct 14, 2020 11:54 am
Artillery turrets seem to be different from the other turret types in that they don't have an ignore/attack mask. That would be OK, because they seem to have spawners and worms hard-coded as the only allowed targets. But why on Nauvis would they start to shoot at a dummy that's just a simple-entity-with-force?
I've just figured that out myself:
https://wiki.factorio.com/Artillery_turret#Mechanics wrote: In automatic mode, [artillery turrets] function much the same as other turrets, automatically scanning for valid targets within range and firing on them. Automatic mode can only target enemy structures (spawners and worms), not mobile units (biters and spitters); …
According to this, simple-entity-with-force is a military structure, and my dummies are on an enemy force of players. My mistake was, I've always read the above paragraph, but didn't check recently what counts as "enemy structure". In a vanilla single-player game, I guess spawners and worms are the only military structures artillery turrets will ever get to see. I suppose they may attack turrets or radars of other players in multiplayer -- but that's just a guess, not tested.

One way around my problem would be to use a different prototype for my dummies. That would be a pity because simple-entities-with-force are so easy to create and probably won't eat any performance in the game. So I've made an interface request to get attack_target_mask and ignore_target_mask added to artillery turrets and PLDs.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Bilka
Factorio Staff
Factorio Staff
Posts: 3299
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Target masks and artillery/PLD

Post by Bilka »

Pi-C wrote:
Sat Oct 17, 2020 10:38 am
According to this, simple-entity-with-force is a military structure, and my dummies are on an enemy force of players. My mistake was, I've always read the above paragraph, but didn't check recently what counts as "enemy structure". In a vanilla single-player game, I guess spawners and worms are the only military structures artillery turrets will ever get to see. I suppose they may attack turrets or radars of other players in multiplayer -- but that's just a guess, not tested.

One way around my problem would be to use a different prototype for my dummies. That would be a pity because simple-entities-with-force are so easy to create and probably won't eat any performance in the game. So I've made an interface request to get attack_target_mask and ignore_target_mask added to artillery turrets and PLDs.
Sounds like you're looking for a simple-entity-with-owner.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Target masks and artillery/PLD

Post by Deadlock989 »

That's why biters are absolutely furious about Earendel's text plates.

simple-entity-with-owner is the better prototype for "dumb" objects that don't have any strategic combat value.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

Deadlock989 wrote:
Sat Oct 17, 2020 10:48 am
That's why biters are absolutely furious about Earendel's text plates.

simple-entity-with-owner is the better prototype for "dumb" objects that don't have any strategic combat value.
Thanks for the hint! I think I've already considered simple-entity-with-owner when I decided on what prototype to use. This
https://wiki.factorio.com/Prototype/SimpleEntityWithForce wrote: This entity will be a priority target for units/turrets, who will choose to attack it even if it does not block their path. Use Prototype/SimpleEntityWithOwner for entities that are only attacked when they block enemies.
made me settle on simple-entity-with-force. I want my turrets to attack the dummies -- but I don't want other turrets to attack them. Would that still work?

Another question: If I were to use a different prototype, I'd need to migrate the existing dummies. Exchanging entities is easy with a migration.json script. But would the new entities also get new unit_numbers? Otherwise it may be better to replace (or even remove) them in a migration.lua script and update the tables.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

Bilka wrote:
Sat Oct 17, 2020 10:42 am
Sounds like you're looking for a simple-entity-with-owner.
Sorry, didn't read that before (page scrolled down to the next post automatically)! But if you and Deadlock both suggest simple-entity-with-owner, I think it's a safe road to travel on. :-)

Anyway, while this seems to solve my problem, I still think that target masks for artillery turrets and PLD could be useful. (For example, if I'd want to set up hidden radars that shouldn't be attacked.)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Target masks and artillery/PLD

Post by Deadlock989 »

Pi-C wrote:
Sat Oct 17, 2020 11:30 am
Sorry, didn't read that before (page scrolled down to the next post automatically)! But if you and Deadlock both suggest simple-entity-with-owner, I think it's a safe road to travel on. :-)
But I didn't remember that you also want turrets to target them. I don't know for an absolute fact that they won't target SEWOs but I'm pretty sure they won't. In which case target masks would be required.

This water turret is quite the long saga, huh. I don't think either SEWOs or SEWFs were really intended for this kind of use case. I had them down as representing visible, solid, inactive ("simple") objects.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

Deadlock989 wrote:
Sat Oct 17, 2020 12:02 pm
But I didn't remember that you also want turrets to target them. I don't know for an absolute fact that they won't target SEWOs but I'm pretty sure they won't. In which case target masks would be required.
You mean target masks for artillery/PLD? The dummies already have a trigger_target_mask that is set as attack_target_mask of my turrets.
This water turret is quite the long saga, huh.
I've even used combat-bots as dummies for a while. ;-) The reason behind that was I wouldn't have to keep a dummy list for clean-up because combat bots have a time_to_live after which they automatically expire. (Nothing was reported back then, but combat bots are also military structures -- so same problem as now.)
I don't think either SEWOs or SEWFs were really intended for this kind of use case. I had them down as representing visible, solid, inactive ("simple") objects.
Guess you're right, but we've got to work with what's available. And if I need just an entity that does nothing except waiting to be shot at, why should I bother using a complicated prototype that requires animations and countless settings that I don't need? Using a simple entity instead simply makes sense!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Target masks and artillery/PLD

Post by eradicator »

If Artillery auto-targets "military structures" and you don't want that, and turrents target "military targets" and you do want that... then it would seem to be an option to make the dummies be non-structure military targets. For which immovable combat bots do sound like a possible candidate. At least i think artillery doesn't shoot at mobile units (though combat bots are not technically "Unit" prototypes).

Migrating between prototype types without changing the name usually works without any special migrations. Though if you need the unit number to stay intact i don't know how that's handled.

And none of that solves the PLD problem.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

eradicator wrote:
Sat Oct 17, 2020 3:47 pm
If Artillery auto-targets "military structures" and you don't want that, and turrents target "military targets" and you do want that... then it would seem to be an option to make the dummies be non-structure military targets. For which immovable combat bots do sound like a possible candidate. At least i think artillery doesn't shoot at mobile units (though combat bots are not technically "Unit" prototypes).
Wouldn't work -- see here!

Migrating between prototype types without changing the name usually works without any special migrations. Though if you need the unit number to stay intact i don't know how that's handled.
Yes, it's perhaps the easiest thing to make a clean start and remove all dummies during migration. Turrets will look for new fires when their list is empty. Only turrets that were shooting at a dummy when the game was saved would have no target for a while. But that should be taken care of next time they are checked (every 10 secs per default). It's just a one-time event, so I believe it would be OK.
And none of that solves the PLD problem.
Unless the PLD follows the same rules as artillery turrets, so perhaps replacing the prototype would help. I'll try in a while -- have to finish some prototype stuff first so that I can start the game again. :-D
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Target masks and artillery/PLD

Post by eradicator »

Pi-C wrote:
Sat Oct 17, 2020 3:57 pm
Wouldn't work -- see here!
Hm? I said that using combat-robot instead of simple-entity-with-force would make the dummines non-structures, which should prevent artillery shooting at them. So unless artillery shoots at non-structures too, then i'm not sure what you're saying. (Given my limited artillery experience i don't know if arty does that or not.)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

eradicator wrote:
Sat Oct 17, 2020 10:42 pm
Pi-C wrote:
Sat Oct 17, 2020 3:57 pm
Wouldn't work -- see here!
Hm? I said that using combat-robot instead of simple-entity-with-force would make the dummines non-structures, which should prevent artillery shooting at them. So unless artillery shoots at non-structures too, then i'm not sure what you're saying.
Yikes -- must have mistaken "units" for "structure". :roll:
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1718
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Target masks and artillery/PLD

Post by Pi-C »

eradicator wrote:
Sat Oct 17, 2020 3:47 pm
If Artillery auto-targets "military structures" and you don't want that, and turrents target "military targets" and you do want that... then it would seem to be an option to make the dummies be non-structure military targets. For which immovable combat bots do sound like a possible candidate. At least i think artillery doesn't shoot at mobile units (though combat bots are not technically "Unit" prototypes).
So, the dummies are combat-bots again. I set "dummy.active = false" on creation, and this still doesn't prevent my turrets from attacking the dummies. But they are ignored by artillery.
And none of that solves the PLD problem.
Right, just tested it. So, using another prototype is a way to remedy the most serious bug (your own artillery taking out your structures), but it's still only a hack. It will have do for now, but target masks for artillery turrets and active-defense-equipment are really badly needed. Please, do add them! :-)
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”