Essentially, the mod is creating ghost rails in the same spot as the vanilla rail which gets marked for deconstruction. (Using a custom blueprint item, "upgrade planner", to find and replace the rails.) This allows the robots to remove the existing item and place the new item down in the same position/direction.
The LUA script, for each rail, creates a ghost entity of the new rail type in the same position as the existing rail.
('entity' here refers to the existing rail.)
Code: Select all
local new_entity = {
name = "entity-ghost",
inner_name = config[index].to,
position = entity.position,
direction = entity.direction,
force = entity.force
}
game.surfaces['nauvis'].create_entity(new_entity)
The problem: Rail direction/rotation is lost.
Before
After
Half of the curved rails keep their orientation, half don't. The diagonal line of straight rails becomes a series of horizontal ones, etc. (Any straight rail that is diagonal will wind up being either vertical or horizontal afterwards.)Save (incl. mods) is attached. Just use the 'upgrade planner' (slot '5' in the quick bar) on the rails to recreate the issue.
What's going on here? Is this something I've done or is the direction getting lost somewhere along the way?