From 701240bc3a17a73d73f3a96cd81e559d662ac42c Mon Sep 17 00:00:00 2001
From: Thomas Rudin <thomas@rudin.li>
Date: Sun, 09 Dec 2018 16:01:10 +0100
Subject: [PATCH] Quarry: Check for valid facedir to fix server freeze #465 (#466)

---
 technic/machines/HV/quarry.lua |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua
index 0a45559..b6f9c14 100644
--- a/technic/machines/HV/quarry.lua
+++ b/technic/machines/HV/quarry.lua
@@ -112,6 +112,11 @@
 
 	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)
+		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
 			(pdir.z == -1 and vector.new(-1,0,0) or
 			(pdir.x == -1 and vector.new(0,0,1) or

--
Gitblit v1.8.0