I have a script in my mod that replaces turrets, which is working fine for anything except turrets with pipes - like flamethrower turrets.
Simply put, when the script replaces the turret (with essentially the same thing with some improved stats - using a table.deepcopy of the original turret) the pipes disconnect and do not reconnect automatically.
I have tried to use surface.create_entity with both "target=thisturrettoreplace" and "fast_replace=true" without anything better happening.
the specific line of code that does the replacement:
Code: Select all
-- Create a new turret.
local newTurret = turret.surface.create_entity{position=turret.position, name=newName, force = turret.force, direction=turret.direction, target=turret , fast_replace=true}