commit | author | age
|
ee5c6c
|
1 |
local water_can_max_load = 16 |
K |
2 |
local lava_can_max_load = 8 |
82cba9
|
3 |
|
R |
4 |
minetest.register_craft({ |
|
5 |
output = 'technic:water_can 1', |
|
6 |
recipe = { |
|
7 |
{'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, |
|
8 |
{'default:steel_ingot', '', 'default:steel_ingot'}, |
|
9 |
{'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, |
|
10 |
} |
|
11 |
}) |
|
12 |
|
|
13 |
minetest.register_craft({ |
|
14 |
output = 'technic:lava_can 1', |
|
15 |
recipe = { |
|
16 |
{'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'}, |
|
17 |
{'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, |
|
18 |
{'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, |
|
19 |
} |
|
20 |
}) |
|
21 |
|
|
22 |
|
|
23 |
minetest.register_tool("technic:water_can", { |
|
24 |
description = "Water Can", |
|
25 |
inventory_image = "technic_water_can.png", |
|
26 |
stack_max = 1, |
|
27 |
liquids_pointable = true, |
|
28 |
on_use = function(itemstack, user, pointed_thing) |
|
29 |
|
|
30 |
if pointed_thing.type ~= "node" then |
|
31 |
return end |
|
32 |
n = minetest.env:get_node(pointed_thing.under) |
|
33 |
|
|
34 |
item=itemstack:to_table() |
|
35 |
local load=nil |
|
36 |
if item["metadata"]=="" then load=0 |
|
37 |
else load=tonumber(item["metadata"]) |
|
38 |
end |
|
39 |
|
|
40 |
if n.name == "default:water_source" then |
|
41 |
if load+1<17 then |
|
42 |
minetest.env:add_node(pointed_thing.under, {name="air"}) |
|
43 |
load=load+1; |
|
44 |
item["metadata"]=tostring(load) |
ee5c6c
|
45 |
technic.set_RE_wear(item,load,water_can_max_load) |
82cba9
|
46 |
itemstack:replace(item) |
R |
47 |
end |
|
48 |
return itemstack |
|
49 |
end |
|
50 |
item=itemstack:to_table() |
|
51 |
if load==0 then return end |
|
52 |
|
|
53 |
if n.name == "default:water_flowing" then |
|
54 |
minetest.env:add_node(pointed_thing.under, {name="default:water_source"}) |
|
55 |
load=load-1; |
|
56 |
item["metadata"]=tostring(load) |
ee5c6c
|
57 |
technic.set_RE_wear(item,load,water_can_max_load) |
82cba9
|
58 |
itemstack:replace(item) |
R |
59 |
return itemstack |
|
60 |
end |
|
61 |
|
|
62 |
n = minetest.env:get_node(pointed_thing.above) |
|
63 |
if n.name == "air" then |
|
64 |
minetest.env:add_node(pointed_thing.above, {name="default:water_source"}) |
|
65 |
load=load-1; |
|
66 |
item["metadata"]=tostring(load) |
ee5c6c
|
67 |
technic.set_RE_wear(item,load,water_can_max_load) |
82cba9
|
68 |
itemstack:replace(item) |
R |
69 |
return itemstack |
|
70 |
end |
|
71 |
end, |
|
72 |
}) |
|
73 |
|
|
74 |
minetest.register_tool("technic:lava_can", { |
|
75 |
description = "Lava Can", |
|
76 |
inventory_image = "technic_lava_can.png", |
|
77 |
stack_max = 1, |
|
78 |
liquids_pointable = true, |
|
79 |
on_use = function(itemstack, user, pointed_thing) |
e23f87
|
80 |
if pointed_thing.type ~= "node" then return end |
R |
81 |
n = minetest.env:get_node(pointed_thing.under) |
82cba9
|
82 |
item=itemstack:to_table() |
R |
83 |
local load=nil |
|
84 |
if item["metadata"]=="" then load=0 |
|
85 |
else load=tonumber(item["metadata"]) |
|
86 |
end |
|
87 |
|
e23f87
|
88 |
if n.name == "default:lava_source" then |
82cba9
|
89 |
if load+1<17 then |
R |
90 |
minetest.env:add_node(pointed_thing.under, {name="air"}) |
e23f87
|
91 |
load=load+1; |
82cba9
|
92 |
item["metadata"]=tostring(load) |
ee5c6c
|
93 |
technic.set_RE_wear(item,load,lava_can_max_load) |
82cba9
|
94 |
itemstack:replace(item) |
R |
95 |
end |
|
96 |
return itemstack |
|
97 |
end |
|
98 |
item=itemstack:to_table() |
|
99 |
if load==0 then return end |
|
100 |
|
|
101 |
if n.name == "default:lava_flowing" then |
|
102 |
minetest.env:add_node(pointed_thing.under, {name="default:lava_source"}) |
|
103 |
load=load-1; |
|
104 |
item["metadata"]=tostring(load) |
ee5c6c
|
105 |
technic.set_RE_wear(item,load,lava_can_max_load) |
82cba9
|
106 |
itemstack:replace(item) |
R |
107 |
return itemstack |
|
108 |
end |
|
109 |
|
|
110 |
n = minetest.env:get_node(pointed_thing.above) |
|
111 |
if n.name == "air" then |
|
112 |
minetest.env:add_node(pointed_thing.above, {name="default:lava_source"}) |
|
113 |
load=load-1; |
|
114 |
item["metadata"]=tostring(load) |
ee5c6c
|
115 |
technic.set_RE_wear(item,load,lava_can_max_load) |
82cba9
|
116 |
itemstack:replace(item) |
R |
117 |
return itemstack |
|
118 |
end |
|
119 |
end, |
|
120 |
}) |