ShadowNinja
2013-12-17 bab8517b2a07e41ea3b9122cb9d93d10bba3e430
commit | author | age
be2f30 1
S 2 local S = technic.getter
3
ee0765 4 minetest.register_tool("technic:treetap", {
be2f30 5     description = S("Tree Tap"),
ee0765 6     inventory_image = "technic_tree_tap.png",
bab851 7     on_use = function(itemstack, user, pointed_thing)
ee0765 8         if pointed_thing.type ~= "node" then
S 9             return
10         end
bab851 11         local inv = user:get_inventory()
S 12         if not inv:room_for_item("main", ItemStack("technic:raw_latex")) then
ee0765 13             return
S 14         end
bab851 15         local pos = pointed_thing.under
S 16         if minetest.is_protected(pos, user:get_player_name()) then
17             minetest.record_protection_violation(pos, user:get_player_name())
18             return
19         end
20         local node = minetest.get_node(pos)
21         local node_name = node.name
22         if node_name ~= "moretrees:rubber_tree_trunk" then
23             return
24         end
25         node.name = "moretrees:rubber_tree_trunk_empty"
26         inv:add_item("main", ItemStack("technic:raw_latex"))
27         minetest.swap_node(pos, node)
28         local item_wear = tonumber(itemstack:get_wear())
29         item_wear = item_wear + 819
30         if item_wear > 65535 then
31             itemstack:clear()
32             return itemstack
33         end
34         itemstack:set_wear(item_wear)
35         return itemstack
ee0765 36     end,
S 37 })
bab851 38
ee0765 39 minetest.register_craft({
S 40     output = "technic:treetap",
41     recipe = {
42         {"pipeworks:tube", "group:wood",    "default:stick"},
43         {"",               "default:stick", "default:stick"}
44     },
45 })
82cba9 46      
ee0765 47 minetest.register_craftitem("technic:raw_latex", {
be2f30 48     description = S("Raw Latex"),
ee0765 49     inventory_image = "technic_raw_latex.png",
S 50 })
82cba9 51      
ee0765 52 minetest.register_craft({
S 53     type = "cooking",
54     output = "technic:rubber",
55     recipe = "technic:raw_latex",
56 })
57
58 minetest.register_craftitem("technic:rubber", {
be2f30 59     description = S("Rubber Fiber"),
ee0765 60     inventory_image = "technic_rubber.png",
S 61 })
8e03d7 62
R 63 minetest.register_abm({
64     nodenames = {"moretrees:rubber_tree_trunk_empty"},
65     interval = 60,
66     chance = 15,
67     action = function(pos, node)
68         node.name = "moretrees:rubber_tree_trunk"
ee0765 69         minetest.set_node(pos, node)
8e03d7 70     end
R 71 })
ee0765 72