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.
[1.1.42] Cars trigger_target_mask is not relevant for turret targeting
[1.1.42] Cars trigger_target_mask is not relevant for turret targeting
- Attachments
-
- factorio-current.log
- (36.31 KiB) Downloaded 158 times
Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting
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.
- bolderbrush10
- Burner Inserter
- Posts: 14
- Joined: Thu Oct 14, 2021 4:12 am
- Contact:
Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting
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
You can probably 'fake' always having a driver with some checks in defines.events.on_player_driving_changed_state
Re: [1.1.42] Cars trigger_target_mask is not relevant for turret targeting
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.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
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!