diff options
author | RealBadAngel <maciej.kasatkin@yahoo.com> | 2014-04-27 15:57:11 +0200 |
---|---|---|
committer | RealBadAngel <maciej.kasatkin@yahoo.com> | 2014-04-27 15:57:11 +0200 |
commit | 18cae761afa7a979929176f401b204418fae5971 (patch) | |
tree | 4f6e3fd63d21fb29b7a10e32f3048afb083edb7f | |
parent | 593972b1561016b9fd700998b1ef0d48abd25eda (diff) |
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.
-rw-r--r-- | technic/machines/register/cables.lua | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 3bf2208..4f7dcf5 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -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) |