diff options
author | FaceDeer <FaceDeer@users.noreply.github.com> | 2017-09-30 10:56:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-30 10:56:15 -0600 |
commit | 444411936cc85ba0ef9bfaad11f74544c24cb0b6 (patch) | |
tree | a58d3e8667a8e97e91c2b35e550d58fe3c211611 /upgrades.lua | |
parent | 3441a0d1da37087287fdaade7c8930480abe65e9 (diff) | |
parent | 860890b10061d76c5ea011fe0befca435be5f243 (diff) |
Merge pull request #8 from minetest-mods/cleanup
Cleanup
Diffstat (limited to 'upgrades.lua')
-rw-r--r-- | upgrades.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/upgrades.lua b/upgrades.lua new file mode 100644 index 0000000..8f0c6fb --- /dev/null +++ b/upgrades.lua @@ -0,0 +1,57 @@ +-- 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] + local meta = minetest.get_meta(pos) + meta:set_string("formspec", node_def._digtron_formspec) + 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"}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local list = inv:get_list("main") + inv:set_list("main", {}) + inv:set_list("fuel", list) + end +}) + +minetest.register_lbm({ + name = "digtron:autocontroller_lateral_upgrade", + nodenames = {"digtron:auto_controller"}, + action = function(pos, node) + 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"}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_int("extrusion", 1) + end +})
\ No newline at end of file |