summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2013-08-29 18:51:53 +0200
committerShadowNinja <noreply@gmail.com>2013-10-04 10:49:06 -0400
commit12d29c213956f140f9930a5ea78c8a9f9284d798 (patch)
tree790b47fc7b09dad9cac47fc5d40b5c7a60f0c7ea
parentf4ac2b8c1ef97a8adf29501f5599fb8adb4df00c (diff)
Forgot to update on cable add/destroy+use minetest.hash_node_position because else it did not work.
-rw-r--r--technic/machines/register/cables.lua6
-rw-r--r--technic/machines/switching_station.lua4
2 files changed, 8 insertions, 2 deletions
diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua
index 39b3f08..8da650b 100644
--- a/technic/machines/register/cables.lua
+++ b/technic/machines/register/cables.lua
@@ -35,6 +35,12 @@ function technic.register_cable(tier, size)
type = "fixed",
fixed = technic.gen_cable_nodebox(x1, y1, z1, x2, y2, z2, size)
},
+ on_construct = function()
+ technic.networks = {}
+ end,
+ on_destruct = function()
+ technic.networks = {}
+ end,
after_place_node = function(pos)
local node = minetest.get_node(pos)
technic.update_cables(pos, technic.get_cable_tier(node.name))
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index 25310eb..449b4c9 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -136,7 +136,7 @@ local touch_nodes = function(list, tier)
end
local get_network = function(pos1, tier)
- local cached = technic.networks[pos1]
+ local cached = technic.networks[minetest.hash_node_position(pos1)]
if cached and cached.tier == tier then
touch_nodes(cached.PR_nodes, tier)
touch_nodes(cached.BA_nodes, tier)
@@ -153,7 +153,7 @@ local get_network = function(pos1, tier)
i, technic.machines[tier], tier)
i = i + 1
until all_nodes[i] == nil
- technic.networks[pos1] = {tier = tier, PR_nodes = PR_nodes, RE_nodes = RE_nodes, BA_nodes = BA_nodes}
+ technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes, RE_nodes = RE_nodes, BA_nodes = BA_nodes}
return PR_nodes, BA_nodes, RE_nodes
end