100
100
-- Add a wire node to the LV/MV/HV network
101
101
-- Returns: indicator whether the cable is new in the network
102
102
local hash_node_position = minetest .hash_node_position
103
- local function add_network_node (nodes , pos , network_id )
103
+ local function add_network_node (nodes , pos , network_id , cable )
104
104
local node_id = hash_node_position (pos )
105
- technic .cables [node_id ] = network_id
105
+ if cable then
106
+ technic .cables [node_id ] = network_id
107
+ end
106
108
if nodes [node_id ] then
107
109
return false
108
110
end
@@ -111,7 +113,7 @@ local function add_network_node(nodes, pos, network_id)
111
113
end
112
114
113
115
local function add_cable_node (nodes , pos , network_id , queue )
114
- if add_network_node (nodes , pos , network_id ) then
116
+ if add_network_node (nodes , pos , network_id , true ) then
115
117
queue [# queue + 1 ] = pos
116
118
end
117
119
end
@@ -149,18 +151,18 @@ local check_node_subp = function(network, pos, machines, sw_pos, from_below, net
149
151
end
150
152
151
153
if eu_type == technic .producer then
152
- add_network_node (network .PR_nodes , pos , network_id )
154
+ add_network_node (network .PR_nodes , pos , network_id , false )
153
155
elseif eu_type == technic .receiver then
154
- add_network_node (network .RE_nodes , pos , network_id )
156
+ add_network_node (network .RE_nodes , pos , network_id , false )
155
157
elseif eu_type == technic .producer_receiver then
156
- add_network_node (network .PR_nodes , pos , network_id )
157
- add_network_node (network .RE_nodes , pos , network_id )
158
+ add_network_node (network .PR_nodes , pos , network_id , false )
159
+ add_network_node (network .RE_nodes , pos , network_id , false )
158
160
elseif eu_type == technic .battery then
159
- add_network_node (network .BA_nodes , pos , network_id )
161
+ add_network_node (network .BA_nodes , pos , network_id , false )
160
162
elseif eu_type == " SPECIAL" and from_below and
161
163
not vector .equals (pos , sw_pos ) then
162
164
-- Another switching station -> disable it
163
- add_network_node (network .SP_nodes , pos , network_id )
165
+ add_network_node (network .SP_nodes , pos , network_id , false )
164
166
meta :set_int (" active" , 0 )
165
167
end
166
168
0 commit comments