I've been using the following script to replace regular rails with ghost powered rails, and then the bots will fill them in.
/c local original = "straight-rail"
local replacement = "straight-rail-power"
local xRange=15
local yRange=15
for , entity in ipairs(game.player.surface.find_entities_filtered{
area={{game.player.position.x-xRange, game.player.position.y-yRange},
{game.player.position.x+xRange, game.player.position.y+yRange}},
name=original})
do
game.surfaces[entity.surface.name].create_entity{
name = "entity-ghost",
position=entity.position,
direction=entity.direction,
inner_name = replacement,
direction = entity.direction,
force = entity.force
}
entity.destroy()
end
local original = "curved-rail"
local replacement = "curved-rail-power"
for , entity in ipairs(game.player.surface.find_entities_filtered{
area={{game.player.position.x-xRange, game.player.position.y-yRange},
{game.player.position.x+xRange, game.player.position.y+yRange}},
name=original})
do
game.surfaces[entity.surface.name].create_entity{
name = "entity-ghost",
position=entity.position,
direction=entity.direction,
inner_name = replacement,
direction = entity.direction,
force = entity.force
}
entity.destroy()
end