2019-01-25 09:26:15 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-08-31 09:26:53 -04:00
|
|
|
local ipairs, minetest, nodecore
|
|
|
|
= ipairs, minetest, nodecore
|
2019-01-25 09:26:15 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
|
|
|
nodecore.register_stone_tip_tool,
|
|
|
|
nodecore.registered_stone_tip_tools
|
|
|
|
= nodecore.mkreg()
|
|
|
|
|
2019-03-14 20:08:08 -04:00
|
|
|
local stoned = nodecore.sounds("nc_terrain_stony").place
|
|
|
|
|
2019-01-25 09:26:15 -05:00
|
|
|
local chip = modname .. ":chip"
|
|
|
|
nodecore.extend_item(chip, function(copy, orig)
|
|
|
|
copy.on_place = function(itemstack, placer, pointed_thing, ...)
|
2019-02-24 21:54:33 -05:00
|
|
|
if not nodecore.interact(placer) then return end
|
2019-01-25 09:26:15 -05:00
|
|
|
if itemstack:get_name() == chip and pointed_thing.type == "node" then
|
|
|
|
local pos = pointed_thing.under
|
2019-08-31 09:26:53 -04:00
|
|
|
for _, v in ipairs(nodecore.registered_stone_tip_tools) do
|
2019-02-23 13:34:41 -05:00
|
|
|
if nodecore.match(pos, {
|
|
|
|
name = v.from,
|
2019-03-14 20:08:08 -04:00
|
|
|
wear = 0.05
|
2019-08-27 19:14:51 -04:00
|
|
|
}) then
|
2019-01-25 09:26:15 -05:00
|
|
|
minetest.remove_node(pos)
|
|
|
|
nodecore.item_eject(pos, v.to)
|
2019-03-14 20:08:08 -04:00
|
|
|
stoned.pos = pos
|
2020-04-05 21:22:51 -04:00
|
|
|
nodecore.sound_play(stoned.name, stoned)
|
2019-01-25 09:26:15 -05:00
|
|
|
itemstack:set_count(itemstack:get_count() - 1)
|
2019-04-03 07:40:19 -04:00
|
|
|
if placer then
|
2020-09-04 16:27:44 -04:00
|
|
|
nodecore.player_discover(placer,
|
|
|
|
"craft:assemble " .. v.to)
|
2019-04-03 07:40:19 -04:00
|
|
|
end
|
2019-01-25 09:26:15 -05:00
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return orig.on_place(itemstack, placer, pointed_thing, ...)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
local function tooltip(name, group)
|
|
|
|
local tool = modname .. ":tool_" .. name:lower()
|
|
|
|
local wood = "nc_woodwork:tool_" .. name:lower()
|
|
|
|
minetest.register_tool(tool, {
|
|
|
|
description = "Stone-Tipped " .. name,
|
|
|
|
inventory_image = "nc_woodwork_tool_" .. name:lower() .. ".png^"
|
|
|
|
.. modname .. "_tip_" .. name:lower() .. ".png",
|
|
|
|
tool_wears_to = wood,
|
|
|
|
groups = {
|
|
|
|
flammable = 2
|
|
|
|
},
|
|
|
|
tool_capabilities = nodecore.toolcaps({
|
|
|
|
uses = 0.25,
|
|
|
|
[group] = 3
|
2019-03-14 01:16:44 -04:00
|
|
|
}),
|
2019-09-07 11:28:51 -04:00
|
|
|
on_ignite = modname .. ":chip",
|
2019-03-14 01:16:44 -04:00
|
|
|
sounds = nodecore.sounds("nc_terrain_stony")
|
2019-01-25 09:26:15 -05:00
|
|
|
})
|
|
|
|
nodecore.register_stone_tip_tool({from = wood, to = tool})
|
|
|
|
end
|
|
|
|
|
|
|
|
tooltip("Mallet", "thumpy")
|
|
|
|
tooltip("Spade", "crumbly")
|
|
|
|
tooltip("Hatchet", "choppy")
|
|
|
|
tooltip("Pick", "cracky")
|