Remove dead code in mcl_brewing
[MineClone/MineClone2.git] / mods / ITEMS / mcl_brewing / init.lua
blob717e660e48a5787bd892c2380e213cda69226b61
1 local S = minetest.get_translator("mcl_brewing_stand")
3 local function active_brewing_formspec(fuel_percent, brew_percent)
5 return "size[9,8.75]"..
6 "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
7 "label[4,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Brewing Stand"))).."]"..
8 "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
9 "list[current_player;main;0,4.5;9,3;9]"..
10 mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
11 "list[current_player;main;0,7.75;9,1;]"..
12 mcl_formspec.get_itemslot_bg(0,7.75,9,1)..
13 "list[current_name;fuel;0.5,1.75;1,1;]"..
14 mcl_formspec.get_itemslot_bg(0.5,1.75,1,1).."image[0.5,1.75;1,1;mcl_brewing_fuel_bg.png]"..
15 "list[current_name;input;2.75,0.5;1,1;]"..
16 mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
17 "list[context;stand;4.5,2.5;1,1;]"..
18 mcl_formspec.get_itemslot_bg(4.5,2.5,1,1).."image[4.5,2.5;1,1;mcl_brewing_bottle_bg.png]"..
19 "list[context;stand;6,2.8;1,1;1]"..
20 mcl_formspec.get_itemslot_bg(6,2.8,1,1).."image[6,2.8;1,1;mcl_brewing_bottle_bg.png]"..
21 "list[context;stand;7.5,2.5;1,1;2]"..
22 mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]"..
24 "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[lowpart:"..
25 (100-fuel_percent)..":mcl_brewing_burner_active.png^[transformR270]"..
27 "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png^[lowpart:"..
28 (brew_percent)..":mcl_brewing_bubbles_active.png]"..
30 "listring[current_player;main]"..
31 "listring[current_name;fuel]"..
32 "listring[current_name;input]"..
33 "listring[context;stand]"
34 end
36 local brewing_formspec = "size[9,8.75]"..
37 "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
38 "label[4,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Brewing Stand"))).."]"..
39 "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
40 "list[current_player;main;0,4.5;9,3;9]"..
41 mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
42 "list[current_player;main;0,7.75;9,1;]"..
43 mcl_formspec.get_itemslot_bg(0,7.75,9,1)..
44 "list[current_name;fuel;0.5,1.75;1,1;]"..
45 mcl_formspec.get_itemslot_bg(0.5,1.75,1,1).."image[0.5,1.75;1,1;mcl_brewing_fuel_bg.png]"..
46 "list[current_name;input;2.75,0.5;1,1;]"..
47 mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
48 "list[context;stand;4.5,2.5;1,1;]"..
49 mcl_formspec.get_itemslot_bg(4.5,2.5,1,1).."image[4.5,2.5;1,1;mcl_brewing_bottle_bg.png]"..
50 "list[context;stand;6,2.8;1,1;1]"..
51 mcl_formspec.get_itemslot_bg(6,2.8,1,1).."image[6,2.8;1,1;mcl_brewing_bottle_bg.png]"..
52 "list[context;stand;7.5,2.5;1,1;2]"..
53 mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]"..
55 "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[transformR270]"..
56 "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png]"..
58 "listring[current_player;main]"..
59 "listring[current_name;fuel]"..
60 "listring[current_name;input]"..
61 "listring[context;stand]"
64 local function swap_node(pos, name)
65 local node = minetest.get_node(pos)
66 if node.name == name then
67 return
68 end
69 node.name = name
70 minetest.swap_node(pos, node)
71 end
74 local function brewable(inv)
76 local ingredient = inv:get_stack("input",1):get_name()
77 local stands = {}
78 local stand_size = inv:get_size("stand")
79 local was_alchemy = {false,false,false}
81 local bottle, alchemy
83 for i=1,stand_size do
85 bottle = inv:get_stack("stand", i):get_name()
86 alchemy = mcl_potions.get_alchemy(ingredient, bottle)
88 if alchemy then
89 stands[i] = alchemy
90 was_alchemy[i] = true
91 else
92 stands[i] = bottle
93 end
95 end
96 -- if any stand holds a new potion, return the list of new potions
97 for i=1,#was_alchemy do
98 if was_alchemy[i] then return stands end
99 end
101 return false
105 local function brewing_stand_timer(pos, elapsed)
106 -- Inizialize metadata
107 local meta = minetest.get_meta(pos)
109 local fuel_timer = meta:get_float("fuel_timer") or 0
110 local BREW_TIME = 20 -- all brews brew the same
111 local BURN_TIME = BREW_TIME * 10
113 local input_item = meta:get_string("input_item") or ""
114 local stand_timer = meta:get_float("stand_timer") or 0
115 local fuel = meta:get_float("fuel") or 0
116 local inv = meta:get_inventory()
118 local input_list, stand_list, fuel_list, brew_output, d
119 local input_count, fuel_name, fuel_count, formspec, fuel_percent, brew_percent
121 local update = true
123 while update do
125 update = false
127 input_list = inv:get_list("input")
128 stand_list = inv:get_list("stand")
129 fuel_list = inv:get_list("fuel")
131 -- TODO ... fix this. Goal is to reset the process if the stand changes
132 -- for i=1, inv:get_size("stand", i) do -- reset the process due to change
133 -- local _name = inv:get_stack("stand", i):get_name()
134 -- if _name ~= stand_items[i] then
135 -- stand_timer = 0
136 -- stand_items[i] = _name
137 -- update = true -- need to update the stand with new data
138 -- return 1
139 -- end
140 -- end
142 brew_output = brewable(inv)
143 if fuel ~= 0 and brew_output then
145 fuel_timer = fuel_timer + elapsed
146 stand_timer = stand_timer + elapsed
148 if fuel_timer >= BURN_TIME then --replace with more fuel
149 fuel = 0 --force a new fuel grab
150 fuel_timer = 0
153 d = 0.5
154 minetest.add_particlespawner({
155 amount = 4,
156 time = 1,
157 minpos = {x=pos.x-d, y=pos.y+0.5, z=pos.z-d},
158 maxpos = {x=pos.x+d, y=pos.y+2, z=pos.z+d},
159 minvel = {x=-0.1, y=0, z=-0.1},
160 maxvel = {x=0.1, y=0.5, z=0.1},
161 minacc = {x=-0.05, y=0, z=-0.05},
162 maxacc = {x=0.05, y=.1, z=0.05},
163 minexptime = 1,
164 maxexptime = 2,
165 minsize = 0.5,
166 maxsize = 2,
167 collisiondetection = true,
168 vertical = false,
169 texture = "mcl_brewing_bubble_sprite.png",
172 -- Replace the stand item with the brew result
173 if stand_timer >= BREW_TIME then
175 input_count = inv:get_stack("input",1):get_count()
176 if (input_count-1) ~= 0 then
177 inv:set_stack("input",1,inv:get_stack("input",1):get_name().." "..(input_count-1))
178 else
179 inv:set_stack("input",1,"")
182 for i=1, inv:get_size("stand") do
183 if brew_output[i] then
184 minetest.sound_play("mcl_brewing_complete", {pos=pos, gain=0.4, max_hear_range=6}, true)
185 inv:set_stack("stand", i, brew_output[i])
186 minetest.sound_play("mcl_potions_bottle_pour", {pos=pos, gain=0.6, max_hear_range=6}, true)
189 stand_timer = 0
190 update = false -- stop the update if brew is complete
193 elseif fuel == 0 then --get more fuel from fuel_list
195 -- only allow blaze powder fuel
196 fuel_name = inv:get_stack("fuel",1):get_name()
197 fuel_count = inv:get_stack("fuel",1):get_count()
199 if fuel_name == "mcl_mobitems:blaze_powder" then -- Grab another fuel
201 if (fuel_count-1) ~= 0 then
202 inv:set_stack("fuel",1,fuel_name.." "..(fuel_count-1))
203 else
204 inv:set_stack("fuel",1,"")
206 update = true
207 fuel = 1
208 else -- no fuel available
209 update = false
214 elapsed = 0
217 --update formspec
218 formspec = brewing_formspec
220 local result = false
222 if fuel_timer ~= 0 then
223 fuel_percent = math.floor(fuel_timer/BURN_TIME*100 % BURN_TIME)
224 brew_percent = math.floor(stand_timer/BREW_TIME*100)
225 formspec = active_brewing_formspec(fuel_percent, brew_percent*1 % 100)
226 result = true
227 else
228 minetest.get_node_timer(pos):stop()
231 meta:set_float("fuel_timer", fuel_timer)
232 meta:set_float("stand_timer", stand_timer)
233 meta:set_float("fuel", fuel)
234 -- meta:set_list("stand_items", stand_list)
235 meta:set_string("formspec", formspec)
237 return result
241 local function allow_metadata_inventory_put(pos, listname, index, stack, player)
242 local name = player:get_player_name()
243 if minetest.is_protected(pos, name) then
244 minetest.record_protection_violation(pos, name)
245 return 0
247 local meta = minetest.get_meta(pos)
248 local inv = meta:get_inventory()
249 if listname == "fuel" then
251 -- Test stack with size 1 because we burn one fuel at a time
252 local teststack = ItemStack(stack)
253 teststack:set_count(1)
254 local output, decremented_input = minetest.get_craft_result({method="fuel", width=1, items={teststack}})
255 if output.time ~= 0 then
256 -- Only allow to place 1 item if fuel get replaced by recipe.
257 -- This is the case for lava buckets.
258 local replace_item = decremented_input.items[1]
259 if replace_item:is_empty() then
260 -- For most fuels, just allow to place everything
261 return stack:get_count()
262 else
263 if inv:get_stack(listname, index):get_count() == 0 then
264 return 1
265 else
266 return 0
269 else
270 return 0
272 elseif listname == "input" then
273 return stack:get_count()
274 elseif listname == "stand" then
275 return 0
280 -- Drop input items of brewing_stand at pos with metadata meta
281 local function drop_brewing_stand_items(pos, meta)
283 local inv = meta:get_inventory()
285 local stack = inv:get_stack("fuel", 1)
286 if not stack:is_empty() then
287 local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
288 minetest.add_item(p, stack)
291 local stack = inv:get_stack("input", 1)
292 if not stack:is_empty() then
293 local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
294 minetest.add_item(p, stack)
297 for i=1, inv:get_size("stand") do
298 local stack = inv:get_stack("stand", i)
299 if not stack:is_empty() then
300 local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
301 minetest.add_item(p, stack)
307 local on_rotate
308 if minetest.get_modpath("screwdriver") then
309 on_rotate = screwdriver.rotate_simple
312 local doc_string =
313 S("To use an brewing_stand, rightclick it.").."\n"
314 S("To brew, place fuel first and/or your ingredient last!")
316 local tiles = {"mcl_brewing_top.png", --top
317 "mcl_brewing_base.png", --bottom
318 "mcl_brewing_side.png", --right
319 "mcl_brewing_side.png", --left
320 "mcl_brewing_side.png", --back
321 "mcl_brewing_side.png^[transformFX"} --front
323 local allow_put = function(pos, listname, index, stack, player)
324 local name = player:get_player_name()
325 if minetest.is_protected(pos, name) then
326 minetest.record_protection_violation(pos, name)
327 return 0
328 else
329 return stack:get_count()
333 local on_put = function(pos, listname, index, stack, player)
334 local meta = minetest.get_meta(pos)
335 local inv = meta:get_inventory()
336 local str = ""
337 local stack
338 for i=1, inv:get_size("stand") do
339 stack = inv:get_stack("stand", i)
340 if not stack:is_empty() then
341 str = str.."1"
342 else str = str.."0"
345 minetest.swap_node(pos, {name = "mcl_brewing:stand_"..str})
346 minetest.get_node_timer(pos):start(1.0)
347 --some code here to enforce only potions getting placed on stands
350 local after_dig = function(pos, oldnode, oldmetadata, digger)
351 local meta = minetest.get_meta(pos)
352 meta:from_table(oldmetadata)
353 drop_brewing_stand_items(pos, meta)
356 local on_destruct = function(pos)
357 local meta = minetest.get_meta(pos)
358 drop_brewing_stand_items(pos, meta)
361 local allow_take = function(pos, listname, index, stack, player)
362 local name = player:get_player_name()
363 if minetest.is_protected(pos, name) then
364 minetest.record_protection_violation(pos, name)
365 return 0
366 else
367 return stack:get_count()
372 minetest.register_node("mcl_brewing:stand_000", {
373 description = S("Brewing Stand"),
374 _doc_items_longdesc = S("The stand allows you to brew potions!"),
375 _doc_items_usagehelp = doc_string,
376 _tt_help = S("Brew Potions"),
377 groups = {pickaxey=1, falling_node=1, brewitem=1 },
378 tiles = tiles,
379 drop = "mcl_brewing:stand",
380 paramtype = "light",
381 sunlight_propagates = true,
382 is_ground_content = false,
383 paramtype2 = "facedir",
384 drawtype = "nodebox",
385 node_box = {
386 type = "fixed",
387 fixed = {
389 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
390 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
391 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
392 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
394 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
395 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
396 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
397 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
399 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
400 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
401 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
402 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
404 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
405 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
406 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
409 sounds = mcl_sounds.node_sound_glass_defaults(),
410 _mcl_blast_resistance = 1,
411 _mcl_hardness = 1,
412 on_destruct = on_destruct,
413 allow_metadata_inventory_take = allow_take,
414 allow_metadata_inventory_put = allow_put,
415 on_metadata_inventory_put = on_put,
416 on_metadata_inventory_take = on_put,
418 on_construct = function(pos)
419 local meta = minetest.get_meta(pos)
420 local inv = meta:get_inventory()
421 inv:set_size("input", 1)
422 inv:set_size("fuel", 1)
423 inv:set_size("stand", 3)
424 local form = brewing_formspec
425 meta:set_string("formspec", form)
426 end,
428 on_receive_fields = function(pos, formname, fields, sender)
429 local sender_name = sender:get_player_name()
430 if minetest.is_protected(pos, sender_name) then
431 minetest.record_protection_violation(pos, sender_name)
432 return
434 end,
436 on_timer = brewing_stand_timer,
437 on_rotate = on_rotate,
439 minetest.register_node("mcl_brewing:stand_100", {
440 description = S("Brewing Stand"),
441 _doc_items_create_entry = false,
442 _tt_help = S("Brew Potions"),
443 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
444 tiles = tiles,
445 drop = "mcl_brewing:stand",
446 paramtype = "light",
447 sunlight_propagates = true,
448 is_ground_content = false,
449 paramtype2 = "facedir",
450 drawtype = "nodebox",
451 node_box = {
452 type = "fixed",
453 fixed = {
455 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
456 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
457 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
458 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
460 {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
461 {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
462 {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
463 {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
464 {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
466 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
467 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
468 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
469 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
471 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
472 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
473 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
474 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
476 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
477 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
478 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
481 sounds = mcl_sounds.node_sound_metal_defaults(),
482 _mcl_blast_resistance = 1,
483 _mcl_hardness = 1,
484 on_destruct = on_destruct,
485 allow_metadata_inventory_take = allow_take,
486 allow_metadata_inventory_put = allow_put,
487 on_metadata_inventory_put = on_put,
488 on_metadata_inventory_take = on_put,
490 on_construct = function(pos)
491 local meta = minetest.get_meta(pos)
492 local inv = meta:get_inventory()
493 inv:set_size("input", 1)
494 inv:set_size("fuel", 1)
495 inv:set_size("stand", 3)
496 local form = brewing_formspec
497 meta:set_string("formspec", form)
498 end,
500 on_receive_fields = function(pos, formname, fields, sender)
501 local sender_name = sender:get_player_name()
502 if minetest.is_protected(pos, sender_name) then
503 minetest.record_protection_violation(pos, sender_name)
504 return
506 end,
508 on_timer = brewing_stand_timer,
509 on_rotate = on_rotate,
511 minetest.register_node("mcl_brewing:stand_010", {
512 description = S("Brewing Stand"),
513 _doc_items_create_entry = false,
514 _tt_help = S("Brew Potions"),
515 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
516 tiles = tiles,
517 drop = "mcl_brewing:stand",
518 paramtype = "light",
519 sunlight_propagates = true,
520 is_ground_content = false,
521 paramtype2 = "facedir",
522 drawtype = "nodebox",
523 node_box = {
524 type = "fixed",
525 fixed = {
527 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
528 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
529 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
530 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
532 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
533 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
534 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
535 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
538 {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
539 {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
540 {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
541 {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
542 {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
544 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
545 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
546 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
547 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
549 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
550 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
551 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
554 sounds = mcl_sounds.node_sound_metal_defaults(),
555 _mcl_blast_resistance = 1,
556 _mcl_hardness = 1,
557 on_destruct = on_destruct,
558 allow_metadata_inventory_take = allow_take,
559 allow_metadata_inventory_put = allow_put,
560 on_metadata_inventory_put = on_put,
561 on_metadata_inventory_take = on_put,
563 on_construct = function(pos)
564 local meta = minetest.get_meta(pos)
565 local inv = meta:get_inventory()
566 inv:set_size("input", 1)
567 inv:set_size("fuel", 1)
568 inv:set_size("stand", 3)
569 local form = brewing_formspec
570 meta:set_string("formspec", form)
571 end,
573 on_receive_fields = function(pos, formname, fields, sender)
574 local sender_name = sender:get_player_name()
575 if minetest.is_protected(pos, sender_name) then
576 minetest.record_protection_violation(pos, sender_name)
577 return
579 end,
581 on_timer = brewing_stand_timer,
582 on_rotate = on_rotate,
584 minetest.register_node("mcl_brewing:stand_001", {
585 description = S("Brewing Stand"),
586 _doc_items_create_entry = false,
587 _tt_help = S("Brew Potions"),
588 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
589 tiles = tiles,
590 drop = "mcl_brewing:stand",
591 paramtype = "light",
592 sunlight_propagates = true,
593 is_ground_content = false,
594 paramtype2 = "facedir",
595 drawtype = "nodebox",
596 node_box = {
597 type = "fixed",
598 fixed = {
600 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
601 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
602 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
603 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
605 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
606 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
607 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
608 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
610 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
611 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
612 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
613 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
615 {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
616 {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
618 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
619 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
620 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
623 sounds = mcl_sounds.node_sound_metal_defaults(),
624 _mcl_blast_resistance = 1,
625 _mcl_hardness = 1,
626 on_destruct = on_destruct,
627 allow_metadata_inventory_take = allow_take,
628 allow_metadata_inventory_put = allow_put,
629 on_metadata_inventory_put = on_put,
630 on_metadata_inventory_take = on_put,
632 on_construct = function(pos)
633 local meta = minetest.get_meta(pos)
634 local inv = meta:get_inventory()
635 inv:set_size("input", 1)
636 inv:set_size("fuel", 1)
637 inv:set_size("stand", 3)
638 local form = brewing_formspec
639 meta:set_string("formspec", form)
640 end,
642 on_receive_fields = function(pos, formname, fields, sender)
643 local sender_name = sender:get_player_name()
644 if minetest.is_protected(pos, sender_name) then
645 minetest.record_protection_violation(pos, sender_name)
646 return
648 end,
650 on_timer = brewing_stand_timer,
651 on_rotate = on_rotate,
653 minetest.register_node("mcl_brewing:stand_110", {
654 description = S("Brewing Stand"),
655 _doc_items_create_entry = false,
656 _tt_help = S("Brew Potions"),
657 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
658 tiles = tiles,
659 drop = "mcl_brewing:stand",
660 paramtype = "light",
661 sunlight_propagates = true,
662 is_ground_content = false,
663 paramtype2 = "facedir",
664 drawtype = "nodebox",
665 node_box = {
666 type = "fixed",
667 fixed = {
669 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
670 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
671 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
672 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
674 {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
675 {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
676 {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
677 {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
678 {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
680 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
681 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
682 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
683 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
686 {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
687 {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
688 {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
689 {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
690 {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
692 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
693 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
694 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
695 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
697 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
698 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
699 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
702 sounds = mcl_sounds.node_sound_metal_defaults(),
703 _mcl_blast_resistance = 1,
704 _mcl_hardness = 1,
705 on_destruct = on_destruct,
706 allow_metadata_inventory_take = allow_take,
707 allow_metadata_inventory_put = allow_put,
708 on_metadata_inventory_put = on_put,
709 on_metadata_inventory_take = on_put,
711 on_construct = function(pos)
712 local meta = minetest.get_meta(pos)
713 local inv = meta:get_inventory()
714 inv:set_size("input", 1)
715 inv:set_size("fuel", 1)
716 inv:set_size("stand", 3)
717 local form = brewing_formspec
718 meta:set_string("formspec", form)
719 end,
721 on_receive_fields = function(pos, formname, fields, sender)
722 local sender_name = sender:get_player_name()
723 if minetest.is_protected(pos, sender_name) then
724 minetest.record_protection_violation(pos, sender_name)
725 return
727 end,
729 on_timer = brewing_stand_timer,
730 on_rotate = on_rotate,
732 minetest.register_node("mcl_brewing:stand_101", {
733 description = S("Brewing Stand"),
734 _doc_items_create_entry = false,
735 _tt_help = S("Brew Potions"),
736 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
737 tiles = tiles,
738 drop = "mcl_brewing:stand",
739 paramtype = "light",
740 sunlight_propagates = true,
741 is_ground_content = false,
742 paramtype2 = "facedir",
743 drawtype = "nodebox",
744 node_box = {
745 type = "fixed",
746 fixed = {
748 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
749 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
750 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
751 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
753 {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
754 {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
755 {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
756 {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
757 {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
759 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
760 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
761 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
762 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
764 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
765 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
766 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
767 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
769 {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
770 {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
772 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
773 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
774 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
777 sounds = mcl_sounds.node_sound_metal_defaults(),
778 _mcl_blast_resistance = 1,
779 _mcl_hardness = 1,
780 on_destruct = on_destruct,
781 allow_metadata_inventory_take = allow_take,
782 allow_metadata_inventory_put = allow_put,
783 on_metadata_inventory_put = on_put,
784 on_metadata_inventory_take = on_put,
786 on_construct = function(pos)
787 local meta = minetest.get_meta(pos)
788 local inv = meta:get_inventory()
789 inv:set_size("input", 1)
790 inv:set_size("fuel", 1)
791 inv:set_size("stand", 3)
792 local form = brewing_formspec
793 meta:set_string("formspec", form)
794 end,
796 on_receive_fields = function(pos, formname, fields, sender)
797 local sender_name = sender:get_player_name()
798 if minetest.is_protected(pos, sender_name) then
799 minetest.record_protection_violation(pos, sender_name)
800 return
802 end,
804 on_timer = brewing_stand_timer,
805 on_rotate = on_rotate,
807 minetest.register_node("mcl_brewing:stand_011", {
808 description = S("Brewing Stand"),
809 _doc_items_create_entry = false,
810 _tt_help = S("Brew Potions"),
811 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
812 tiles = tiles,
813 drop = "mcl_brewing:stand",
814 paramtype = "light",
815 sunlight_propagates = true,
816 is_ground_content = false,
817 paramtype2 = "facedir",
818 drawtype = "nodebox",
819 node_box = {
820 type = "fixed",
821 fixed = {
823 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
824 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
825 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
826 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
828 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
829 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
830 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
831 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
833 {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
834 {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
835 {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
836 {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
837 {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
839 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
840 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
841 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
842 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
844 {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
845 {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
847 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
848 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
849 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
852 sounds = mcl_sounds.node_sound_metal_defaults(),
853 _mcl_blast_resistance = 1,
854 _mcl_hardness = 1,
855 on_destruct = on_destruct,
856 -- after_dig_node = after_dig,
857 allow_metadata_inventory_take = allow_take,
858 allow_metadata_inventory_put = allow_put,
859 on_metadata_inventory_put = on_put,
860 on_metadata_inventory_take = on_put,
862 on_construct = function(pos)
863 local meta = minetest.get_meta(pos)
864 local inv = meta:get_inventory()
865 inv:set_size("input", 1)
866 inv:set_size("fuel", 1)
867 inv:set_size("stand", 3)
868 local form = brewing_formspec
869 meta:set_string("formspec", form)
870 end,
872 on_receive_fields = function(pos, formname, fields, sender)
873 local sender_name = sender:get_player_name()
874 if minetest.is_protected(pos, sender_name) then
875 minetest.record_protection_violation(pos, sender_name)
876 return
878 end,
880 on_timer = brewing_stand_timer,
881 on_rotate = on_rotate,
883 minetest.register_node("mcl_brewing:stand_111", {
884 description = S("Brewing Stand"),
885 _doc_items_create_entry = false,
886 _tt_help = S("Brew Potions"),
887 groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
888 tiles = tiles,
889 drop = "mcl_brewing:stand",
890 paramtype = "light",
891 sunlight_propagates = true,
892 is_ground_content = false,
893 paramtype2 = "facedir",
894 drawtype = "nodebox",
895 node_box = {
896 type = "fixed",
897 fixed = {
899 {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume
900 { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base
901 {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
902 {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
904 {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
905 {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
906 {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
907 {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
908 {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
910 {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
911 {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
912 {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
913 {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
916 {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
917 {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
918 {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
919 {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
920 {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
922 {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
923 {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
924 {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
925 {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
927 {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
928 {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
930 {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
931 {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
932 {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
935 sounds = mcl_sounds.node_sound_metal_defaults(),
936 _mcl_blast_resistance = 1,
937 _mcl_hardness = 1,
938 on_destruct = on_destruct,
939 allow_metadata_inventory_take = allow_take,
940 allow_metadata_inventory_put = allow_put,
941 on_metadata_inventory_put = on_put,
942 on_metadata_inventory_take = on_put,
944 on_construct = function(pos)
945 local meta = minetest.get_meta(pos)
946 local inv = meta:get_inventory()
947 inv:set_size("input", 1)
948 inv:set_size("fuel", 1)
949 inv:set_size("stand", 3)
950 local form = brewing_formspec
951 meta:set_string("formspec", form)
952 end,
954 on_receive_fields = function(pos, formname, fields, sender)
955 local sender_name = sender:get_player_name()
956 if minetest.is_protected(pos, sender_name) then
957 minetest.record_protection_violation(pos, sender_name)
958 return
960 end,
962 on_timer = brewing_stand_timer,
963 on_rotate = on_rotate,
966 minetest.register_craft({
967 output = "mcl_brewing:stand",
968 recipe = {
969 { "", "mcl_mobitems:blaze_rod", "" },
970 { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
974 minetest.register_alias("mcl_brewing:stand", "mcl_brewing:stand_000")
976 if minetest.get_modpath("doc") then
977 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_001")
978 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_010")
979 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_011")
980 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_100")
981 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_101")
982 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_110")
983 doc.add_entry_alias("nodes", "mcl_brewing:stand_000", "nodes", "mcl_brewing:stand_111")