2017-09-20 06:57:40 +02:00
|
|
|
-- re-applies the "_digtron_formspec" property from all digtron node defs to the digtron node's metadata.
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "digtron:generic_formspec_sanitizer",
|
|
|
|
nodenames = {"group:digtron"},
|
|
|
|
action = function(pos, node)
|
|
|
|
local node_def = minetest.registered_nodes[node.name]
|
2017-10-22 06:29:18 +02:00
|
|
|
if node_def._digtron_formspec then
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec", node_def._digtron_formspec(pos, meta))
|
|
|
|
end
|
2017-09-20 06:57:40 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "digtron:sand_digger_upgrade",
|
|
|
|
nodenames = {"digtron:sand_digger"},
|
|
|
|
action = function(pos, node)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local offset = meta:get_string("offset")
|
|
|
|
local period = meta:get_string("period")
|
|
|
|
minetest.set_node(pos, {name = "digtron:soft_digger",
|
|
|
|
param2 = node.param2})
|
|
|
|
meta:set_string("offset", offset)
|
|
|
|
meta:set_string("period", period)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "digtron:fuelstore_upgrade",
|
|
|
|
nodenames = {"digtron:fuelstore"},
|
2023-06-19 07:44:40 +02:00
|
|
|
action = function(pos)
|
2017-09-20 06:57:40 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local inv = meta:get_inventory()
|
|
|
|
local list = inv:get_list("main")
|
|
|
|
inv:set_list("main", {})
|
2023-06-19 07:44:40 +02:00
|
|
|
inv:set_list("fuel", list)
|
2017-09-20 06:57:40 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "digtron:autocontroller_lateral_upgrade",
|
|
|
|
nodenames = {"digtron:auto_controller"},
|
2023-06-19 07:44:40 +02:00
|
|
|
action = function(pos)
|
2017-09-20 06:57:40 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local cycles = meta:get_int("offset")
|
|
|
|
meta:set_int("cycles", cycles)
|
|
|
|
meta:set_int("offset", 0)
|
|
|
|
meta:set_int("slope", 0)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_lbm({
|
|
|
|
name = "digtron:builder_extrusion_upgrade",
|
|
|
|
nodenames = {"digtron:builder"},
|
2023-06-19 07:44:40 +02:00
|
|
|
action = function(pos)
|
2017-09-20 06:57:40 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_int("extrusion", 1)
|
|
|
|
end
|
|
|
|
})
|