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