diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-04-09 01:27:28 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-04-09 01:27:28 -0400 |
commit | 7acbe4fcf319bffc29812d4c5f3718c5f23886ff (patch) | |
tree | a57cc76d1c820f47e2d120c20c342d01308761db /pipeworks/routing_tubes.lua | |
parent | 72ff7606f50d827849aebad589f16cdc51ad872a (diff) | |
download | dreambuilder_modpack-7acbe4fcf319bffc29812d4c5f3718c5f23886ff.tar dreambuilder_modpack-7acbe4fcf319bffc29812d4c5f3718c5f23886ff.tar.gz dreambuilder_modpack-7acbe4fcf319bffc29812d4c5f3718c5f23886ff.tar.bz2 dreambuilder_modpack-7acbe4fcf319bffc29812d4c5f3718c5f23886ff.tar.xz dreambuilder_modpack-7acbe4fcf319bffc29812d4c5f3718c5f23886ff.zip |
update pipeworks
Diffstat (limited to 'pipeworks/routing_tubes.lua')
-rw-r--r-- | pipeworks/routing_tubes.lua | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pipeworks/routing_tubes.lua b/pipeworks/routing_tubes.lua index fa5cefe..6ed0723 100644 --- a/pipeworks/routing_tubes.lua +++ b/pipeworks/routing_tubes.lua @@ -28,7 +28,36 @@ pipeworks.register_tube("pipeworks:broken_tube", { return true end, priority = 50, - } + }, + on_punch = function(pos, node, puncher, pointed_thing) + local itemstack = puncher:get_wielded_item() + local wieldname = itemstack:get_name() + local playername = puncher:get_player_name() + print("[Pipeworks] "..playername.." struck a broken tube at "..minetest.pos_to_string(pos)) + if wieldname == "anvil:hammer" + or wieldname == "cottages:hammer" + or wieldname == "glooptest:hammer_steel" + or wieldname == "glooptest:hammer_bronze" + or wieldname == "glooptest:hammer_diamond" + or wieldname == "glooptest:hammer_mese" + or wieldname == "glooptest:hammer_alatro" + or wieldname == "glooptest:hammer_arol" then + local meta = minetest.get_meta(pos) + local was_node = minetest.deserialize(meta:get_string("the_tube_was")) + if was_node and was_node ~= "" then + print(" with "..wieldname.." to repair it.") + minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 }) + pipeworks.scan_for_tube_objects(pos) + itemstack:add_wear(1000) + puncher:set_wielded_item(itemstack) + return itemstack + else + print(" but it can't be repaired.") + end + else + print(" with "..wieldname.." but that tool is too weak.") + end + end } }) |