RailPowerSystem

by Hermios

Connect rails to electric and signals circuits, and use electric trains

Content
9 days ago
0.14 - 1.1
518
Transportation

i rail replacement

7 years ago

suggest that the powered rail be directly replaceable when placed over standard rails, i don't know if this is even possible, but i think it would be great if it worked that way - would make upgrading at a later time much easier

7 years ago

Hi Philip
I 100% agree, unfortunately, it seems to be not possible, because of the rail placement system. (The rails are actually designed to easily replace the default ones). If you have any suggestion to solve it, I am happy to hear.

7 years ago

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

New response