commit | author | age
|
be2f30
|
1 |
|
S |
2 |
local S = technic.getter |
a0cf9e
|
3 |
local mesecons_materials = minetest.get_modpath("mesecons_materials") |
be2f30
|
4 |
|
ee0765
|
5 |
minetest.register_tool("technic:treetap", { |
be2f30
|
6 |
description = S("Tree Tap"), |
ee0765
|
7 |
inventory_image = "technic_tree_tap.png", |
bab851
|
8 |
on_use = function(itemstack, user, pointed_thing) |
ee0765
|
9 |
if pointed_thing.type ~= "node" then |
S |
10 |
return |
|
11 |
end |
bab851
|
12 |
local pos = pointed_thing.under |
S |
13 |
if minetest.is_protected(pos, user:get_player_name()) then |
|
14 |
minetest.record_protection_violation(pos, user:get_player_name()) |
|
15 |
return |
|
16 |
end |
|
17 |
local node = minetest.get_node(pos) |
|
18 |
local node_name = node.name |
|
19 |
if node_name ~= "moretrees:rubber_tree_trunk" then |
|
20 |
return |
|
21 |
end |
|
22 |
node.name = "moretrees:rubber_tree_trunk_empty" |
|
23 |
minetest.swap_node(pos, node) |
78646b
|
24 |
minetest.handle_node_drops(pointed_thing.above, {"technic:raw_latex"}, user) |
b8c902
|
25 |
if not technic.creative_mode then |
M |
26 |
local item_wear = tonumber(itemstack:get_wear()) |
|
27 |
item_wear = item_wear + 819 |
|
28 |
if item_wear > 65535 then |
|
29 |
itemstack:clear() |
|
30 |
return itemstack |
|
31 |
end |
|
32 |
itemstack:set_wear(item_wear) |
bab851
|
33 |
end |
S |
34 |
return itemstack |
ee0765
|
35 |
end, |
S |
36 |
}) |
bab851
|
37 |
|
ee0765
|
38 |
minetest.register_craft({ |
S |
39 |
output = "technic:treetap", |
|
40 |
recipe = { |
dc3248
|
41 |
{"pipeworks:tube_1", "group:wood", "default:stick"}, |
ee0765
|
42 |
{"", "default:stick", "default:stick"} |
S |
43 |
}, |
|
44 |
}) |
a0cf9e
|
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 |
}) |
a0cf9e
|
50 |
|
T |
51 |
if mesecons_materials then |
|
52 |
minetest.register_craft({ |
|
53 |
type = "cooking", |
|
54 |
recipe = "technic:raw_latex", |
|
55 |
output = "mesecons_materials:glue", |
|
56 |
}) |
|
57 |
end |
ee0765
|
58 |
|
S |
59 |
minetest.register_craftitem("technic:rubber", { |
be2f30
|
60 |
description = S("Rubber Fiber"), |
ee0765
|
61 |
inventory_image = "technic_rubber.png", |
S |
62 |
}) |
8e03d7
|
63 |
|
R |
64 |
minetest.register_abm({ |
|
65 |
nodenames = {"moretrees:rubber_tree_trunk_empty"}, |
|
66 |
interval = 60, |
|
67 |
chance = 15, |
|
68 |
action = function(pos, node) |
3b16a2
|
69 |
if minetest.find_node_near(pos, (moretrees and moretrees.leafdecay_radius) or 5, {"moretrees:rubber_tree_leaves"}) then |
Z |
70 |
node.name = "moretrees:rubber_tree_trunk" |
|
71 |
minetest.swap_node(pos, node) |
64db3d
|
72 |
end |
8e03d7
|
73 |
end |
R |
74 |
}) |
ee0765
|
75 |
|