[1.1.42] Cars trigger_target_mask is not relevant for turret targeting

Things that we don't consider worth fixing at this moment.
Post Reply
TheKingJo
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Jan 02, 2021 1:22 am
Contact:

[1.1.42] Cars trigger_target_mask is not relevant for turret targeting

Post by TheKingJo »

I'm currently making a mod again. I'm trying to make an "ammo-turret" that only aims at "car"s that have a certain trigger_target_mask.

I'm doing this by giving the turret a new TriggerTargetMask {"air-unit"} as attack_target_mask, {"ground-unit"} as ignore_target_mask and giving all cars the same TriggerTargetMask {"air-unit"} as trigger_target_mask as well.

However the turret is not attacking the modified cars in idle state as well as in entered-by-player state. The idle state is normal. However it is strange that the turret is not attacking when a player is inside although the car has the correct trigger_target_mask.

I did a bit of testing and I can confirm that the vehicle with a player inside WILL get attacked WHEN the characters(!) trigger_target_mask is the same as the turrets attack_target_mask.


What would I expect to happen?
The turret attacking cars (with characters inside) that share the same trigger_target_mask with its own attack_target_mask regardless of the characters trigger_target_mask.
Attachments
factorio-current.log
(36.31 KiB) Downloaded 132 times

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting

Post by posila »

Hmm... I was gonna link wiki prototypes page to provide full info, but the page doesn't contain EntityWithForce, so that would be useless. I am dumb. Prototype list can't show it because EntityWithForce doesn't have special prototype.

Essentially, turrets are able to target only entities, that inherit from EntityWithForce (https://wiki.factorio.com/Military_units_and_structures) ... which are unit, character, land-mine, (ammo/artillery/electric/fluid/)turret, radar, enemy-spawner, combat-robot, logistic-robot, construction-robot, player-port, simple-entity-with-force

Vehicles are not EntityWithForce ... this is intentional, so much that spidertron has simple-entity-with-force attached to it, so it is targetable by units and turrets.

User avatar
bolderbrush10
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Oct 14, 2021 4:12 am
Contact:

Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting

Post by bolderbrush10 »

I had a similar issue. I got around it by just targeting the driver inside the vehicle (although that doesn't work so well for spidertrons)
You can probably 'fake' always having a driver with some checks in defines.events.on_player_driving_changed_state

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

Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting

Post by Pi-C »

bolderbrush10 wrote:
Tue Dec 28, 2021 9:47 am
You can probably 'fake' always having a driver with some checks in defines.events.on_player_driving_changed_state
Just remember that you can't have more than 2 characters in a car-type vehicle (passenger + driver). There are other mods that insert characters into vehicles for their own purposes (e.g. AAI Programmable Vehicles), so you should make sure to add your dummy characters only if the vehicle is empty.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Won't fix.”