From f76668969e69b1410d9fe1db07b4326cffdb58b0 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 11 Jun 2016 17:09:07 -0700 Subject: Do not trust node.param2. The table lookup will fail if node.param2 is outside [0-3] which is easily possible since there are several ways to modify param2 values of nodes. Force truncating param2 to always be 0-3 before using it in a table lookup. --- flowing_logic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flowing_logic.lua') diff --git a/flowing_logic.lua b/flowing_logic.lua index e0a6236..5166b15 100644 --- a/flowing_logic.lua +++ b/flowing_logic.lua @@ -71,7 +71,7 @@ pipeworks.spigot_check = function(pos, node) local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then local spigotname = minetest.get_node(pos).name - local fdir=node.param2 + local fdir=node.param2 % 4 local check = { {x=pos.x,y=pos.y,z=pos.z+1}, {x=pos.x+1,y=pos.y,z=pos.z}, -- cgit v1.2.3