-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcomponents.lua
256 lines (208 loc) · 7.37 KB
/
components.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
--[[
Default components for Thirsty.
These are nodes and items that "implement" the functionality
from functions.lua
See init.lua for license.
]]
--[[
Drinking containers (Tier 1)
Defines a simple wooden bowl which can be used on water to fill
your hydration.
Optionally also augments the nodes from vessels to enable drinking
on use.
]]
if minetest.get_modpath("vessels") and thirsty.config.register_vessels then
-- add "drinking" to vessels
thirsty.augment_item_for_drinking('vessels:drinking_glass', 22)
thirsty.augment_item_for_drinking('vessels:glass_bottle', 24)
thirsty.augment_item_for_drinking('vessels:steel_bottle', 26)
end
if minetest.get_modpath("default") and thirsty.config.register_bowl then
-- our own simple wooden bowl
minetest.register_craftitem('thirsty:wooden_bowl', {
description = "Wooden bowl",
inventory_image = "thirsty_bowl_16.png",
liquids_pointable = true,
on_use = thirsty.on_use(nil),
})
minetest.register_craft({
output = "thirsty:wooden_bowl",
recipe = {
{"group:wood", "", "group:wood"},
{"", "group:wood", ""}
}
})
end
--[[
Hydro containers (Tier 2)
Defines canteens (currently two types, with different capacities),
tools which store hydro. They use wear to show their content
level in their durability bar; they do not disappear when used up.
Wear corresponds to hydro level as follows:
- a wear of 0 shows no durability bar -> empty (initial state)
- a wear of 1 shows a full durability bar -> full
- a wear of 65535 shows an empty durability bar -> empty
]]
if minetest.get_modpath("default") and thirsty.config.register_canteens then
minetest.register_tool('thirsty:steel_canteen', {
description = 'Steel canteen',
inventory_image = "thirsty_steel_canteen_16.png",
liquids_pointable = true,
stack_max = 1,
on_use = thirsty.on_use(nil),
})
minetest.register_tool('thirsty:bronze_canteen', {
description = 'Bronze canteen',
inventory_image = "thirsty_bronze_canteen_16.png",
liquids_pointable = true,
stack_max = 1,
on_use = thirsty.on_use(nil),
})
minetest.register_craft({
output = "thirsty:steel_canteen",
recipe = {
{ "group:wood", ""},
{ "default:steel_ingot", "default:steel_ingot"},
{ "default:steel_ingot", "default:steel_ingot"}
}
})
minetest.register_craft({
output = "thirsty:bronze_canteen",
recipe = {
{ "group:wood", ""},
{ "default:bronze_ingot", "default:bronze_ingot"},
{ "default:bronze_ingot", "default:bronze_ingot"}
}
})
end
--[[
Tier 3
]]
if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_drinking_fountain then
minetest.register_node('thirsty:drinking_fountain', {
description = 'Drinking fountain',
drawtype = 'nodebox',
tiles = {
-- top, bottom, right, left, front, back
'thirsty_drinkfount_top.png',
'thirsty_drinkfount_bottom.png',
'thirsty_drinkfount_side.png',
'thirsty_drinkfount_side.png',
'thirsty_drinkfount_side.png',
'thirsty_drinkfount_side.png',
},
paramtype = 'light',
groups = { cracky = 2 },
node_box = {
type = "fixed",
fixed = {
{ -3/16, -8/16, -3/16, 3/16, 3/16, 3/16 },
{ -8/16, 3/16, -8/16, 8/16, 6/16, 8/16 },
{ -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 },
{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 },
{ -8/16, 6/16, -6/16, -6/16, 8/16, 6/16 },
{ 6/16, 6/16, -6/16, 8/16, 8/16, 6/16 },
},
},
selection_box = {
type = "regular",
},
collision_box = {
type = "regular",
},
on_rightclick = thirsty.on_rightclick(nil),
})
minetest.register_craft({
output = "thirsty:drinking_fountain",
recipe = {
{ "default:stone", "bucket:bucket_water", "default:stone"},
{ "", "default:stone", ""},
{ "", "default:stone", ""}
}
})
end
--[[
Tier 4+: the water fountains, plus extenders
]]
if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_fountains then
minetest.register_node('thirsty:water_fountain', {
description = 'Water fountain',
tiles = {
-- top, bottom, right, left, front, back
'thirsty_waterfountain_top.png',
'thirsty_waterfountain_top.png',
'thirsty_waterfountain_side.png',
'thirsty_waterfountain_side.png',
'thirsty_waterfountain_side.png',
'thirsty_waterfountain_side.png',
},
paramtype = 'light',
groups = { cracky = 2 },
})
minetest.register_node('thirsty:water_extender', {
description = 'Water fountain extender',
tiles = {
'thirsty_waterextender_top.png',
'thirsty_waterextender_top.png',
'thirsty_waterextender_side.png',
'thirsty_waterextender_side.png',
'thirsty_waterextender_side.png',
'thirsty_waterextender_side.png',
},
paramtype = 'light',
groups = { cracky = 2 },
})
minetest.register_craft({
output = "thirsty:water_fountain",
recipe = {
{ "default:copper_ingot", "bucket:bucket_water", "default:copper_ingot"},
{ "", "default:copper_ingot", ""},
{ "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}
}
})
minetest.register_craft({
output = "thirsty:water_extender",
recipe = {
{ "", "bucket:bucket_water", ""},
{ "", "default:copper_ingot", ""},
{ "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"}
}
})
minetest.register_abm({
nodenames = {'thirsty:water_fountain'},
interval = 2,
chance = 5,
action = thirsty.fountain_abm,
})
end
--[[
Tier 5
These amulets don't do much; the actual code is above, where
they are searched for in player's inventories
]]
if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_amulets then
minetest.register_craftitem('thirsty:injector', {
description = 'Water injector',
inventory_image = 'thirsty_injector.png',
})
minetest.register_craft({
output = "thirsty:injector",
recipe = {
{ "default:diamond", "default:mese_crystal", "default:diamond"},
{ "default:mese_crystal", "bucket:bucket_water", "default:mese_crystal"},
{ "default:diamond", "default:mese_crystal", "default:diamond"}
}
})
minetest.register_craftitem('thirsty:extractor', {
description = 'Water extractor',
inventory_image = 'thirsty_extractor.png',
})
minetest.register_craft({
output = "thirsty:extractor",
recipe = {
{ "default:mese_crystal", "default:diamond", "default:mese_crystal"},
{ "default:diamond", "bucket:bucket_water", "default:diamond"},
{ "default:mese_crystal", "default:diamond", "default:mese_crystal"}
}
})
end