mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-22 13:52:31 +01:00
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)
|
minetest.register_on_placenode(function(pos, node)
|
||||||
for tier, machine_list in pairs(technic.machines) do
|
for tier, machine_list in pairs(technic.machines) do
|
||||||
for machine_name, _ in pairs(machine_list) do
|
if machine_list[node.name] ~= nil then
|
||||||
if node.name == machine_name then
|
technic.update_cables(pos, tier, true)
|
||||||
technic.update_cables(pos, tier, true)
|
technic.networks = {}
|
||||||
technic.networks = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -75,12 +72,9 @@ end)
|
|||||||
|
|
||||||
minetest.register_on_dignode(function(pos, node)
|
minetest.register_on_dignode(function(pos, node)
|
||||||
for tier, machine_list in pairs(technic.machines) do
|
for tier, machine_list in pairs(technic.machines) do
|
||||||
for machine_name, _ in pairs(machine_list) do
|
if machine_list[node.name] ~= nil then
|
||||||
if node.name == machine_name then
|
technic.update_cables(pos, tier, true)
|
||||||
technic.update_cables(pos, tier, true)
|
technic.networks = {}
|
||||||
technic.networks = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user