24e4f73213
Much TODO: - Primitive adze should not harvest trees whole; need to split into planks from end only. - Not entirely satisfied with crafting experience from gameplay nor API perspective. - Need an easier way to register these kinds of recipe checks. - Need more gameplay actions to commmit a craft, e.g. have to pound the tool head into place.
41 lines
1.2 KiB
Lua
41 lines
1.2 KiB
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local dofile, ipairs, minetest, nodecore, pairs, rawset, type
|
|
= dofile, ipairs, minetest, nodecore, pairs, rawset, type
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
nodecore = nodecore or {}
|
|
rawset(_G, "nodecore", nodecore)
|
|
|
|
for k, v in pairs(minetest) do
|
|
if type(v) == "function" then
|
|
-- Late-bind in case minetest methods overridden.
|
|
nodecore[k] = function(...) return minetest[k](...) end
|
|
else
|
|
nodecore[k] = v
|
|
end
|
|
end
|
|
|
|
nodecore.registered_on_register_node = {}
|
|
local oldreg = minetest.register_node
|
|
function minetest.register_node(name, def, ...)
|
|
for _, v in ipairs(nodecore.registered_on_register_node) do
|
|
local x = v(name, def, ...)
|
|
if x then return x end
|
|
end
|
|
return oldreg(name, def, ...)
|
|
end
|
|
function nodecore.register_on_register_node(func)
|
|
local t = nodecore.registered_on_register_node
|
|
t[#t + 1] = func
|
|
end
|
|
|
|
local path = minetest.get_modpath(modname)
|
|
|
|
dofile(path .. "/node_drop_in_place.lua")
|
|
dofile(path .. "/node_falling_repose.lua")
|
|
dofile(path .. "/node_alternate_loose.lua")
|
|
|
|
dofile(path .. "/action_node_pummel.lua")
|