From d1715c47f801c34bc3bf82ae2279b0c263651c70 Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Sat, 22 Sep 2012 05:34:33 +0200 Subject: [PATCH] Added treetap --- init.lua | 6 +++-- textures/technic_tree_tap.png | Bin 0 -> 1045 bytes tree_tap.lua | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 textures/technic_tree_tap.png create mode 100644 tree_tap.lua diff --git a/init.lua b/init.lua index 3334798..86b695e 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- Minetest 0.4.2 rc1: technic +-- Minetest 0.4.3 : technic minetest.register_alias("rebar", "technic:rebar") minetest.register_alias("concrete", "technic:concrete") @@ -31,7 +31,7 @@ dofile(minetest.get_modpath("technic").."/music_player.lua") dofile(minetest.get_modpath("technic").."/grinder.lua") dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua") --dofile(minetest.get_modpath("technic").."/project_table.lua") ---dofile(minetest.get_modpath("technic").."/injector.lua") +dofile(minetest.get_modpath("technic").."/injector.lua") dofile(minetest.get_modpath("technic").."/generator.lua") dofile(minetest.get_modpath("technic").."/solar_panel.lua") dofile(minetest.get_modpath("technic").."/geothermal.lua") @@ -41,6 +41,8 @@ dofile(minetest.get_modpath("technic").."/items.lua") dofile(minetest.get_modpath("technic").."/mining_drill.lua") dofile(minetest.get_modpath("technic").."/screwdriver.lua") dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua") +dofile(minetest.get_modpath("technic").."/node_breaker.lua") +dofile(minetest.get_modpath("technic").."/tree_tap.lua") function has_locked_chest_privilege(meta, player) diff --git a/textures/technic_tree_tap.png b/textures/technic_tree_tap.png new file mode 100644 index 0000000000000000000000000000000000000000..542f30f90354cbf7c535e395c949ac6aab16c95d GIT binary patch literal 1045 zcmV+w1nT>VP)VMh!EQnK`G6dZpLi>(y3MdSE#4oyYg%d!6~<|1y@B zm;d!0V`F35Lz(uR3lK;1_lPGR;wtb zI5;@KvMkc+bZBR1C-qr?wY9Y`YPDL2Wm#NZU2$=7foYmdPEIygR#uKPnGC+~IM!jAqkw_q=BnSd-Zf=Oj;|L)Lhr<9gn@vik(%=_B=OR;$ryG{|PNghCF9T=b@CM*=*vvF11=svn-4D_I9qXuerIo;q>$r+qSW78vvyg zhlhtmA`$BKIwvP5Xqra7UjL|DKQPJM+#DMl8=s7Uk&zMQc^;nU5d;AM$z+l{V3kUx zG~f4WG#b?F_48;ndg6JW2GHHz9opO5%Rg#?$CLw1PELMbE|;CFt1EhXddOrl=(;Y? z&d$CA-b5l1eBY;9tKejeFIQXSu7;oNN z#kOsP5TS?r9x4YAPX$l}c)8Xh;D;rBcxWIy*aw$K#xxowYOu^t%eEq?G8o{-^M6epLXa z)Rb-8bD2!$7t=H~!!UUNX`1%BE&wQ(%fA8i_V#`&r6d#z(b3U?uIpT0UbZv~evd>V z!S(eumSqtH0kK%DH2@P66Krj5z0)+!l~NLm#ZXF-PN!P~u)Vzvfa|)1!(kGM1itS- zIR;+D1ptjk1Jg7yO%vC3TN?v+#pr{|Xqslr0kqrOTje+oQc9A^WNQJ2hlhVUKR?$z z&%oHCYqUiPRCC} P00000NkvXXu0mjf99rXL literal 0 HcmV?d00001 diff --git a/tree_tap.lua b/tree_tap.lua new file mode 100644 index 0000000..6c5a012 --- /dev/null +++ b/tree_tap.lua @@ -0,0 +1,49 @@ + minetest.register_tool("technic:treetap", { + description = "Tree Tap", + inventory_image = "technic_tree_tap.png", + on_use = function(itemstack,user,pointed_thing) + if pointed_thing.type~="node" then return end + if user:get_inventory():room_for_item("main",ItemStack("technic:raw_rubber")) then + local pos=minetest.get_pointed_thing_position(pointed_thing,above) + local node=minetest.env:get_node(pos) + local node_name=node.name + if node_name == "farming:rubber_tree_full" then + user:get_inventory():add_item("main",ItemStack("technic:raw_rubber")) + minetest.env:set_node(pos,node) + local item=itemstack:to_table() + local item_wear=tonumber((item["wear"])) + item_wear=item_wear+819 + if item_wear>65535 then itemstack:clear() return itemstack end + item["wear"]=tostring(item_wear) + itemstack:replace(item) + return itemstack + else + return itemstack + end + else return end + end, + }) + + minetest.register_craft({ + output = "technic:treetap", + recipe = { + {"pipeworks:tube", "default:wood", "default:stick"}, + {"", "default:stick", "default:stick"} + }, + }) + + minetest.register_craftitem("technic:raw_rubber", { + description = "Raw Rubber", + inventory_image = "technic_raw_rubber.png", + }) + + minetest.register_craft({ + type = "cooking", + output = "technic:rubber", + recipe = "technic:raw_rubber", + }) + + minetest.register_craftitem("technic:rubber", { + description = "Rubber Fiber", + inventory_image = "technic_rubber.png", + }) -- 2.30.2