Commit cd044fcf authored by Fedja Beader's avatar Fedja Beader
Browse files

oresaw: add .oresaw on|off (default on)

parent d3958f21
......@@ -61,8 +61,11 @@ local ore_saw_nodes = {
}
local enabled = true
local old_pos = { x = -1, y = -1, z = -1 }
core.register_on_punchnode(function(pos, node)
if not enabled then return end
local itemstack = core.localplayer:get_wielded_item()
if not (itemstack:get_name() == "terumet:tool_ore_saw_adv" or itemstack:get_name() == "terumet:tool_ore_saw")
and ore_saw_nodes[node.name] then
......@@ -88,3 +91,27 @@ core.register_on_punchnode(function(pos, node)
return true
end
end)
local function help()
return "Invalid use of .oresaw, help:\n"
.. ".oresaw on|off\n"
end
core.register_chatcommand("oresaw", {
func = function(param)
local args = string.split(param, ' ')
if args[1] == "on" then
enabled = true
elseif args[1] == "off" then
enabled = false
else
l:info(help())
end
return true
end,
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment