From 019cb8b85adb2392422d6abd42fe08333be7eac3 Mon Sep 17 00:00:00 2001 From: Hermios Date: Tue, 7 May 2024 17:20:32 +0300 Subject: [PATCH] Replace circuit_connector with circuit definitions --- control.lua | 8 +++----- prototypes/rail-pole.lua | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/control.lua b/control.lua index d25a0ec..039e3c3 100644 --- a/control.lua +++ b/control.lua @@ -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 diff --git a/prototypes/rail-pole.lua b/prototypes/rail-pole.lua index 87d46c1..392b106 100644 --- a/prototypes/rail-pole.lua +++ b/prototypes/rail-pole.lua @@ -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,