2015-01-11 22:20:57 +01:00
|
|
|
--[[
|
2015-01-12 17:46:30 +01:00
|
|
|
Map Tools: tool definitions
|
2015-01-11 22:20:57 +01:00
|
|
|
|
2020-01-01 04:10:24 +01:00
|
|
|
Copyright © 2012-2020 Hugo Locurcio and contributors.
|
2015-01-11 22:20:57 +01:00
|
|
|
Licensed under the zlib license. See LICENSE.md for more information.
|
|
|
|
--]]
|
|
|
|
|
2019-03-03 20:11:10 +01:00
|
|
|
local S = maptools.S
|
2014-12-27 20:31:31 +01:00
|
|
|
|
|
|
|
maptools.creative = maptools.config["hide_from_creative_inventory"]
|
|
|
|
|
2019-03-03 23:22:33 +01:00
|
|
|
local pick_admin_toolcaps = {
|
|
|
|
full_punch_interval = 0.1,
|
|
|
|
max_drop_level = 3,
|
|
|
|
groupcaps = {
|
|
|
|
unbreakable = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
fleshy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
choppy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
bendy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
cracky = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
crumbly = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
snappy = {times = {[1] = 0, [2] = 0, [3] = 0}, uses = 0, maxlevel = 3},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy = 1000},
|
|
|
|
}
|
|
|
|
|
2014-12-27 20:31:31 +01:00
|
|
|
minetest.register_tool("maptools:pick_admin", {
|
|
|
|
description = S("Admin Pickaxe"),
|
2019-03-03 23:22:33 +01:00
|
|
|
range = 20,
|
2014-12-27 20:31:31 +01:00
|
|
|
inventory_image = "maptools_adminpick.png",
|
|
|
|
groups = {not_in_creative_inventory = maptools.creative},
|
2019-03-03 23:22:33 +01:00
|
|
|
tool_capabilities = pick_admin_toolcaps,
|
|
|
|
on_drop = maptools.drop_msg,
|
2014-12-27 20:31:31 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("maptools:pick_admin_with_drops", {
|
|
|
|
description = S("Admin Pickaxe with Drops"),
|
2019-03-03 23:22:33 +01:00
|
|
|
range = 20,
|
2014-12-27 20:31:31 +01:00
|
|
|
inventory_image = "maptools_adminpick_with_drops.png",
|
|
|
|
groups = {not_in_creative_inventory = maptools.creative},
|
2019-03-03 23:22:33 +01:00
|
|
|
tool_capabilities = pick_admin_toolcaps,
|
|
|
|
on_drop = maptools.drop_msg,
|
2014-12-27 20:31:31 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
|
|
|
if puncher:get_wielded_item():get_name() == "maptools:pick_admin"
|
|
|
|
and minetest.get_node(pos).name ~= "air" then
|
2019-02-20 23:56:20 +01:00
|
|
|
minetest.log(
|
|
|
|
"action",
|
|
|
|
puncher:get_player_name() ..
|
|
|
|
" digs " ..
|
|
|
|
minetest.get_node(pos).name ..
|
|
|
|
" at " ..
|
|
|
|
minetest.pos_to_string(pos) ..
|
|
|
|
" using an Admin Pickaxe."
|
|
|
|
)
|
|
|
|
-- The node is removed directly, which means it even works
|
2019-03-03 20:11:10 +01:00
|
|
|
-- on non-empty containers and group-less nodes
|
2019-02-20 23:56:20 +01:00
|
|
|
minetest.remove_node(pos)
|
2019-03-03 20:11:10 +01:00
|
|
|
-- Run node update actions like falling nodes
|
2019-02-20 23:56:20 +01:00
|
|
|
minetest.check_for_falling(pos)
|
2014-12-27 20:31:31 +01:00
|
|
|
end
|
|
|
|
end)
|