2018-12-30 19:37:59 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
|
|
|
local ItemStack, minetest, nodecore
|
2019-01-06 18:46:00 -05:00
|
|
|
= ItemStack, minetest, nodecore
|
2018-12-30 19:37:59 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
2018-12-30 19:16:16 -05:00
|
|
|
local modname = minetest.get_current_modname()
|
2018-12-30 17:36:47 -05:00
|
|
|
|
2019-01-06 17:09:34 -05:00
|
|
|
local function toolhead(name, from, group, sticks, times)
|
2019-01-03 23:19:41 -05:00
|
|
|
local n
|
|
|
|
if name then
|
2019-01-04 00:05:10 -05:00
|
|
|
n = modname .. ":toolhead_" .. name:lower()
|
2019-01-03 23:19:41 -05:00
|
|
|
local t = n:gsub(":", "_") .. ".png"
|
|
|
|
minetest.register_craftitem(n, {
|
2019-01-04 20:11:04 -05:00
|
|
|
description = "Wooden " .. name .. " Head",
|
2019-01-03 23:19:41 -05:00
|
|
|
inventory_image = t,
|
2019-01-06 14:51:09 -05:00
|
|
|
stack_max = 1,
|
|
|
|
groups = {
|
2019-01-17 00:01:00 -05:00
|
|
|
flammable = 2
|
2019-01-06 14:51:09 -05:00
|
|
|
}
|
2019-01-03 23:19:41 -05:00
|
|
|
})
|
2019-01-04 20:11:04 -05:00
|
|
|
local m = modname .. ":tool_" .. name:lower()
|
|
|
|
local u = m:gsub(":", "_") .. ".png"
|
|
|
|
minetest.register_tool(m, {
|
|
|
|
description = "Wooden " .. name,
|
|
|
|
inventory_image = u,
|
2019-01-06 14:51:09 -05:00
|
|
|
groups = {
|
2019-01-17 00:01:00 -05:00
|
|
|
flammable = 2
|
2019-01-06 14:51:09 -05:00
|
|
|
},
|
2019-01-24 22:08:05 -05:00
|
|
|
tool_capabilities = nodecore.toolcaps({
|
|
|
|
[group] = 2
|
|
|
|
})
|
2019-01-04 20:11:04 -05:00
|
|
|
})
|
2019-01-03 23:42:53 -05:00
|
|
|
nodecore.register_craft({
|
|
|
|
normal = {y = 1},
|
|
|
|
nodes = {
|
|
|
|
{match = n, replace = "air"},
|
2019-01-04 20:11:04 -05:00
|
|
|
{y = -1, match = modname .. ":staff", replace = "air"},
|
|
|
|
},
|
|
|
|
items = {
|
|
|
|
{y = -1, name = m},
|
2019-01-03 23:42:53 -05:00
|
|
|
}
|
|
|
|
})
|
2019-01-03 23:19:41 -05:00
|
|
|
end
|
|
|
|
nodecore.extend_pummel(from,
|
|
|
|
function(pos, node, stats)
|
|
|
|
return nodecore.wieldgroup(stats.puncher, "choppy")
|
|
|
|
end,
|
|
|
|
function(pos, node, stats)
|
|
|
|
if stats.duration < 5 then return end
|
|
|
|
minetest.remove_node(pos)
|
2019-01-04 00:05:10 -05:00
|
|
|
if n then nodecore.place_stack(pos, n) end
|
2019-01-03 23:19:41 -05:00
|
|
|
if sticks then
|
|
|
|
minetest.item_drop(ItemStack("nc_tree:stick " .. sticks),
|
|
|
|
nil, {x = pos.x, y = pos.y + 1, z = pos.z})
|
2019-01-05 23:11:38 -05:00
|
|
|
nodecore.wear_current_tool(stats.puncher, {choppy = 3})
|
2018-12-30 19:16:16 -05:00
|
|
|
end
|
2019-01-03 23:19:41 -05:00
|
|
|
return true
|
2018-12-30 19:16:16 -05:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2019-01-06 17:09:34 -05:00
|
|
|
toolhead("Mallet", modname .. ":plank",
|
|
|
|
"thumpy", 2, {
|
|
|
|
[2] = 5.00,
|
|
|
|
[3] = 2.00
|
|
|
|
})
|
|
|
|
toolhead("Spade", modname .. ":toolhead_mallet",
|
|
|
|
"crumbly", 1)
|
|
|
|
toolhead("Hatchet", modname .. ":toolhead_spade",
|
|
|
|
"choppy", 1)
|
|
|
|
toolhead("Pick", modname .. ":toolhead_hatchet",
|
|
|
|
"cracky", 2, {
|
|
|
|
[2] = 20.00,
|
2019-01-08 02:03:18 -05:00
|
|
|
[3] = 5.00
|
2019-01-06 17:09:34 -05:00
|
|
|
})
|
|
|
|
toolhead(nil, modname.. ":toolhead_pick",
|
|
|
|
nil, 2)
|