Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ end)

table.insert(list_events.on_built,function (entity)
if entity.valid and entity.type=="entity-ghost" and entity.ghost_name==railpole then
local connections=entity.circuit_connected_entities
local connections=entity.circuit_connection_definitions
local surface=entity.surface
local position=entity.position
local force=entity.force
entity.destroy()
local ghost=surface.create_entity{name="entity-ghost",inner_name=railpole_prototype,position=position,force=force}
for wire,targets in pairs(connections) do
for _,target in pairs(targets) do
ghost.connect_neighbour{wire=defines.wire_type[wire],target_entity=target}
end
for _,connection in pairs(connections) do
ghost.connect_neighbour(connection)
end
end
if entity.valid and entity.type=="electric-pole" then
Expand Down
6 changes: 2 additions & 4 deletions prototypes/rail-pole.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ function railpoleconnector_prototype:new(entity)
if not rail_pole then
return
end
for wire,targets in pairs(entity.circuit_connected_entities) do
for _,target in pairs(targets) do
rail_pole.connect_neighbour{wire=defines.wire_type[wire],target_entity=target}
end
for _,connection in pairs(entity.circuit_connection_definitions) do
rail_pole.connect_neighbour(connection)
end
local o={
entity=rail_pole,
Expand Down