summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2016-06-11 17:09:07 -0700
committerAuke Kok <sofar@foo-projects.org>2016-06-11 17:09:07 -0700
commitf76668969e69b1410d9fe1db07b4326cffdb58b0 (patch)
treebc42cef75899dda4cfa7e182aac48583b5578f9a
parent32f331e7c4de3c5e130eff55ede475f9b212463a (diff)
downloadpipeworks-f76668969e69b1410d9fe1db07b4326cffdb58b0.tar
pipeworks-f76668969e69b1410d9fe1db07b4326cffdb58b0.tar.gz
pipeworks-f76668969e69b1410d9fe1db07b4326cffdb58b0.tar.bz2
pipeworks-f76668969e69b1410d9fe1db07b4326cffdb58b0.tar.xz
pipeworks-f76668969e69b1410d9fe1db07b4326cffdb58b0.zip
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.
-rw-r--r--flowing_logic.lua2
1 files changed, 1 insertions, 1 deletions
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},