mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-08 16:33:58 +01:00
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.
This commit is contained in:
parent
32f331e7c4
commit
f76668969e
@ -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
|
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
|
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
|
||||||
local spigotname = minetest.get_node(pos).name
|
local spigotname = minetest.get_node(pos).name
|
||||||
local fdir=node.param2
|
local fdir=node.param2 % 4
|
||||||
local check = {
|
local check = {
|
||||||
{x=pos.x,y=pos.y,z=pos.z+1},
|
{x=pos.x,y=pos.y,z=pos.z+1},
|
||||||
{x=pos.x+1,y=pos.y,z=pos.z},
|
{x=pos.x+1,y=pos.y,z=pos.z},
|
||||||
|
Loading…
Reference in New Issue
Block a user