[2.0.58] Turret with turret_base_has_direction=false loses direction sometimes in blueprints
Posted: Sat Jun 28, 2025 9:24 pm
What
If you have a turret with turret_base_has_direction=false then the turret assumes that it doesn't support direction. This means the direction is (sometimes?) not saved in blueprints which causes weird behaviour where (sometimes) the turret looses direction.Reproduction
This came up with Shield Projector in combination with an unreleased version of Space Exploration. Shield Projectors use turret directions to decide where the shield should be generated. And upon creating a blueprint SE will sometimes run some code to modify the blueprint, but this issue can be reproduced with this minimal snippet:Code: Select all
-- In on_player_setup_blueprint event
local blueprint = player.blueprint_to_setup
local entities = blueprint .get_blueprint_entities() -- The direction is not part shield projector in the returned 'entities'
blueprint.set_blueprint_entities(entities)
I believe it somehow relates to the fact that the entity believes it doesn't support direction:
Expecation
I would expect the turret to always store it's direction in blueprints.- It's probably intentional though that turret's don't store direction because for all other turrets in vanilla the actual direction doesn't matter. However, for our use case it does, so it would be great if it could.
- It's also inconsistent when direction is stored in the blueprint. When the blueprint is not accessed through Lua then the direction is maintained.
Thoughts
It's a little related to this changelog entry when the turret's behaviour around directions was changed.Fixed turret behaviour when it has more than 4 directions and the collision box is not affected by rotation.