This commit is contained in:
2025-02-07 18:59:13 +09:00
parent d4e76de5fd
commit 2b66965d08

View File

@@ -20,15 +20,6 @@ for _, turret in ipairs(turrets) do
turret.position = apply_offset(turret.position, config.turrets.offset) turret.position = apply_offset(turret.position, config.turrets.offset)
end end
-- Get or create the force used for entities in spawn
local function get_neutral_force()
local force = game.forces["neutral"]
if force and force.valid then
return force
end
end
-- Protects an entity -- Protects an entity
-- and sets its force to the spawn force -- and sets its force to the spawn force
local function protect_entity(entity, set_force) local function protect_entity(entity, set_force)
@@ -39,7 +30,7 @@ local function protect_entity(entity, set_force)
entity.operable = false entity.operable = false
if set_force then if set_force then
entity.force = get_neutral_force() entity.force = game.forces["neutral"]
end end
end end
end end