Aaron Suen 42d4cef19b Log splitting relaxations
- Allow splitting "upside down" logs.
- Allow splitting logs from the bottom using at least lode-tier
  tools (allowing automation options).
2020-09-30 06:38:46 -04:00

55 lines
1.3 KiB
Lua

-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local plank = modname .. ":plank"
minetest.register_node(plank, {
description = "Wooden Plank",
tiles = {modname .. "_plank.png"},
groups = {
choppy = 1,
flammable = 2,
fire_fuel = 5
},
sounds = nodecore.sounds("nc_tree_woody")
})
local function splitrecipe(choppy, normaly)
nodecore.register_craft({
label = "split tree to planks",
action = "pummel",
toolgroups = {choppy = choppy},
normal = {y = normaly},
check = function(_, data)
local y = nodecore.facedirs[data.node.param2].t.y
return y == 1 or y == -1
end,
indexkeys = {"group:log"},
nodes = {
{match = {groups = {log = true}}, replace = "air"}
},
items = {
{name = plank, count = 4, scatter = 5}
}
})
end
splitrecipe(1, 1)
splitrecipe(4, -1)
nodecore.register_craft({
label = "bash planks to sticks",
action = "pummel",
toolgroups = {thumpy = 3},
normal = {y = 1},
indexkeys = {plank},
nodes = {
{match = plank, replace = "air"}
},
items = {
{name = "nc_tree:stick 2", count = 4, scatter = 5}
}
})