Add forge node. Set up LBM to set meta after placing schem

This commit is contained in:
LoneWolfHT 2019-11-11 16:46:09 -08:00
parent 2eb0f96109
commit 25c79435f7
4 changed files with 43 additions and 2 deletions

View File

@ -1,5 +1,17 @@
nodes = {}
minetest.register_lbm({ -- Loads nodes placed by schematics that have meta
label = "Load special nodes placed by schematics",
name = "nodes:loadspecialnodes",
nodenames = {"group:loadme"},
run_at_every_load = true,
action = function(pos, node)
if minetest.get_meta(pos):get_int("loaded") ~= 0 then return end -- Already loaded
minetest.registered_nodes[node.name].on_construct(pos)
end
})
--
--- Include the rest of the mod's lua files
--

Binary file not shown.

View File

@ -1,9 +1,16 @@
minetest.register_node("nodes:anvil", {
description = "Anvil - Used for enhancing tools",
description = "Anvil - Used for enhancing tools/armor",
tiles = {"nodes_iron.png"},
drawtype = "nodebox",
paramtype = "light",
groups = {unbreakable = 1},
groups = {unbreakable = 1, loadme = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Anvil - Used for enhancing tools/armor\nRightclick with tool to start")
meta:set_int("loaded", 1)
end,
node_box = {
type = "fixed",
fixed = {
@ -15,3 +22,25 @@ minetest.register_node("nodes:anvil", {
},
paramtype2 = "facedir",
})
minetest.register_node("nodes:forge", {
description = "Forge - Used for reforging tools/armor",
tiles = {"nodes_iron.png"},
drawtype = "nodebox",
paramtype = "light",
groups = {unbreakable = 1, loadme = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Forge - Used for reforging tools/armor\nRightclick with tool to start")
meta:set_int("loaded", 1)
end,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- base
}
},
paramtype2 = "facedir",
})