2019-02-19 23:53:40 -05:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
2019-03-23 17:41:31 -04:00
|
|
|
local ipairs, minetest, nodecore, pairs, type
|
|
|
|
= ipairs, minetest, nodecore, pairs, type
|
2019-02-19 23:53:40 -05:00
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
2019-03-23 17:41:31 -04:00
|
|
|
local function toolhead(name, groups, prills)
|
2019-02-19 23:53:40 -05:00
|
|
|
local n = name:lower()
|
|
|
|
|
2019-03-23 17:41:31 -04:00
|
|
|
if type(groups) == "string" then groups = {groups} end
|
2019-08-31 09:26:53 -04:00
|
|
|
local function toolcap(nn)
|
2019-03-23 17:41:31 -04:00
|
|
|
local t = {}
|
2019-08-31 09:26:53 -04:00
|
|
|
for _, k in ipairs(groups) do t[k] = nn end
|
2019-03-23 17:41:31 -04:00
|
|
|
return nodecore.toolcaps(t)
|
|
|
|
end
|
|
|
|
|
2019-02-19 23:53:40 -05:00
|
|
|
nodecore.register_lode("toolhead_" .. n, {
|
|
|
|
type = "craft",
|
2019-02-20 01:58:14 -05:00
|
|
|
description = "## Lode " .. name .. " Head",
|
2019-02-19 23:53:40 -05:00
|
|
|
inventory_image = modname .. "_#.png^[mask:" ..
|
|
|
|
modname .. "_toolhead_" .. n .. ".png",
|
|
|
|
stack_max = 1
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_lode("tool_" .. n, {
|
|
|
|
type = "tool",
|
|
|
|
description = "## Lode " .. name,
|
|
|
|
inventory_image = modname .. "_tool_handle.png^(" ..
|
|
|
|
modname .. "_#.png^[mask:" ..
|
|
|
|
modname .. "_tool_" .. n .. ".png)",
|
|
|
|
stack_max = 1,
|
2019-03-23 17:41:31 -04:00
|
|
|
tool_capabilities = toolcap(4),
|
2019-02-19 23:53:40 -05:00
|
|
|
bytemper = function(t, d)
|
2019-04-03 08:10:03 -04:00
|
|
|
if t.name == "tempered" then
|
2019-03-23 17:41:31 -04:00
|
|
|
d.tool_capabilities = toolcap(5)
|
2019-02-19 23:53:40 -05:00
|
|
|
end
|
2019-11-17 08:55:24 -05:00
|
|
|
d.skip_register = (t.name == "hot") or nil
|
2019-02-19 23:53:40 -05:00
|
|
|
end,
|
2019-12-01 11:08:12 -05:00
|
|
|
groups = {flammable = 4},
|
2019-03-08 23:22:14 -05:00
|
|
|
metal_alt_hot = modname .. ":prill_hot " .. prills,
|
2019-09-07 11:28:51 -04:00
|
|
|
tool_wears_to = modname .. ":prill_# " .. prills,
|
|
|
|
on_ignite = modname .. ":prill_# " .. prills
|
2019-02-19 23:53:40 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
for _, t in pairs({"annealed", "tempered"}) do
|
|
|
|
nodecore.register_craft({
|
2019-02-21 14:37:22 -05:00
|
|
|
label = "assemble lode " .. n,
|
2019-02-19 23:53:40 -05:00
|
|
|
normal = {y = 1},
|
|
|
|
nodes = {
|
|
|
|
{match = modname .. ":toolhead_" .. n .. "_" .. t,
|
|
|
|
replace = "air"},
|
|
|
|
{y = -1, match = "nc_woodwork:staff", replace = "air"},
|
|
|
|
},
|
|
|
|
items = {
|
|
|
|
{y = -1, name = modname .. ":tool_" .. n .. "_" .. t},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-03-08 23:22:14 -05:00
|
|
|
toolhead("Mallet", "thumpy", 3)
|
|
|
|
toolhead("Spade", "crumbly", 2)
|
|
|
|
toolhead("Hatchet", "choppy", 2)
|
|
|
|
toolhead("Pick", "cracky", 1)
|
2019-02-19 23:53:40 -05:00
|
|
|
|
2020-01-24 19:28:41 -05:00
|
|
|
local function forgecore(from, fromqty, to, prills, fromtemper, anviltemper)
|
2019-02-19 23:53:40 -05:00
|
|
|
return nodecore.register_craft({
|
2020-01-24 19:28:41 -05:00
|
|
|
label = anviltemper .. " anvil making " .. fromtemper .. " lode " .. (to or "prills"),
|
2019-02-19 23:53:40 -05:00
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {thumpy = 3},
|
|
|
|
nodes = {
|
|
|
|
{
|
2020-01-24 19:28:41 -05:00
|
|
|
match = {name = modname .. ":" .. from .. "_" .. fromtemper,
|
2019-03-23 17:41:31 -04:00
|
|
|
count = fromqty},
|
2019-02-19 23:53:40 -05:00
|
|
|
replace = "air"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
y = -1,
|
2020-01-24 19:28:41 -05:00
|
|
|
match = modname .. ":block_" .. anviltemper
|
2019-02-19 23:53:40 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
items = {
|
2020-01-24 19:28:41 -05:00
|
|
|
to and (modname .. ":" .. to .. "_" .. fromtemper) or nil,
|
|
|
|
prills and {name = modname .. ":prill_" .. fromtemper, count = prills,
|
2019-02-19 23:53:40 -05:00
|
|
|
scatter = 5} or nil
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2020-01-24 19:28:41 -05:00
|
|
|
|
|
|
|
local function forge(from, fromqty, to, prills)
|
|
|
|
forgecore(from, fromqty, to, prills, "hot", "annealed")
|
|
|
|
forgecore(from, fromqty, to, prills, "hot", "tempered")
|
|
|
|
return forgecore(from, fromqty, to, prills, "annealed", "tempered")
|
|
|
|
end
|
|
|
|
|
2019-02-19 23:53:40 -05:00
|
|
|
forge("prill", 3, "toolhead_mallet")
|
|
|
|
forge("toolhead_mallet", nil, "toolhead_spade", 1)
|
|
|
|
forge("toolhead_spade", nil, "toolhead_hatchet")
|
|
|
|
forge("toolhead_hatchet", nil, "toolhead_pick", 1)
|
|
|
|
forge("toolhead_pick", nil, nil, 1)
|
2019-03-23 17:41:31 -04:00
|
|
|
|
|
|
|
toolhead("Mattock", {"cracky", "crumbly"}, 3)
|
2019-03-23 17:44:18 -04:00
|
|
|
local function mattock(a, b)
|
|
|
|
return nodecore.register_craft({
|
|
|
|
label = "assemble lode mattock head",
|
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {thumpy = 3},
|
|
|
|
normal = {y = 1},
|
|
|
|
nodes = {
|
|
|
|
{
|
|
|
|
y = a,
|
|
|
|
match = modname .. ":toolhead_pick_hot",
|
|
|
|
replace = "air"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
y = b,
|
|
|
|
match = modname .. ":toolhead_spade_hot",
|
|
|
|
replace = "air"
|
|
|
|
}
|
2019-03-23 17:41:31 -04:00
|
|
|
},
|
2019-03-23 17:44:18 -04:00
|
|
|
items = {
|
|
|
|
modname .. ":toolhead_mattock_hot"
|
2019-03-23 17:41:31 -04:00
|
|
|
}
|
2019-03-23 17:44:18 -04:00
|
|
|
})
|
|
|
|
end
|
|
|
|
mattock(0, -1)
|
|
|
|
mattock(-1, 0)
|