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