From 323300cc82cf4880d0ac525a3fca1ba8b0bd0fda Mon Sep 17 00:00:00 2001 From: kilbith Date: Sat, 23 Jan 2016 13:06:42 +0100 Subject: [PATCH] Work table : restrict repairing function to some tools --- worktable.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/worktable.lua b/worktable.lua index 9d0cfd5..350e9a0 100644 --- a/worktable.lua +++ b/worktable.lua @@ -299,9 +299,14 @@ end function worktable.put(pos, listname, _, stack) local stackname = stack:get_name() local mod, node = stackname:match("(.*):(.*)") + local allowed_tools = "pick, axe, shovel, sword, hoe, armor" - if (listname == "tool" and stack:get_wear() > 0 and stackname ~= "xdecor:hammer") or - (listname == "input" and worktable.allowed(nodes[mod], node)) or + for v in allowed_tools:gmatch("[%w_]+") do + if listname == "tool" and stack:get_wear() > 0 and stackname:find(v) then + return stack:get_count() + end + end + if (listname == "input" and worktable.allowed(nodes[mod], node)) or (listname == "hammer" and stackname == "xdecor:hammer") or listname == "storage" or listname == "trash" then if listname == "trash" then trash_delete(pos) end