-
Notifications
You must be signed in to change notification settings - Fork 2
/
beverages.lua
325 lines (270 loc) · 7.5 KB
/
beverages.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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
--[[
register_beverage({
name = name of your drink,
recipe = "put fruit for drink"
recipe2 = "put fruit for drink" Default = recipe -optional
description = "description of your drink", Default = None -optional
liquidcolour = "colour of your liquids RGB code", Default = White -optional
wherein = "cup or glasses" Default = Cup -optional
cuptexture = "cup texture", Default = Brown -optional
heat = "hot or cold " Default = Hot -optional
})
--]]
--------------Internationalization-------
-----------------------------------------
local S if minetest.get_modpath("intllib")
then S = intllib.Getter()
else S = function(s) return s end end
-----------------------------------------
-----------------------------------------
-- Fruit definitions --------------------
-----------------------------------------
----- Checks for external content, and adds support
----- Code is taken from Food mod by Rubenwardy
function beverage.support(group, item)
if type(group) == "table" then
for i = 1, #group do
beverage.support(group[i], item)
end
return
end
if type(item) == "table" then
for i = 1, #item do
beverage.support(group, item[i])
end
return
end
local idx = string.find(item, ":")
if idx <= 1 then
error("[Beverage Error] beverage.support - error in item name ('" .. item .. "')")
end
local mod = string.sub(item, 1, idx - 1)
if not minetest.get_modpath(mod) then
if beverage.debug then
print("[Beverage Debug] Mod '"..mod.."' is not installed")
end
return
end
local data = minetest.registered_items[item]
if not data then
print("[Beverage Warning] Item '"..item.."' not found")
return
end
-- Add group
local g = {}
if data.groups then
for k, v in pairs(data.groups) do
g[k] = v
end
end
g["beverage_"..group] = 1
minetest.override_item(item, {groups = g})
end
beverage.support("apple", {
"default:apple",
"fruit:apple",
"ethereal:golden_apple",
"ironapple:apple_iron",
"beverage:applejuice"
})
beverage.support("chocolate", {
"farming_plus:cocoa_bean",
"farming:cocoa_beans",
"food:cocoa",
"food:chocolate_powder",
"mtfoods:chocolate",
"farming:chocolate_dark",
"foodblock:chocod_block",
"food:dark_chocolate",
"foodblock:chocod_block_slab",
"foodblock:chocom_block",
"food:milk_chocolate",
"plants:cacao_wild",
"beverage:hotchocolate"
})
beverage.support("orange", {
"farming_plus:orange_item",
"farming_plus:orange",
"food:orange",
"fruit:orange",
"foodblock:orangeblock",
"foodblock:orangeblock_slab",
"beverage:orangejuice"
})
beverage.support("milk", {
"jkanimals:beverage_milk",
"animalmaterials:milk",
"kpgmobs:beverage_milk",
"my_mobs:milk_glass_cup",
"mobs:beverage_milk",
"food:milk",
"foodblock:milkblock",
"beverage:milk"
})
beverage.support("flower", {
"farming:wheat",
"flowers:flower_rose",
"flowers:flower_dandelion_white",
"flowers:flower_viola",
"flowers:flower_tulip",
"plants:aloe_wild",
"plants:lavender_wild",
"plants:grass_wild",
"beverage:greentea"
})
beverage.support("lemon", {
"food_sweet:lemon",
"farming_plus:lemon_item",
"beverage:lemonade"
})
beverage.support("coffee", {
"farming:coffee_beans",
"farming_plus:coffee_beans",
"beverage:coffee"
})
beverage.support("coconut", {
"foodblock:cocoblock",
"foodblock:cocoblock_slab",
"farming:cucumber",
"moretrees:coconut_milk",
"moretrees:raw_coconut",
"docfarming:cucumber",
"mtfoods:dandelion_milk",
"ethereal:coconut_slice",
"beverage:coconutmilk"
})
beverage.support("berry", {
"farming_plus:strawberry_item",
"plantlib:strawberry",
"farming_plus:rhubarb_item",
"bushes:strawberry",
"beverage:berryjuice"
})
beverage.support("water", {
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"default:river_water_source",
"default:river_water_flowing",
"bucket:bucket_river_water",
"beverage:drinkingwater"
})
------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------- Register drinks -----------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------
--Coffee
register_beverage({
name = "coffee",
description = S("Coffee"),
liquidcolour = "#8B4513:190",
heat = "hot",
wherein = "cup",
cuptexture = "cup.png^[colorize:#CD5C5C:90",
recipe = "coffee"
})
--Milk
register_beverage({
name = "milk",
description = S("Milk"),
liquidcolour = "#F8F8FF:190",
heat = "hot",
wherein = "cup",
cuptexture = "cup.png^[colorize:#7171C6:90",
recipe = "milk"
})
-- Hot Chocolate
register_beverage({
name = "hotchocolate",
description = S("Hot Chocolate"),
liquidcolour = "#8B5A00:190",
heat = "hot",
wherein = "cup",
recipe = "chocolate"
})
-- Tea
register_beverage({
name = "tea",
description = S("Tea"),
liquidcolour = "#CD3700:190",
heat = "hot",
wherein = "cup",
cuptexture = "cup.png^[colorize:#CDB7B5:90",
recipe = "tea"
})
-- Green Tea
register_beverage({
name = "greentea",
description = S("Green Tea"),
liquidcolour = "#9ACD32:190",
heat = "hot",
wherein = "cup",
cuptexture = "cup.png^[colorize:#CD5C5C:90",
recipe = "flower"
})
-- Orange Juice
register_beverage({
name = "orangejuice",
description = S("Orange Juice"),
liquidcolour = "#FFA500:110",
heat = "cold",
wherein = "glasses",
cuptexture = "liquid_cold_bottom.png",
recipe = "orange"
})
-- Apple Juice
register_beverage({
name = "applejuice",
description = S("Apple Juice"),
liquidcolour = "#EED5B7:110",
heat = "cold",
wherein = "glasses",
cuptexture = "liquid_cold_bottom.png",
recipe = "apple"
})
-- Berry Juice
register_beverage({
name = "berryjuice",
description = S("Berry Juice"),
liquidcolour = "#EE4000:110",
heat = "cold",
wherein = "glasses",
recipe = "berry"
})
-- Lemonade
register_beverage({
name = "lemonade",
description = S("Lemonade"),
liquidcolour = "#FFF68F:110",
heat = "cold",
wherein = "glasses",
recipe = "lemon"
})
-- Coconut Milk
register_beverage({
name = "coconutmilk",
description = S("Coconut Milk"),
liquidcolour = "#E0E0E0:110",
heat = "cold",
wherein = "glasses",
recipe = "coconut"
})
-- Cold Water
register_beverage({
name = "drinkingwater",
description = S("Drinking Water"),
liquidcolour = "#518EF7:110",
heat = "cold",
wherein = "glasses",
recipe = "water"
})
-- Hot Water
register_beverage({
name = "hotwater",
description = S("Hot Water"),
liquidcolour = "#518EF7:110",
heat = "hot",
wherein = "cup",
recipe = "water"
})