Quarry: Check for valid facedir to fix server freeze #465 (#466)

Checks if facedir is valid. If the face points up or down the depth-check would run endless and freeze the server
This commit is contained in:
Thomas Rudin 2018-12-09 16:01:10 +01:00 committed by SmallJoker
parent aa82fa1d13
commit 701240bc3a

@ -112,6 +112,11 @@ local function quarry_run(pos, node)
if meta:get_int("enabled") and meta:get_int("HV_EU_input") >= quarry_demand and meta:get_int("purge_on") == 0 then if meta:get_int("enabled") and meta:get_int("HV_EU_input") >= quarry_demand and meta:get_int("purge_on") == 0 then
local pdir = minetest.facedir_to_dir(node.param2) local pdir = minetest.facedir_to_dir(node.param2)
if pdir.y ~= 0 then
-- faces up or down, not valid, otherwise depth-check would run endless and hang up the server
return
end
local qdir = pdir.x == 1 and vector.new(0,0,-1) or local qdir = pdir.x == 1 and vector.new(0,0,-1) or
(pdir.z == -1 and vector.new(-1,0,0) or (pdir.z == -1 and vector.new(-1,0,0) or
(pdir.x == -1 and vector.new(0,0,1) or (pdir.x == -1 and vector.new(0,0,1) or