forked from minetest-mods/technic
The code to connect an electrical machine to cables would only consider
the first-seen tier for which the machine was registered. So the switching station, which is uniquely registered for all tiers, would only visually connect to LV cable when placed, not to MV or HV cable. (It would function nevertheless, and cable would connect to the switching station if placed later.) Change to consider all tiers. Incidentally avoid a gratuitous iteration through all registered machines.
This commit is contained in:
parent
593972b156
commit
18cae761af
|
@ -62,12 +62,9 @@ end
|
|||
|
||||
minetest.register_on_placenode(function(pos, node)
|
||||
for tier, machine_list in pairs(technic.machines) do
|
||||
for machine_name, _ in pairs(machine_list) do
|
||||
if node.name == machine_name then
|
||||
technic.update_cables(pos, tier, true)
|
||||
technic.networks = {}
|
||||
return
|
||||
end
|
||||
if machine_list[node.name] ~= nil then
|
||||
technic.update_cables(pos, tier, true)
|
||||
technic.networks = {}
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -75,12 +72,9 @@ end)
|
|||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
for tier, machine_list in pairs(technic.machines) do
|
||||
for machine_name, _ in pairs(machine_list) do
|
||||
if node.name == machine_name then
|
||||
technic.update_cables(pos, tier, true)
|
||||
technic.networks = {}
|
||||
return
|
||||
end
|
||||
if machine_list[node.name] ~= nil then
|
||||
technic.update_cables(pos, tier, true)
|
||||
technic.networks = {}
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue
Block a user