[Oxyd] Turrets attacking targets they can't attack

This subforum contains all the issues which we already resolved.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[Oxyd] Turrets attacking targets they can't attack

Post by Pi-C »

Water turrets again. :-)

When a fire is created, it spawns a dummy that my turrets can attack. The turret type in the picture is looking for targets automatically -- the game decides if an entity that's on its target_trigger_mask is within reach and targets it automatically. In other words: I don't assign the turret a target per script.

This usually works, but there are edge cases. As you can see in the following picture, fire and dummy (the combat-bot) are within min_range of the turret, so the gun is still in the stand-by position:
turret-target-within-min_range.png
turret-target-within-min_range.png (1.01 MiB) Viewed 4185 times
The turret obviously ignores this target, as expected. Now consider this picture:
turret-attack-out-of-min_range.png
turret-attack-out-of-min_range.png (997.44 KiB) Viewed 4185 times
The turret's gun has turned into the direction of fire and dummy -- it's clearly trying to attack because the target is just out of min_range. However, there is no stream! The turret is locked unto this target and won't look for another until the current target has been removed (which happens automatically once the fire has expired of its own). It just sits there waiting while it could have extinguished a lot of other fires in that time.

I consider this a bug because it's unexpected that turrets won't actually shoot at positions that they consider valid targets.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Turrets attacking targets they can't attack

Post by Twinsen »

Can you provide test mod+save or some instructions to reproduce this, please?

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

Re: Turrets attacking targets they can't attack

Post by Pi-C »

Twinsen wrote:
Thu Oct 29, 2020 2:23 pm
Can you provide test mod+save or some instructions to reproduce this, please?
Sure! WIP-version of my mod and a saved game are attached. You'll also need Creative Mod for the fluid source.
waterturret.png
waterturret.png (745 KiB) Viewed 4125 times
The turret is loaded. The four poles mark its min_range. You've got a flamethrower. Just start a fire somewhere just beyond min_range and see what happens. I haven't changed the TTL of fires, so it could take a while until the dummies are removed again.
Attachments
WaterTurret_1.0.2.zip
(2.78 MiB) Downloaded 120 times
waterturrets_dont_attack.zip
(1.77 MiB) Downloaded 110 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Kyralessa
Filter Inserter
Filter Inserter
Posts: 446
Joined: Thu Sep 29, 2016 5:58 pm
Contact:

Re: Turrets attacking targets they can't attack

Post by Kyralessa »

Are you sure it's locked to that target? When you place other burning targets, it doesn't switch? It makes sense that it would aim at a nearby target even if it's not quite close enough to hit yet.

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

Re: Turrets attacking targets they can't attack

Post by Pi-C »

Kyralessa wrote:
Thu Oct 29, 2020 3:23 pm
Are you sure it's locked to that target?
Yes.
When you place other burning targets, it doesn't switch?
Right. It will switch (or return to stand-by) once the target has become invalid. I've attached mod and save file in the post just above yours, so you can see for yourself. :-)
It makes sense that it would aim at a nearby target even if it's not quite close enough to hit yet.
It's too close to hit and it's not a mobile unit that may move into range in a while, so the turret should ignore it.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Turrets attacking targets they can't attack

Post by Twinsen »

Related to 87158 (caused by this fix)

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

Re: Turrets attacking targets they can't attack

Post by Pi-C »

Twinsen wrote:
Fri Oct 30, 2020 2:26 pm
Related to 87158 (caused by this fix)
Thanks for looking at this! Are there any chances for a fix of that fix? :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: Turrets attacking targets they can't attack

Post by Oxyd »

Pi-C wrote:
Fri Oct 30, 2020 2:34 pm
Twinsen wrote:
Fri Oct 30, 2020 2:26 pm
Related to 87158 (caused by this fix)
Thanks for looking at this! Are there any chances for a fix of that fix? :-)
Yep, should be fixed in 1.1.0.

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

Re: [Oxyd] Turrets attacking targets they can't attack

Post by Pi-C »

Wonderful! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Resolved Problems and Bugs”