From 84133a10df9f0c7d0d11e0ece8b5603e44208185 Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Sun, 19 Feb 2017 15:15:00 -0800 Subject: Use `minetest.hash_node_position` for searches. Previously, Digilines used concatenations of X/Y/Z coordinates into strings as keys to check for repeatedly visiting the same node during a graph search. Replace them with integer keys generated by `minetest.hash_node_position`, which should be more efficient. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 2f48a73..bffd4e7 100644 --- a/init.lua +++ b/init.lua @@ -9,7 +9,7 @@ dofile(modpath .. "/wire_std.lua") function digiline:receptor_send(pos, rules, channel, msg) local checked = {} - checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself + checked[minetest.hash_node_position(pos)] = true -- exclude itself for _,rule in ipairs(rules) do if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked) -- cgit v1.2.3