From 971e666d3ed69096c0cfca7178be58094dd86340 Mon Sep 17 00:00:00 2001 From: bzoss Date: Sat, 16 May 2020 18:22:09 -0400 Subject: [PATCH 01/14] Initial commit to brewing formspec. --- mods/ITEMS/mcl_brewing/depends.txt | 7 + mods/ITEMS/mcl_brewing/init.lua | 235 ++++++++++++++++++ mods/ITEMS/mcl_brewing/locale/template.txt | 16 ++ mods/ITEMS/mcl_brewing/mod.conf | 1 + .../mcl_brewing/textures/mcl_brewing_base.png | Bin 0 -> 125 bytes .../textures/mcl_brewing_bottle_bg.png | Bin 0 -> 1165 bytes .../textures/mcl_brewing_fuel_bg.png | Bin 0 -> 250 bytes .../textures/mcl_brewing_inventory.png | Bin 0 -> 1491 bytes .../textures/mcl_brewing_potion_bg.png | Bin 0 -> 1172 bytes .../mcl_brewing/textures/mcl_brewing_side.png | Bin 0 -> 1353 bytes .../mcl_brewing/textures/mcl_brewing_top.png | Bin 0 -> 1606 bytes 11 files changed, 259 insertions(+) create mode 100755 mods/ITEMS/mcl_brewing/depends.txt create mode 100755 mods/ITEMS/mcl_brewing/init.lua create mode 100755 mods/ITEMS/mcl_brewing/locale/template.txt create mode 100755 mods/ITEMS/mcl_brewing/mod.conf create mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_bottle_bg.png create mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_fuel_bg.png create mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_potion_bg.png create mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png create mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png diff --git a/mods/ITEMS/mcl_brewing/depends.txt b/mods/ITEMS/mcl_brewing/depends.txt new file mode 100755 index 00000000..4c84c729 --- /dev/null +++ b/mods/ITEMS/mcl_brewing/depends.txt @@ -0,0 +1,7 @@ +mcl_init +mcl_formspec +mcl_sounds +mcl_potions +mcl_mobitems? +mcl_core? +screwdriver? diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua new file mode 100755 index 00000000..6342364f --- /dev/null +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -0,0 +1,235 @@ +local S = minetest.get_translator("mcl_brewing") + +local MAX_NAME_LENGTH = 30 +local MAX_WEAR = 65535 +local SAME_TOOL_REPAIR_BOOST = math.ceil(MAX_WEAR * 0.12) -- 12% +local MATERIAL_TOOL_REPAIR_BOOST = { + math.ceil(MAX_WEAR * 0.25), -- 25% + math.ceil(MAX_WEAR * 0.5), -- 50% + math.ceil(MAX_WEAR * 0.75), -- 75% + MAX_WEAR, -- 100% +} +local NAME_COLOR = "#FFFF4C" + +local function get_brewing_stand_formspec() + + return "size[9,8.75]".. + "background[-0.19,-0.25;9.41,9.49;mcl_brewing_inventory.png]".. + "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.75;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.75,9,1).. + "list[current_name;fuel;0.5,1.75;1,1;]".. + mcl_formspec.get_itemslot_bg(0.5,1.75,1,1).."image[0.5,1.75;1,1;mcl_brewing_fuel_bg.png]".. + "list[current_name;input;2.75,0.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.75,0.5,1,1).. + "list[context;stand;4.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(4.5,2.5,1,1).."image[4.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. + "list[context;stand;6,2.8;1,1;1]".. + mcl_formspec.get_itemslot_bg(6,2.8,1,1).."image[6,2.8;1,1;mcl_brewing_bottle_bg.png]".. + "list[context;stand;7.5,2.5;1,1;2]".. + mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. + + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_name;input]".. + -- "listring[context;stand1]".. + -- "listring[context;stand2]".. + "listring[context;stand]" +end + + +-- Given a tool and material stack, returns how many items of the material stack +-- needs to be used up to repair the tool. +local function get_consumed_materials(tool, material) + local wear = tool:get_wear() + if wear == 0 then + return 0 + end + local health = (MAX_WEAR - wear) + local matsize = material:get_count() + local materials_used = 0 + for m=1, math.min(4, matsize) do + materials_used = materials_used + 1 + if (wear - MATERIAL_TOOL_REPAIR_BOOST[m]) <= 0 then + break + end + end + return materials_used +end + +-- Given 2 input stacks, tells you which is the tool and which is the material. +-- Returns ("tool", input1, input2) if input1 is tool and input2 is material. +-- Returns ("material", input2, input1) if input1 is material and input2 is tool. +-- Returns nil otherwise. +local function distinguish_tool_and_material(input1, input2) + local def1 = input1:get_definition() + local def2 = input2:get_definition() + if def1.type == "tool" and def1._repair_material then + return "tool", input1, input2 + elseif def2.type == "tool" and def2._repair_material then + return "material", input2, input1 + else + return nil + end +end + + + +-- Drop input items of brewing_stand at pos with metadata meta +local function drop_brewing_stand_items(pos, meta) + + local inv = meta:get_inventory() + + local stack = inv:get_stack("fuel", 1) + if not stack:is_empty() then + 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} + minetest.add_item(p, stack) + end + + local stack = inv:get_stack("input", 1) + if not stack:is_empty() then + 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} + minetest.add_item(p, stack) + end + + for i=1, inv:get_size("stand") do + local stack = inv:get_stack("stand", i) + if not stack:is_empty() then + 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} + minetest.add_item(p, stack) + end + end +end + + + + +local brewing_standdef = { + groups = {pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, + tiles = {"mcl_brewing_top.png^[transformR90", "mcl_brewing_base.png", "mcl_brewing_side.png"}, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-8/16, 2/16, -5/16, 8/16, 8/16, 5/16}, -- top + {-5/16, -4/16, -2/16, 5/16, 5/16, 2/16}, -- middle + {-8/16, -8/16, -5/16, 8/16, -4/16, 5/16}, -- base + } + }, + sounds = mcl_sounds.node_sound_metal_defaults(), + _mcl_blast_resistance = 1200, + _mcl_hardness = 5, + _mcl_after_falling = damage_brewing_stand_by_falling, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local meta = minetest.get_meta(pos) + local meta2 = meta + meta:from_table(oldmetadata) + drop_brewing_stand_items(pos, meta) + meta:from_table(meta2:to_table()) + end, + + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + else + return stack:get_count() + end + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return 0 + else + return stack:get_count() + end + end, + -- allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + -- local name = player:get_player_name() + -- if minetest.is_protected(pos, name) then + -- minetest.record_protection_violation(pos, name) + -- return 0 + -- end + -- end, + + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + minetest.get_node_timer(pos):start(1.0) + --some code here to enforce only potions getting placed on stands + end, + + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + end, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size("input", 1) + inv:set_size("fuel", 1) + inv:set_size("stand", 3) + -- inv:set_size("stand2", 1) + -- inv:set_size("stand3", 1) + local form = get_brewing_stand_formspec() + meta:set_string("formspec", form) + end, + + on_receive_fields = function(pos, formname, fields, sender) + local sender_name = sender:get_player_name() + if minetest.is_protected(pos, sender_name) then + minetest.record_protection_violation(pos, sender_name) + return + end + + end, +} +if minetest.get_modpath("screwdriver") then + brewing_standdef.on_rotate = screwdriver.rotate_simple +end + +brewing_standdef.description = S("Brewing Stand") +brewing_standdef._doc_items_longdesc = S("The stand allows you to brew potions!") +brewing_standdef._doc_items_usagehelp = +S("To use an brewing_stand, rightclick it. An brewing_stand has 2 input slots (on the left) and one output slot.").."\n".. +S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n".. +S("There are two possibilities to repair tools (and armor):").."\n".. +S("• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.").."\n".. +S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n".. +S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n".. +S("The brewing_stand has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the brewing_stand gets damaged. brewing_stand also have a chance of being damaged when they fall by more than 1 block. If a very damaged brewing_stand is damaged again, it is destroyed.") +brewing_standdef._tt_help = S("Repair and rename items") + +minetest.register_node("mcl_brewing:stand", brewing_standdef) + +if minetest.get_modpath("mcl_core") then + minetest.register_craft({ + output = "mcl_brewing:stand", + recipe = { + { "", "mcl_mobitems:blaze_rod", "" }, + { "mcl_core:stone_smooth", "mcl_core:stone_smooth", "mcl_core:stone_smooth" }, + } + }) +end + + +-- Legacy +minetest.register_lbm({ + label = "Update brewing_stand formspecs (0.60.0", + name = "mcl_brewing:update_formspec_0_60_0", + --nodenames = { "group:brewing_stand" }, + run_at_every_load = false, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_brewing_stand_formspec()) + end, +}) diff --git a/mods/ITEMS/mcl_brewing/locale/template.txt b/mods/ITEMS/mcl_brewing/locale/template.txt new file mode 100755 index 00000000..ebc741c0 --- /dev/null +++ b/mods/ITEMS/mcl_brewing/locale/template.txt @@ -0,0 +1,16 @@ +# textdomain: mcl_anvils +Set Name= +Repair and Name= +Inventory= +Anvil= +The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!= +To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.= +To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.= +There are two possibilities to repair tools (and armor):= +• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.= +• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.= +Armor counts as a tool. It is possible to repair and rename a tool in a single step.= +The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.= +Slightly Damaged Anvil= +Very Damaged Anvil= +Repair and rename items= diff --git a/mods/ITEMS/mcl_brewing/mod.conf b/mods/ITEMS/mcl_brewing/mod.conf new file mode 100755 index 00000000..de164abf --- /dev/null +++ b/mods/ITEMS/mcl_brewing/mod.conf @@ -0,0 +1 @@ +name = mcl_brewing diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png new file mode 100755 index 0000000000000000000000000000000000000000..7e6440a57ebf4f5d2b279eae59b62ec06d329cec GIT binary patch literal 125 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|uFA^FIyyS0rlvo&)Qy0G z`kpS1Ar*|t4os23k`fY|!>kN8w6(DrY-nxsV-Vz)*df3YlEW0i>0;>o!b`=N!J?lp UfiGfC6HqIIr>mdKI;Vst004d*G5`Po literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bottle_bg.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bottle_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..c0c4fd2be15e5849c00ebadbe188f162e56cb4a9 GIT binary patch literal 1165 zcmds#ziO0G5XDbS2qv;oyI>H(Mp0}We1OOiX#br)c_vz(kVU}jqZK>SN!#vHaDcB6R2#d6+hT?3xWmu+V!N^rBw+gGYqAS#h z0SzTs?9mu)q|xGXwV|$A;hyf*{%A`T;gKHIcA;Q1!!tb#_ds#hE4reil^I#&id`t!jLIl-BxwSGi{k{1TcRWn zFu6?}Fku*nP$LF3H^G8~#%Lp5J)%C%HZ`l57(wEXwp3Zw103UTiZRii=NM8$jof>@ zBg$qR>GZUR;YJ=FdiVpY9gI#$^Eogj!o$;OHNM1u{(Ai4*@_Kc1vG(!!?Tybq*>D>&UBdiaeD`A?mNHFD0%aZU1{6X3YWnFR%m$K$w?D+S)in;lg VYTi|UCT)-#JYD@<);T3K0RY}WNXGyG literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png new file mode 100755 index 0000000000000000000000000000000000000000..c62c33b9d29263539c816c0156928d01341a8027 GIT binary patch literal 1491 zcmd6n`#aMM9LK+ggM`vUmPtGQsg|EFzoGGov20K#12rLVBLM4>3@l)_;+)JIE2vs zko*?`pIMPH4n^sg?sOn}1jB5C?Y@Q=I8FN-6OIN*Azl~`B$*a&72{5`_4oukN-p)5 zKAq`hhu3x`%acAyhaPoLzxG_*9LX*ej)M2Qk2I{EVn7ugky2~FzUD8^!cl;6)&!zM z9=7%69gs=pu=|7;%sHcgwF4Y|66v5dFcd<=#k%KPcP}8_`EOj7wK3q&_56GmE7wr{ zABo?j___@fZC1>rbc?-jh8akjr4H+7a3W~+fDHg4a^MO(8k)WZQ#=i zlPu-1@2pup@CpFWr@Blc7U$@nyOck_?7&keo0MVVUDtX@nK*l446^@RTL5mU_3`J6 zV$<%Cpf|Em@h*w%mP98YPLW7x#8~Um7%YR^)Lh&MuL=7Dp-7rTuL!*nuuG7FT!5o9-D&yu&Cv*glxli|-3|i!s6rGkk z7s_NzfhEJJy`y)U*3CP$-jIvj2$K{o8V_cWi1?N66H)JL_%za9er%$Y+o)(`SA?281J9KS$1MO{fBxqlht)N0@@O5xgzd_V|rnpZvP;Nd;M4po#@ZY zcKO}%j@{7Aon`_4J<2Vtx~Jss*y7-LpU!?Ic?wF%ZggC;ofk2v?Dil>vLDba9tu literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_potion_bg.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_potion_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..818e41d4b8bf2c2adb942112951b8a7232753acc GIT binary patch literal 1172 zcmds#v1(OO5Jh)P2qv1CG8k+GK@e@`2UOm}1VRW&EYcaoDXaooiHMrY&L+kDfkhCT zKuQY>g(>m}qJLo_!a-xSkw&XJx!$H`Wkhw5_@gaVW@M2ocA;Q1Dx=7eqzM2njuSL) ziIP0P;Sa2KFghX4=fIQ*4^N}j_!9s5>&c6k*Q6Oe-`Uy)e)#Jx!Z{}AI7f$w%u78@p{QlwRUuSdY or<5xPcYhvDKiqhIaOu_e3p)S(^~dSv+)20Im~Krz-hcG=50BzPYXATM literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png new file mode 100755 index 0000000000000000000000000000000000000000..4203949c6f94bd44a6281a343e3d2e8399ebc77c GIT binary patch literal 1353 zcmV-P1-AN$P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvcI+q&{nsjb2?!yE?qy%Nlm%G(?}gH@IAK$z}|q*{{84C0EH8sHJX;KwUR;L6?s8u5l-9iLZkDrd3Dd->e0_HT zU{r-rEZHV322Ve{$bM(sis$%(m>?Tt#?!*sQ|#y*Ucfs?7wk-4a=C|sj9&`=g3*$* zKF4k%bYboAeD|Tm)5QaJz1P@#+gF#J2U4EaqK>7^5fnE-DRY`f3%C{IFk3>4SYiR_ z6>M&3g*dSVrkx#E&fK}pzHmW^&Nds+TU)G5S(IRtEix!@qj9%El2noiCJI;+i0v5* zPrqsUD;(juGBhp2*kJLY(KF$1+G(iwk-E$#o>(C+I}#9K4CclYS|Eh`!c-@|v(Zi7 zm>XgR4C;hAVu9IgyNONtE4O6wEYMTq$n5FPp)Lb}2)-4;AeS8*&!X(v1Zx8`aE#z5 zBXTRwZeV~_ZDs1OE_GVeUO^yjUBIxv3YvSc5o(!vv3VqJuLqW*vj^Fc?5W+rgQM z?3^9U4bDum*c58P8tWjZ@?Z=My2e&JpWJ;h_m($O_aolyE9PiW_cxfMLEU2Rk+&zT z)jUrWnFNhpI50KRQP{eaY$N_qkDvE;tL$`~9eUpb)S&>|mX5(UeePqXj-%+lSHF8B zxVyUPnr8%x#iZ&(+0vYa1!L>7=4Z}mc&k@0>9RIyd0+kp&?J|RY?xMhHKsW;4Gj#+ zD-2HW)gCs*FVQBq{^@3!k04(ius^JndeNbWC?2B9@&aeRM#P^ezUf0n{?kqe8urNh z(BAj-+leDhY+7l89~M;NZ&&2wEfq9Or}{%1Pk5&HyX^D+Lqji9_5_U16#H)5ZZEM4 z2S&f9?KTM7i$whnP4U+~U)r4t{T$d6FVq`8>kZ9Ya(p{8hkl!mXU#&b zlD!_SV)crxo`Ss;vHNL+> z7)~t>0Iaq61M2;{;RwDA0z?=>5a*h&E3kF0NlGe_!RDqsdTTbVMNx?CN$el@bIQi= zwa3u4iw$)%u6v|QLdIIXbZN_+J(pMpUo4$+_@x)o^cnXt^d*29Xg6Gf715lM00000 LNkvXXu0mjf(hGRv literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png new file mode 100755 index 0000000000000000000000000000000000000000..9c6e9bad58c438096d3e1f192f1c7ee0921a9222 GIT binary patch literal 1606 zcmV-M2D$l(P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1Y?mh319{m&|92_ho896!&Q9nA6v6Ju3UNq4t2L%omCMKobyrGD8F)9S`xZoE}X3Bf)wy~KqTy3q;o^&wP-02dR;rr*)mMQUYOJYY(@<)zaq~@DXtAZP zvDT@(&fRzEp~s#UYm?P8Yj|PqXV!4CHW+i8p1fF7vB+TpM>*lanKEV_D&sO3(15ms zGZWA`JD3}snP@dB*eYwtgPe+kF=fy-wA^uV_hRlx-hka7@n)ZxgF)T@!5j?gCUc*> z-LO{EcB9Zn(8$7psiCfgt=pVz&_Aum=iZizj!G|Q1tM^v0J}6!98j5FTvHRsHC3#{+#j4|5#7T z@LKiM`?l7~qiYeCZ^Jcuu=VMgxWlN&4M)%nnSlP*W6tNbD(V``yC)EPtX@hwT-D3V zqNx`fbPW8#z>0_IwO-lsrAIfOab2DPPLQT&GvKCY?$|e`!+|S|2ktO|59`!6zT^KJ zrHfiv+y-8IaD3zTw=Fns5eyo_E$#V|HAN|v9%nxEYD{ylgyVDp`n`v{iCT{|(K<2n z*FProZXa}A@K;Eeq{?BEesV{9_`w}>UHd^9AAVYdr`+e?>c*vqySh=r6EX`SyiUM% z3CS{Nzj9^va9Z2s0m>U5F2N4((YXri3eK+syTK6+r9I^+eb$UEG4Wa32;bRa{vGf6951U z69E94oEQKA00(qQO+^Rf1qu)h2gs}C{{R31JV``BR5;6hlRb*VFc5{mghfaYFoCqG z+@{JE>@w+g&$oLA`vl1q(yH7dl`#yAm}a-K@L%#82{Z5c&CJv0bUHC0gz)FRXSdq{ zAR?rc@ZOVB;&3=1B6MB188}-;7z%&B3u26PT}R*dJfBZgl^7#)Oaz8M132d}vjt&X z1Mo2~P}K#=IY$VA5CS6dULb^!PczG8fVL?CsOoOLg|UOSDRIu_?`>03)ekP$_}+n; zQPq#^LRIPeo~nLeX6*O-Nt@fXe#fnhh1W0<5RqJ{s;KIO=$u<@VRemWwjdTov2e9I zgE{WEbG~1$@%w zDHmZWiXw}olwJz}e183AH^<`*jo?zc1d+j-&O9}zE{4FdC+jQ{`u07*qoM6N<$ Ef(vI7VE_OC literal 0 HcmV?d00001 From 572b43e93c1eed891e2f20f6ea01327b1f0e4ecd Mon Sep 17 00:00:00 2001 From: bzoss Date: Sat, 16 May 2020 19:15:34 -0400 Subject: [PATCH 02/14] Updated brewing stand node -- needs work. --- mods/ITEMS/mcl_brewing/init.lua | 10 +++++---- mods/ITEMS/mcl_brewing/locale/template.txt | 19 +++--------------- .../mcl_brewing/textures/mcl_brewing_base.png | Bin 125 -> 191 bytes .../textures/mcl_brewing_inventory.png | Bin 1491 -> 1190 bytes .../textures/mcl_brewing_plume.png | Bin 0 -> 1249 bytes .../mcl_brewing/textures/mcl_brewing_side.png | Bin 1353 -> 0 bytes .../mcl_brewing/textures/mcl_brewing_top.png | Bin 1606 -> 0 bytes 7 files changed, 9 insertions(+), 20 deletions(-) mode change 100755 => 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png delete mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png delete mode 100755 mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 6342364f..dd7ba14e 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -108,7 +108,7 @@ end local brewing_standdef = { groups = {pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, - tiles = {"mcl_brewing_top.png^[transformR90", "mcl_brewing_base.png", "mcl_brewing_side.png"}, + tiles = {"mcl_brewing_base.png", "mcl_brewing_plume.png"}, paramtype = "light", sunlight_propagates = true, is_ground_content = false, @@ -117,9 +117,11 @@ local brewing_standdef = { node_box = { type = "fixed", fixed = { - {-8/16, 2/16, -5/16, 8/16, 8/16, 5/16}, -- top - {-5/16, -4/16, -2/16, 5/16, 5/16, 2/16}, -- middle - {-8/16, -8/16, -5/16, 8/16, -4/16, 5/16}, -- base + --TODO: add bottle hangers + {-1/16, -6/16, -1/16, 1/16, 12/16, 1/16}, -- heat plume + { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base + {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base + {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base } }, sounds = mcl_sounds.node_sound_metal_defaults(), diff --git a/mods/ITEMS/mcl_brewing/locale/template.txt b/mods/ITEMS/mcl_brewing/locale/template.txt index ebc741c0..56cf672a 100755 --- a/mods/ITEMS/mcl_brewing/locale/template.txt +++ b/mods/ITEMS/mcl_brewing/locale/template.txt @@ -1,16 +1,3 @@ -# textdomain: mcl_anvils -Set Name= -Repair and Name= -Inventory= -Anvil= -The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!= -To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.= -To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.= -There are two possibilities to repair tools (and armor):= -• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.= -• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.= -Armor counts as a tool. It is possible to repair and rename a tool in a single step.= -The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.= -Slightly Damaged Anvil= -Very Damaged Anvil= -Repair and rename items= +# textdomain: mcl_brewing +Brewing Stand= +The brewing stand allows the creating of potions for the benefit of various effects. Stay tuned for developments, as you can only view the stand and interact with it, but not create potions. diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_base.png old mode 100755 new mode 100644 index 7e6440a57ebf4f5d2b279eae59b62ec06d329cec..8831ffb9b5217e3aceb2526ed2734a9dd91edd08 GIT binary patch delta 174 zcmV;f08#&azX6aKe*^;n008aX;!*$r01{A4R7HMtafg6>rI(PCiGy%#W@}+#yjw1V z0001JNklyY;yf@ItjDor7zQ!P2`rMCSKm7mCD50a9J9j`yU8wF!m-20G c4m+yj3*K`MW5R3Zy#N3J07*qoM6N<$f{fltNdN!< delta 107 zcmdnbSUW)?m5G^wfgx$G_$MI68Q>G*s;sQ6qoZSLYWh=4-3TbC@9E+gQo)$)z!VuQ zDIu{r%*tRxTN|6fhSoMe20?C#9Re&NIZP3pE{4u8yi|-CEc*Ep_#);s0ktxCy85}S Ib4q9e0FaOye*gdg diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_inventory.png index c62c33b9d29263539c816c0156928d01341a8027..ee8fff1a66c03b5d20fd7da50c48d6d8b98c0dd0 100755 GIT binary patch literal 1190 zcmeAS@N?(olHy`uVBq!ia0vp^3xIeQ2OE&o({p|Xq&N#aB8wRq_>O=u<5X=vX$A(C z2u~Nskcv5P@18BZZ6MJ0FjbBBrBm5~)v=ASjn)(Vf>hrfNc9jeeR5XO?a;vw>?-04 zjQh^_q$!;|=%muZzhJ2g3&Vt&mtQVsw_P$M(FC`?7a_!@_-0U#s7* zuRrsCt#!gld%^S1H-D0^x0`?UWl7NYIo0?6-+Wj5y?j^y_pQ>G-1qy%@7=f0@2Y!} zv*4TgH}*-Uze!*At{*6Mf1_2f>Gdo3SFcHTsGs(#`kd|jUHSVq?kjt{aJ^=#Erat{ z-g9|dT92jY)Ot5w0t&QW^S^t1_v_{F&iie(G&T5J=6vhTYWr)~H`<-~87cBkV{<6a zo@BA8P0XOcIiRL8W7WBPFT+AjfB%>kmhN@!I%D!D|A5OTt8YnIRW7|c^YsVjf*iFM z^OhWcZ1}su-1qbP+|aAvznA~~^JmSUUDrzWrgz`T+rFf9!<=t-U+ps6yCdfM)>W(a z?cKX__xn73QuA8*RASnwpguU7 z_^oYIZ@&%O>2X?9DtOPlM{8@RM}1XX9{XWd-I&n&qV>@#9`>peB-3gKw zYI;qpSKX?)E1mS2(PGQu;`5z4_b>9ktt*zPICuU5*R8opP8oBSybI?EnHH#w_7f>0zIVWFp W({sjbjkXsclRaJiT-G@yGywnsMJb^G literal 1491 zcmd6n`#aMM9LK+ggM`vUmPtGQsg|EFzoGGov20K#12rLVBLM4>3@l)_;+)JIE2vs zko*?`pIMPH4n^sg?sOn}1jB5C?Y@Q=I8FN-6OIN*Azl~`B$*a&72{5`_4oukN-p)5 zKAq`hhu3x`%acAyhaPoLzxG_*9LX*ej)M2Qk2I{EVn7ugky2~FzUD8^!cl;6)&!zM z9=7%69gs=pu=|7;%sHcgwF4Y|66v5dFcd<=#k%KPcP}8_`EOj7wK3q&_56GmE7wr{ zABo?j___@fZC1>rbc?-jh8akjr4H+7a3W~+fDHg4a^MO(8k)WZQ#=i zlPu-1@2pup@CpFWr@Blc7U$@nyOck_?7&keo0MVVUDtX@nK*l446^@RTL5mU_3`J6 zV$<%Cpf|Em@h*w%mP98YPLW7x#8~Um7%YR^)Lh&MuL=7Dp-7rTuL!*nuuG7FT!5o9-D&yu&Cv*glxli|-3|i!s6rGkk z7s_NzfhEJJy`y)U*3CP$-jIvj2$K{o8V_cWi1?N66H)JL_%za9er%$Y+o)(`SA?281J9KS$1MO{fBxqlht)N0@@O5xgzd_V|rnpZvP;Nd;M4po#@ZY zcKO}%j@{7Aon`_4J<2Vtx~Jss*y7-LpU!?Ic?wF%ZggC;ofk2v?Dil>vLDba9tu diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png new file mode 100644 index 0000000000000000000000000000000000000000..2fb6dbbb75db0e6e8ea3c2d9995be2fbb54b2f24 GIT binary patch literal 1249 zcmds#%WIQS5XGkiqy`cd7na0=FEAiJ=+K3@X-bL-NC-`#bRoFVS-7Z*bx|#()*=d8 zK`C{F`ap1}P!ZfH6l#^iY!n0+RS*m=gl-gd|#N{d(ZsNneTd|el(XY zWQizOt5yc_yE&fD4Bn;vo0>!!Y8)FHKuN?zLZn1S ztjcPv9#A-I!lrD-=3vBCc41d`V@Fp|Lk!TM1Qzzt7}}7A7A|`jiW*BrOvJ+<+M-ew zHBk?{punc7n29;u0}5xwRouj34|xC+w-E>Y0|E{~4KYB25=X&-#?Xc|v^JcRTp)D#iHAk+n3kqzin>unt(g*-tIF6v<7EvM(VB$97022(uA*dk+Xxs!AIM5i{ zkoFi+oW?e4EXTwUB>bT*Dsztkrtt?wnrO^34Jn{f?lImJWiY06V%o`YASVwo{Dc(_ zQYT2`bHJ1k9z3O1=}Y|QuTvK%x`{eyY_Q%0#(%li8)|VyPvh*yv(=IFMEN)Ibj zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvcI+q&{nsjb2?!yE?qy%Nlm%G(?}gH@IAK$z}|q*{{84C0EH8sHJX;KwUR;L6?s8u5l-9iLZkDrd3Dd->e0_HT zU{r-rEZHV322Ve{$bM(sis$%(m>?Tt#?!*sQ|#y*Ucfs?7wk-4a=C|sj9&`=g3*$* zKF4k%bYboAeD|Tm)5QaJz1P@#+gF#J2U4EaqK>7^5fnE-DRY`f3%C{IFk3>4SYiR_ z6>M&3g*dSVrkx#E&fK}pzHmW^&Nds+TU)G5S(IRtEix!@qj9%El2noiCJI;+i0v5* zPrqsUD;(juGBhp2*kJLY(KF$1+G(iwk-E$#o>(C+I}#9K4CclYS|Eh`!c-@|v(Zi7 zm>XgR4C;hAVu9IgyNONtE4O6wEYMTq$n5FPp)Lb}2)-4;AeS8*&!X(v1Zx8`aE#z5 zBXTRwZeV~_ZDs1OE_GVeUO^yjUBIxv3YvSc5o(!vv3VqJuLqW*vj^Fc?5W+rgQM z?3^9U4bDum*c58P8tWjZ@?Z=My2e&JpWJ;h_m($O_aolyE9PiW_cxfMLEU2Rk+&zT z)jUrWnFNhpI50KRQP{eaY$N_qkDvE;tL$`~9eUpb)S&>|mX5(UeePqXj-%+lSHF8B zxVyUPnr8%x#iZ&(+0vYa1!L>7=4Z}mc&k@0>9RIyd0+kp&?J|RY?xMhHKsW;4Gj#+ zD-2HW)gCs*FVQBq{^@3!k04(ius^JndeNbWC?2B9@&aeRM#P^ezUf0n{?kqe8urNh z(BAj-+leDhY+7l89~M;NZ&&2wEfq9Or}{%1Pk5&HyX^D+Lqji9_5_U16#H)5ZZEM4 z2S&f9?KTM7i$whnP4U+~U)r4t{T$d6FVq`8>kZ9Ya(p{8hkl!mXU#&b zlD!_SV)crxo`Ss;vHNL+> z7)~t>0Iaq61M2;{;RwDA0z?=>5a*h&E3kF0NlGe_!RDqsdTTbVMNx?CN$el@bIQi= zwa3u4iw$)%u6v|QLdIIXbZN_+J(pMpUo4$+_@x)o^cnXt^d*29Xg6Gf715lM00000 LNkvXXu0mjf(hGRv diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png deleted file mode 100755 index 9c6e9bad58c438096d3e1f192f1c7ee0921a9222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1606 zcmV-M2D$l(P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1Y?mh319{m&|92_ho896!&Q9nA6v6Ju3UNq4t2L%omCMKobyrGD8F)9S`xZoE}X3Bf)wy~KqTy3q;o^&wP-02dR;rr*)mMQUYOJYY(@<)zaq~@DXtAZP zvDT@(&fRzEp~s#UYm?P8Yj|PqXV!4CHW+i8p1fF7vB+TpM>*lanKEV_D&sO3(15ms zGZWA`JD3}snP@dB*eYwtgPe+kF=fy-wA^uV_hRlx-hka7@n)ZxgF)T@!5j?gCUc*> z-LO{EcB9Zn(8$7psiCfgt=pVz&_Aum=iZizj!G|Q1tM^v0J}6!98j5FTvHRsHC3#{+#j4|5#7T z@LKiM`?l7~qiYeCZ^Jcuu=VMgxWlN&4M)%nnSlP*W6tNbD(V``yC)EPtX@hwT-D3V zqNx`fbPW8#z>0_IwO-lsrAIfOab2DPPLQT&GvKCY?$|e`!+|S|2ktO|59`!6zT^KJ zrHfiv+y-8IaD3zTw=Fns5eyo_E$#V|HAN|v9%nxEYD{ylgyVDp`n`v{iCT{|(K<2n z*FProZXa}A@K;Eeq{?BEesV{9_`w}>UHd^9AAVYdr`+e?>c*vqySh=r6EX`SyiUM% z3CS{Nzj9^va9Z2s0m>U5F2N4((YXri3eK+syTK6+r9I^+eb$UEG4Wa32;bRa{vGf6951U z69E94oEQKA00(qQO+^Rf1qu)h2gs}C{{R31JV``BR5;6hlRb*VFc5{mghfaYFoCqG z+@{JE>@w+g&$oLA`vl1q(yH7dl`#yAm}a-K@L%#82{Z5c&CJv0bUHC0gz)FRXSdq{ zAR?rc@ZOVB;&3=1B6MB188}-;7z%&B3u26PT}R*dJfBZgl^7#)Oaz8M132d}vjt&X z1Mo2~P}K#=IY$VA5CS6dULb^!PczG8fVL?CsOoOLg|UOSDRIu_?`>03)ekP$_}+n; zQPq#^LRIPeo~nLeX6*O-Nt@fXe#fnhh1W0<5RqJ{s;KIO=$u<@VRemWwjdTov2e9I zgE{WEbG~1$@%w zDHmZWiXw}olwJz}e183AH^<`*jo?zc1d+j-&O9}zE{4FdC+jQ{`u07*qoM6N<$ Ef(vI7VE_OC From 228fc4b6ea2b3ff52fe6ef58a480a90eecbc8c60 Mon Sep 17 00:00:00 2001 From: bzoss Date: Tue, 19 May 2020 17:31:07 -0400 Subject: [PATCH 03/14] Updated node to add bottles. TODO: Update node for bottle placement. --- mods/ITEMS/mcl_brewing/init.lua | 39 +++++++++++++++++- .../textures/mcl_brewing_plume.png | Bin 1249 -> 0 bytes .../mcl_brewing/textures/mcl_brewing_side.png | Bin 0 -> 342 bytes .../mcl_brewing/textures/mcl_brewing_top.png | Bin 0 -> 403 bytes 4 files changed, 37 insertions(+), 2 deletions(-) delete mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_side.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index dd7ba14e..4ba2b7e0 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -108,7 +108,12 @@ end local brewing_standdef = { groups = {pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, - tiles = {"mcl_brewing_base.png", "mcl_brewing_plume.png"}, + tiles = {"mcl_brewing_top.png", --top + "mcl_brewing_base.png", --bottom + "mcl_brewing_side.png", --right + "mcl_brewing_side.png", --left + "mcl_brewing_side.png", --back + "mcl_brewing_side.png^[transformFX"}, --front paramtype = "light", sunlight_propagates = true, is_ground_content = false, @@ -118,10 +123,40 @@ local brewing_standdef = { type = "fixed", fixed = { --TODO: add bottle hangers - {-1/16, -6/16, -1/16, 1/16, 12/16, 1/16}, -- heat plume + {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base {-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base + + {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1 + {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1 + {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1 + {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1 + {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1 + + {-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1 + {-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1 + {-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1 + {-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1 + + + {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2 + {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2 + {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2 + {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2 + {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2 + + {5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2 + {4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2 + {3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2 + {2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2 + + {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3 + {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3 + + {0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3 + {0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3 + {0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3 } }, sounds = mcl_sounds.node_sound_metal_defaults(), diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_plume.png deleted file mode 100644 index 2fb6dbbb75db0e6e8ea3c2d9995be2fbb54b2f24..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1249 zcmds#%WIQS5XGkiqy`cd7na0=FEAiJ=+K3@X-bL-NC-`#bRoFVS-7Z*bx|#()*=d8 zK`C{F`ap1}P!ZfH6l#^iY!n0+RS*m=gl-gd|#N{d(ZsNneTd|el(XY zWQizOt5yc_yE&fD4Bn;vo0>!!Y8)FHKuN?zLZn1S ztjcPv9#A-I!lrD-=3vBCc41d`V@Fp|Lk!TM1Qzzt7}}7A7A|`jiW*BrOvJ+<+M-ew zHBk?{punc7n29;u0}5xwRouj34|xC+w-E>Y0|E{~4KYB25=X&-#?Xc|v^JcRTp)D#iHAk+n3kqzin>unt(g*-tIF6v<7EvM(VB$97022(uA*dk+Xxs!AIM5i{ zkoFi+oW?e4EXTwUB>bT*Dsztkrtt?wnrO^34Jn{f?lImJWiY06V%o`YASVwo{Dc(_ zQYT2`bHJ1k9z3O1=}Y|QuTvK%x`{eyY_Q%0#(%li8)|VyPvh*yv(=IFMEN)IbjLk}*!hKoCXWAV-enkjjb`khp{ofUl5-f&-9CP|#6u zf^Yy%zyVC3^rrN>E8;mUo`de5fE6DLxF~`YOJMhOW20lg+2t4kRn>Mj6SSg> zV@)u*tZlosEzre@JlEe^M1k o43e1T@*RL)+GE&HjX-n$0hVQYo-Av_(f|Me07*qoM6N<$g5_wAqW}N^ literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_top.png new file mode 100644 index 0000000000000000000000000000000000000000..4ed94d460a248da9fc44e73762782d2e4b26d4e1 GIT binary patch literal 403 zcmV;E0c`$>P)Lk}*%hP!xqfh@>{H4E`IphB%Vo;N)*`F)@Y#1jIyQ zOc-$C4>&nU!f41N42GGBfq_wL7)W0pq(dD@AC#18@J#RJ-h1x3CnrS=9;&54c@opM zuuX&G>=EP1l)I;9YP&ZbM*uKiNB}NxN{lDdU2X9M%9Hrg$2N_fgTE@sSQ!BN{k~T7 zXM%9Rb!Yo4$R1jlwx!>DLkJNh)en-2L6rdEBre!_!oRU8J?V_p?e$eKU&x42xqJb~ zaU!V`LIk~TNB={E(*VBoG3}M>xqN}m#t@_7fLy*1$%JhhD}pdIC(bFoZb!3k!c$8= z#5-r_7n;OV%e9HcN}bVgz Date: Sat, 23 May 2020 16:39:55 -0400 Subject: [PATCH 04/14] Updated Formspec background. Established initial brewing timer framework. --- mods/ITEMS/mcl_brewing/init.lua | 291 ++++++++++++++---- .../textures/mcl_brewing_bubbles.png | Bin 0 -> 193 bytes .../textures/mcl_brewing_bubbles_active.png | Bin 0 -> 194 bytes .../textures/mcl_brewing_burner.png | Bin 0 -> 147 bytes .../textures/mcl_brewing_burner_active.png | Bin 0 -> 157 bytes .../textures/mcl_brewing_inventory.png | Bin 1190 -> 1033 bytes mods/ITEMS/mcl_potions/init.lua | 8 + 7 files changed, 244 insertions(+), 55 deletions(-) create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles_active.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner.png create mode 100644 mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner_active.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 4ba2b7e0..0e22b472 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -1,20 +1,12 @@ -local S = minetest.get_translator("mcl_brewing") - -local MAX_NAME_LENGTH = 30 -local MAX_WEAR = 65535 -local SAME_TOOL_REPAIR_BOOST = math.ceil(MAX_WEAR * 0.12) -- 12% -local MATERIAL_TOOL_REPAIR_BOOST = { - math.ceil(MAX_WEAR * 0.25), -- 25% - math.ceil(MAX_WEAR * 0.5), -- 50% - math.ceil(MAX_WEAR * 0.75), -- 75% - MAX_WEAR, -- 100% -} +local S = minetest.get_translator("mcl_brewing_stand") local NAME_COLOR = "#FFFF4C" -local function get_brewing_stand_formspec() +local function active_brewing_formspec(fuel_percent, item_percent) return "size[9,8.75]".. - "background[-0.19,-0.25;9.41,9.49;mcl_brewing_inventory.png]".. + "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png^[lowpart:".. + (item_percent)..":mcl_brewing_inventory_active.png]".. + -- "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory_active.png]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "list[current_player;main;0,4.5;9,3;9]".. mcl_formspec.get_itemslot_bg(0,4.5,9,3).. @@ -34,49 +26,230 @@ local function get_brewing_stand_formspec() "listring[current_player;main]".. "listring[current_name;fuel]".. "listring[current_name;input]".. - -- "listring[context;stand1]".. - -- "listring[context;stand2]".. "listring[context;stand]" end +local brewing_formspec = "size[9,8.75]".. + "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]".. + "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. + "list[current_player;main;0,4.5;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,4.5,9,3).. + "list[current_player;main;0,7.75;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7.75,9,1).. + "list[current_name;fuel;0.5,1.75;1,1;]".. + mcl_formspec.get_itemslot_bg(0.5,1.75,1,1).."image[0.5,1.75;1,1;mcl_brewing_fuel_bg.png]".. + "list[current_name;input;2.75,0.5;1,1;]".. + mcl_formspec.get_itemslot_bg(2.75,0.5,1,1).. + "list[context;stand;4.5,2.5;1,1;]".. + mcl_formspec.get_itemslot_bg(4.5,2.5,1,1).."image[4.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. + "list[context;stand;6,2.8;1,1;1]".. + mcl_formspec.get_itemslot_bg(6,2.8,1,1).."image[6,2.8;1,1;mcl_brewing_bottle_bg.png]".. + "list[context;stand;7.5,2.5;1,1;2]".. + mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. --- Given a tool and material stack, returns how many items of the material stack --- needs to be used up to repair the tool. -local function get_consumed_materials(tool, material) - local wear = tool:get_wear() - if wear == 0 then + "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[lowpart:".. + (65)..":mcl_brewing_burner_active.png^[transformR270]".. + + "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png^[lowpart:".. + (65)..":mcl_brewing_bubbles_active.png]".. + + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_name;input]".. + "listring[context;stand]" + + +local function swap_node(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + + +local function brewing_stand_timer(pos, elapsed) + -- Inizialize metadata + local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 + local input_time = meta:get_float("input_time") or 0 + local input_item = meta:get_string("input_item") or "" + local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + + local inv = meta:get_inventory() + local stand_list, fuellist + + local cookable, cooked + local fuel + + local update = true + + while update do + + update = false + + local formspec = brewing_formspec + + formspec = active_brewing_formspec(100,15) + + input_list = inv:get_list("input") + stand_list = inv:get_list("stand") + fuellist = inv:get_list("fuel") + + for i=1, inv:get_size("stand") do + local stack = inv:get_stack("stand", i) + print(stack:get_name()) + print(stack:get_count()) + end + + + -- Check if we have compatible alchemy + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = stand_list}) + cookable = cooked.time ~= 0 + + -- Check if src item has been changed + if stand_list[1]:get_name() ~= input_item then + -- Reset cooking progress in this case + input_time = 0 + input_item = stand_list[1]:get_name() + update = true + + -- Check if we have enough fuel to burn + elseif fuel_time < fuel_totaltime then + -- The furnace is currently active and has enough fuel + fuel_time = fuel_time + elapsed + -- If there is a cookable item then check if it is ready yet + if cookable then + -- Place result in dst list if done + if input_time >= cooked.time then + inv:add_item("stand", cooked.item) + inv:set_stack("input", 1, aftercooked.items[1]) + + input_time = 0 + update = true + end + + elseif input_time ~= 0 then + -- If output slot is occupied, stop cooking + input_time = 0 + update = true + end + else + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local afterfuel + fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + input_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + input_time = input_time + elapsed + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + input_time = 0 + end + fuel_time = 0 + end + + elapsed = 0 + end + + if fuel and fuel_totaltime > fuel.time then + fuel_totaltime = fuel.time + end + if stand_list[1]:is_empty() then + input_time = 0 + end + + -- + -- Update formspec and node + -- + local formspec = brewing_formspec + formspec = active_brewing_formspec(100,85) + local item_state + local item_percent = 0 + + if cookable then + item_percent = math.floor(input_time / cooked.time * 100) + end + + local result = false + + if fuel_totaltime ~= 0 then + local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) + formspec = active_brewing_formspec(fuel_percent, item_percent) + swap_node(pos, "mcl_brewing:stand_active") + -- make sure timer restarts automatically + result = true + else + swap_node(pos, "mcl_brewing:stand") + -- stop timer on the inactive stand + minetest.get_node_timer(pos):stop() + end + + -- + -- Set meta values + -- + meta:set_float("fuel_totaltime", fuel_totaltime) + meta:set_float("fuel_time", fuel_time) + meta:set_float("input_time", input_time) + meta:set_string("input_item", stand_list[1]:get_name()) + meta:set_string("formspec", formspec) + + return result +end + + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) return 0 end - local health = (MAX_WEAR - wear) - local matsize = material:get_count() - local materials_used = 0 - for m=1, math.min(4, matsize) do - materials_used = materials_used + 1 - if (wear - MATERIAL_TOOL_REPAIR_BOOST[m]) <= 0 then - break + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if listname == "fuel" then + + -- Test stack with size 1 because we burn one fuel at a time + local teststack = ItemStack(stack) + teststack:set_count(1) + local output, decremented_input = minetest.get_craft_result({method="fuel", width=1, items={teststack}}) + if output.time ~= 0 then + -- Only allow to place 1 item if fuel get replaced by recipe. + -- This is the case for lava buckets. + local replace_item = decremented_input.items[1] + if replace_item:is_empty() then + -- For most fuels, just allow to place everything + return stack:get_count() + else + if inv:get_stack(listname, index):get_count() == 0 then + return 1 + else + return 0 + end + end + else + return 0 end - end - return materials_used -end - --- Given 2 input stacks, tells you which is the tool and which is the material. --- Returns ("tool", input1, input2) if input1 is tool and input2 is material. --- Returns ("material", input2, input1) if input1 is material and input2 is tool. --- Returns nil otherwise. -local function distinguish_tool_and_material(input1, input2) - local def1 = input1:get_definition() - local def2 = input2:get_definition() - if def1.type == "tool" and def1._repair_material then - return "tool", input1, input2 - elseif def2.type == "tool" and def2._repair_material then - return "material", input2, input1 - else - return nil + elseif listname == "input" then + return stack:get_count() + elseif listname == "stand" then + return 0 end end - -- Drop input items of brewing_stand at pos with metadata meta local function drop_brewing_stand_items(pos, meta) @@ -106,7 +279,7 @@ end -local brewing_standdef = { +local brewing_stand_def = { groups = {pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, tiles = {"mcl_brewing_top.png", --top "mcl_brewing_base.png", --bottom @@ -191,6 +364,7 @@ local brewing_standdef = { return stack:get_count() end end, + -- allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) -- local name = player:get_player_name() -- if minetest.is_protected(pos, name) then @@ -217,7 +391,7 @@ local brewing_standdef = { inv:set_size("stand", 3) -- inv:set_size("stand2", 1) -- inv:set_size("stand3", 1) - local form = get_brewing_stand_formspec() + local form = brewing_formspec meta:set_string("formspec", form) end, @@ -227,16 +401,19 @@ local brewing_standdef = { minetest.record_protection_violation(pos, sender_name) return end - end, + + on_timer = brewing_stand_timer, } + + if minetest.get_modpath("screwdriver") then - brewing_standdef.on_rotate = screwdriver.rotate_simple + brewing_stand_def.on_rotate = screwdriver.rotate_simple end -brewing_standdef.description = S("Brewing Stand") -brewing_standdef._doc_items_longdesc = S("The stand allows you to brew potions!") -brewing_standdef._doc_items_usagehelp = +brewing_stand_def.description = S("Brewing Stand") +brewing_stand_def._doc_items_longdesc = S("The stand allows you to brew potions!") +brewing_stand_def._doc_items_usagehelp = S("To use an brewing_stand, rightclick it. An brewing_stand has 2 input slots (on the left) and one output slot.").."\n".. S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n".. S("There are two possibilities to repair tools (and armor):").."\n".. @@ -244,9 +421,13 @@ S("• Tool + Tool: Place two tools of the same type in the input slots. The “ S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n".. S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n".. S("The brewing_stand has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the brewing_stand gets damaged. brewing_stand also have a chance of being damaged when they fall by more than 1 block. If a very damaged brewing_stand is damaged again, it is destroyed.") -brewing_standdef._tt_help = S("Repair and rename items") +brewing_stand_def._tt_help = S("Repair and rename items") -minetest.register_node("mcl_brewing:stand", brewing_standdef) +minetest.register_node("mcl_brewing:stand", brewing_stand_def) + +local brewing_stand_active_def = brewing_stand_def +brewing_stand_active_def.light_source = 8 +minetest.register_node("mcl_brewing:stand_active", brewing_stand_active_def) if minetest.get_modpath("mcl_core") then minetest.register_craft({ @@ -267,6 +448,6 @@ minetest.register_lbm({ run_at_every_load = false, action = function(pos, node) local meta = minetest.get_meta(pos) - meta:set_string("formspec", get_brewing_stand_formspec()) + meta:set_string("formspec", brewing_formspec) end, }) diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles.png new file mode 100644 index 0000000000000000000000000000000000000000..780352408fffc2731422e4d54013eb8674de0253 GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^d_XME!3HF+ANuniNO2Z;L>2?ZkAN`aRBb+KpkT45 zi(`mI@6$2dx`fogckvDtPBMt%Q)%UVwZiaQJ2?}Pn-Z|1R|+3ydu zw+jerAOFra|H%#6Y4P=CTe{c&Txx%0@=Ti-8K176^*t}KaN4XICby>k^{YPc&FZ*z o_fY)VOJ;}O*vT0`w@R~MT*jR%>~?o^6wrDGPgg&ebxsLQ04&8yumAu6 literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles_active.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_bubbles_active.png new file mode 100644 index 0000000000000000000000000000000000000000..2a367807ac6d5024ee9a392ede39401ffc9c2c55 GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^d_XME!3HF+ANuniNO2Z;L>2?ZkAN`aRBb+KpkRro zi(`mI@6$<+d<_O1EaLJ<|DXRGVr%Ny$T6k)*iNRCMhqo~&TKZ>;=w3OnQe pZqpjkLq)gP?!GaaXLXQIyoCO|{#S9F5M?jcysy3fAP|(%W z#W6%;>f4Kkj0Y414jlL`<;>1Ep@k)9!5iy~WeF)c$5MP8($ua*9h6W`I%%o?VsGoCO|{#S9F5M?jcysy3fAP|)Ag z#W6%;>f4JOIU5W_7%qxeADlZ!X)lMLN(XZaXStBfgJ@S>9o@a3*6m>t6r51Zwsgvr zRW{c+dv5d1THdns{kspxAX!0n03%pQb^{Z3 z6y3p%`?_4Vv571{IH!sMkJc}2MW5tAIs^b#X1CkL>NZ8&Q?xlnyH(p$v`dfrL0|d_ z=;~{#elPv~_xUq-2U2RDi2MCsG#|g;@5OGni`8@0^Uc@R?|)bSrv7+ayF>cetkYJn zt*?*jlUY{;H&1NajMMj;NB8^M9n#;vI*)4prv6f`dIoIHQf<#w&*$!2Q(s@}meALn zRy_cRY8#yOXd4=zQ)^oaY~88{VAuMo{&;=;RDbQGHXjYlX1hb$Y^&eb*Sx50HBV4kmcMGF>*Q^%&R8!$ z0Q+Ww`boOoZle!)S(bm>jxolMkB{*6^;INZ84F4bcFwWZwx;SkQ}a|q$T$a>}y z$d>Dnz}BKs1h352qEQ5|P*-Gy5W@9(4I!*68b$DmEG-(pzrR;eheWm(jUsr3=8nb? z)*1CAuz$1&&Q(VQFT~cOQ3S8h+!4IiIwUYOvU1fC!7pZO(I|pfXzpkX!7lh^<%%p3 zOslO$V_%*9elLQTs%_Rd91h`fxfE5TttlFFydN^?i?mejq>SL-^ka;FQgr5#-puHc zqi;E-`2Iv$mf?E6wjR?ELO7jH*=D2^?&N8^)tA7BlvtickYrI zq548~eQ~{3F~<1$`I#+(r{0~WdOwT!T4q<=)@Hs{55APD2o4>`q>A98C{}UIW*>lE zJG$z*5M1o6`x#t=cBecrG){8&YYM3%Ye=0O$1K(R$+8RXGIU25V~lTaZ<`p1Ihg%M zsDFN9o44cf_;)aFX%@^;Bgafz)yh$4GOrZDx#S#xDTrWZHR~>T%tckZV3HHT>51SG zL@=|*TGvHWpSpcsjA{Nl>gI`HW;N#1y&`yhzMBg`*iOd{Q;9f1UDHVgb@A(Jg}Ym`?_WH P00000NkvXXu0mjf1>fRr delta 1079 zcmV-71jze|2&M^;IDZ6KNkl5QgDpCJpIAcEGD$fn9++kWNx1?!aY8 z7j@*#Ax6T%@CPIpAOXJ5jAkOq!9pa251^$)1OSkk)9Iw{7NhMLZN_NVwH>2fjOZTp zy`O-gzFPHr@2`K%@2xvv$v+X#=d2y-}oO|B?*?;bR_jkIF_q7|+N54*A zy}rIq)kk7O5$vDXz8PoiXQu9twHwmku{u*V*VNyutY<)fmg;-XJ)gR7zOlY`?V+zJ zWjz2x^$pH$w1viJY<)|C(q%mWht^Ns$GhvN?$1uOIW;i-c0=0it3TG)u|CZCSrqOl zvsDbdV-{Mn1Ahhp006)yB$%qs-sx6VHT(FMR%c4q*8yYlPf*h|tJ)Ykd8O5v>+l0` zY$oWQq{rhi`+zr1^RI1H)%W*z`TYE>{JPe4E|-hkZnva$u$=bY>bf?)xLnt@s;a)d zy{WtJZZYbd&*!9dkO6nnsPiAwr?H_E;?_*6sut^~Qh(|kehp|zRdr}_?@r{B#eeB_ zU_ey|*ID|*BC<-W10(Ka3~`I~wI{5!I;;T=4MkSlwsO5*MdWW}Ex80zavc~bEgFg7 z%#;?5L~w?NB1=T%e!q)IUeQPdXJl{D`2GEzMV&*i{x#H4jgq2~2sTpJwLTt?O4a5! z17o(1Mt_k!qrP}+-=(27_7uUX>JY&@QCc(-!I8OWwrq3j2+p<6;kanAjONhDN>zsl z-Z{&`CsJNC62TeTIvPdT1s_(b$RdI>#D!?vI(1zW!J$%Kh<5e-$J(})+wE4lNXsc2 zQ@ozyt$mkT^&zKS@S1+i@ynt!Q${mmgjIci=6{RvHN_AX-=AojM(+1}?=ck-xm+&E zW+aQ(ljKWDOFQZgs%3O`FF>b?WlKMOAC2Ja^*Xpq#td$zQeFN9Xn&^b-cK3Ls;VC! zAITy(_U_c`_3YwnnL`7iGdnFFeEtT+-S^thhKpbsI3_NFtE$?3-5X-_0XVdybI*w^ z-+$2!?S69{c+St@3fi4wLTH?%?pF*}krh%W#WAybJxO-KLqd0Ss;Vz9FGUQ*6qx;H zaPL_Ec0Ql~4aOz!=#Wb-sb|*|o1RoNt*e!yPBgJ1IAo_A<0Dynka7T8IBW!`{Pi4m zELH?}2lA2RHUnUo&;uYE0002&&L4c)Ntl}`hUfqQ002ovPDHLkV1j`mDGvYu diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 5123d8b7..dd863075 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -279,6 +279,14 @@ minetest.register_craftitem("mcl_potions:potion_mundane", { on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"), on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) + +minetest.register_craft({ + type = "cooking", + output = "mcl_potions:potion_awkward", +recipe = "mcl_nether:nether_wart_item", --"mcl_potions:potion_river_water"}, + cooktime = 10, +}) + minetest.register_craftitem("mcl_potions:potion_thick", { description = S("Thick Potion"), _tt_help = S("No effect"), From 5c4cc99621439428f1d487abe99350da125c8e8d Mon Sep 17 00:00:00 2001 From: bzoss Date: Mon, 25 May 2020 09:08:37 -0400 Subject: [PATCH 05/14] Fixed for burning only blaze powder. --- mods/ITEMS/mcl_brewing/depends.txt | 2 +- mods/ITEMS/mcl_brewing/init.lua | 165 +++++++++++++---------------- mods/ITEMS/mcl_mobitems/init.lua | 7 +- 3 files changed, 78 insertions(+), 96 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/depends.txt b/mods/ITEMS/mcl_brewing/depends.txt index 4c84c729..73f7dce8 100755 --- a/mods/ITEMS/mcl_brewing/depends.txt +++ b/mods/ITEMS/mcl_brewing/depends.txt @@ -2,6 +2,6 @@ mcl_init mcl_formspec mcl_sounds mcl_potions -mcl_mobitems? +mcl_mobitems mcl_core? screwdriver? diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 0e22b472..4b0a975a 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -4,8 +4,7 @@ local NAME_COLOR = "#FFFF4C" local function active_brewing_formspec(fuel_percent, item_percent) return "size[9,8.75]".. - "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png^[lowpart:".. - (item_percent)..":mcl_brewing_inventory_active.png]".. + "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]".. -- "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory_active.png]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "list[current_player;main;0,4.5;9,3;9]".. @@ -23,6 +22,12 @@ local function active_brewing_formspec(fuel_percent, item_percent) "list[context;stand;7.5,2.5;1,1;2]".. mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. + "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[lowpart:".. + (100-fuel_percent)..":mcl_brewing_burner_active.png^[transformR270]".. + + "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png^[lowpart:".. + (item_percent)..":mcl_brewing_bubbles_active.png]".. + "listring[current_player;main]".. "listring[current_name;fuel]".. "listring[current_name;input]".. @@ -47,11 +52,8 @@ local brewing_formspec = "size[9,8.75]".. "list[context;stand;7.5,2.5;1,1;2]".. mcl_formspec.get_itemslot_bg(7.5,2.5,1,1).."image[7.5,2.5;1,1;mcl_brewing_bottle_bg.png]".. - "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[lowpart:".. - (65)..":mcl_brewing_burner_active.png^[transformR270]".. - - "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png^[lowpart:".. - (65)..":mcl_brewing_bubbles_active.png]".. + "image[2.7,3.33;1.28,0.41;mcl_brewing_burner.png^[transformR270]".. + "image[2.76,1.4;1,2.15;mcl_brewing_bubbles.png]".. "listring[current_player;main]".. "listring[current_name;fuel]".. @@ -73,14 +75,17 @@ local function brewing_stand_timer(pos, elapsed) -- Inizialize metadata local meta = minetest.get_meta(pos) local fuel_time = meta:get_float("fuel_time") or 0 - local input_time = meta:get_float("input_time") or 0 + -- local input_time = meta:get_float("input_time") or 0 local input_item = meta:get_string("input_item") or "" local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 - local inv = meta:get_inventory() - local stand_list, fuellist + local stand_timer = {0,0,0} + local stand_item = {"","",""} - local cookable, cooked + local inv = meta:get_inventory() + local stand_list, fuel_list + + local brewable, brewed local fuel local update = true @@ -89,77 +94,53 @@ local function brewing_stand_timer(pos, elapsed) update = false - local formspec = brewing_formspec - - formspec = active_brewing_formspec(100,15) - input_list = inv:get_list("input") stand_list = inv:get_list("stand") - fuellist = inv:get_list("fuel") - - for i=1, inv:get_size("stand") do - local stack = inv:get_stack("stand", i) - print(stack:get_name()) - print(stack:get_count()) - end + fuel_list = inv:get_list("fuel") - -- Check if we have compatible alchemy - local aftercooked - cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = stand_list}) - cookable = cooked.time ~= 0 + --TODO check if the stands have changed items - -- Check if src item has been changed - if stand_list[1]:get_name() ~= input_item then - -- Reset cooking progress in this case - input_time = 0 - input_item = stand_list[1]:get_name() - update = true + if fuel_time < fuel_totaltime then - -- Check if we have enough fuel to burn - elseif fuel_time < fuel_totaltime then - -- The furnace is currently active and has enough fuel fuel_time = fuel_time + elapsed - -- If there is a cookable item then check if it is ready yet - if cookable then - -- Place result in dst list if done - if input_time >= cooked.time then - inv:add_item("stand", cooked.item) - inv:set_stack("input", 1, aftercooked.items[1]) - input_time = 0 - update = true - end + --TODO check to see if we can brew - elseif input_time ~= 0 then - -- If output slot is occupied, stop cooking - input_time = 0 - update = true - end - else - -- Furnace ran out of fuel - if cookable then - -- We need to get new fuel - local afterfuel - fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + else --get more fuel from fuel_list - if fuel.time == 0 then - -- No valid fuel in fuel list - fuel_totaltime = 0 - input_time = 0 - else - -- Take fuel from fuel list - inv:set_stack("fuel", 1, afterfuel.items[1]) - update = true - fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) - input_time = input_time + elapsed - end - else - -- We don't need to get new fuel since there is no cookable item + local after_fuel + + -- for i=1, inv:get_size("stand") do + -- local stack = inv:get_stack("stand", i) + -- print(stack:get_name()) + -- print(stack:get_count()) + -- end + print(inv:get_stack("fuel",1):get_name()) + + fuel, after_fuel = minetest.get_craft_result({method="fuel", width=1, items=fuel_list}) + + if fuel.time == 0 then --no valid fuel, reset timers fuel_totaltime = 0 - input_time = 0 + + for i=1, inv:get_size("stand", i) do + stand_timer[i] = 0 + end + + fuel_totaltime = 0 + for i=1, inv:get_size("stand", i) do + stand_timer[i] = 0 + end + -- only allow blaze powder fuel + elseif inv:get_stack("fuel",1):get_name() == "mcl_mobitems:blaze_powder" then -- Grab another fuel + inv:set_stack("fuel", 1, after_fuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + for i=1, inv:get_size("stand", i) do + stand_timer[i] = stand_timer[i] + elapsed + end end - fuel_time = 0 + end elapsed = 0 @@ -168,43 +149,33 @@ local function brewing_stand_timer(pos, elapsed) if fuel and fuel_totaltime > fuel.time then fuel_totaltime = fuel.time end - if stand_list[1]:is_empty() then - input_time = 0 + + for i=1, inv:get_size("stand", i) do + if stand_list[i]:is_empty() then + stand_timer[i] = 0 + end end - -- - -- Update formspec and node - -- + --update formspec local formspec = brewing_formspec - formspec = active_brewing_formspec(100,85) - local item_state - local item_percent = 0 - - if cookable then - item_percent = math.floor(input_time / cooked.time * 100) - end local result = false if fuel_totaltime ~= 0 then - local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) - formspec = active_brewing_formspec(fuel_percent, item_percent) + local fuel_percent = math.floor(fuel_time/fuel_totaltime*100) + formspec = active_brewing_formspec(fuel_percent, 60) swap_node(pos, "mcl_brewing:stand_active") - -- make sure timer restarts automatically result = true else swap_node(pos, "mcl_brewing:stand") - -- stop timer on the inactive stand minetest.get_node_timer(pos):stop() end - -- - -- Set meta values - -- + meta:set_float("fuel_totaltime", fuel_totaltime) meta:set_float("fuel_time", fuel_time) - meta:set_float("input_time", input_time) - meta:set_string("input_item", stand_list[1]:get_name()) + -- meta:set_float("src_time", src_time) + -- meta:set_string("src_item", srclist[1]:get_name()) meta:set_string("formspec", formspec) return result @@ -277,10 +248,13 @@ local function drop_brewing_stand_items(pos, meta) end - +local on_rotate +if minetest.get_modpath("screwdriver") then + on_rotate = screwdriver.rotate_simple +end local brewing_stand_def = { - groups = {pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, + groups = {pickaxey=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1}, tiles = {"mcl_brewing_top.png", --top "mcl_brewing_base.png", --bottom "mcl_brewing_side.png", --right @@ -295,7 +269,7 @@ local brewing_stand_def = { node_box = { type = "fixed", fixed = { - --TODO: add bottle hangers + {-1/16, -5/16, -1/16, 1/16, 8/16, 1/16}, -- heat plume { 2/16, -8/16, -8/16, 8/16, -6/16, -2/16}, -- base {-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base @@ -404,6 +378,7 @@ local brewing_stand_def = { end, on_timer = brewing_stand_timer, + on_rotate = on_rotate, } @@ -427,6 +402,8 @@ minetest.register_node("mcl_brewing:stand", brewing_stand_def) local brewing_stand_active_def = brewing_stand_def brewing_stand_active_def.light_source = 8 +brewing_stand_active_def.drop = "mcl_brewing:stand" +brewing_stand_active_def.groups = {not_in_creative_inventory=1, pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1} minetest.register_node("mcl_brewing:stand_active", brewing_stand_active_def) if minetest.get_modpath("mcl_core") then diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index 3e6aef48..0b4d47e0 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -428,6 +428,12 @@ minetest.register_craft({ burntime = 120, }) +minetest.register_craft({ + type = "fuel", + recipe = "mcl_mobitems:blaze_powder", + burntime = 120, +}) + minetest.register_craft({ output = 'mcl_mobitems:slimeball 9', recipe = {{"mcl_core:slimeblock"}}, @@ -439,4 +445,3 @@ minetest.register_craft({ {"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}, {"mcl_mobitems:slimeball","mcl_mobitems:slimeball","mcl_mobitems:slimeball",}}, }) - From 190eb32ac2d4bc8125b84e4efad6bc8acbb52bb4 Mon Sep 17 00:00:00 2001 From: bzoss Date: Mon, 25 May 2020 09:28:23 -0400 Subject: [PATCH 06/14] Update brew timer...will reset if any bottle is changed --- mods/ITEMS/mcl_brewing/init.lua | 51 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 4b0a975a..434309d1 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -74,16 +74,18 @@ end local function brewing_stand_timer(pos, elapsed) -- Inizialize metadata local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 - -- local input_time = meta:get_float("input_time") or 0 - local input_item = meta:get_string("input_item") or "" local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 - local stand_timer = {0,0,0} - local stand_item = {"","",""} + local input_item = meta:get_string("input_item") or "" + + local stand_timer = meta:get_float("stand_timer") or 0 + local stand_items = meta:get_string("stand_items") or {"","",""} local inv = meta:get_inventory() - local stand_list, fuel_list + + local input_list, stand_list, fuel_list local brewable, brewed local fuel @@ -98,8 +100,14 @@ local function brewing_stand_timer(pos, elapsed) stand_list = inv:get_list("stand") fuel_list = inv:get_list("fuel") - - --TODO check if the stands have changed items + -- TODO fix this function to check for change in stand content... + -- for i=1, inv:get_size("stand", i) do -- reset the process due to change + -- if stand_list[i]:get_name() ~= stand_list[i] then + -- stand_timer = 0 + -- stand_list[i] = stand_list[i]:get_name() + -- update = true -- need to update the stand with new data + -- end + -- end if fuel_time < fuel_totaltime then @@ -111,34 +119,23 @@ local function brewing_stand_timer(pos, elapsed) local after_fuel - -- for i=1, inv:get_size("stand") do - -- local stack = inv:get_stack("stand", i) - -- print(stack:get_name()) - -- print(stack:get_count()) - -- end - print(inv:get_stack("fuel",1):get_name()) + -- print(inv:get_stack("fuel",1):get_name()) fuel, after_fuel = minetest.get_craft_result({method="fuel", width=1, items=fuel_list}) if fuel.time == 0 then --no valid fuel, reset timers - fuel_totaltime = 0 - - for i=1, inv:get_size("stand", i) do - stand_timer[i] = 0 - end fuel_totaltime = 0 - for i=1, inv:get_size("stand", i) do - stand_timer[i] = 0 - end + stand_timer = 0 + -- only allow blaze powder fuel elseif inv:get_stack("fuel",1):get_name() == "mcl_mobitems:blaze_powder" then -- Grab another fuel inv:set_stack("fuel", 1, after_fuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) - for i=1, inv:get_size("stand", i) do - stand_timer[i] = stand_timer[i] + elapsed - end + stand_timer = stand_timer + elapsed end end @@ -152,7 +149,7 @@ local function brewing_stand_timer(pos, elapsed) for i=1, inv:get_size("stand", i) do if stand_list[i]:is_empty() then - stand_timer[i] = 0 + stand_timer = 0 end end @@ -174,8 +171,8 @@ local function brewing_stand_timer(pos, elapsed) meta:set_float("fuel_totaltime", fuel_totaltime) meta:set_float("fuel_time", fuel_time) - -- meta:set_float("src_time", src_time) - -- meta:set_string("src_item", srclist[1]:get_name()) + meta:set_float("stand_timer", stand_timer) + -- meta:set_string("stand_items", stand_list) meta:set_string("formspec", formspec) return result From 0df8bb94f90150912e0b91841e93fc448686fe77 Mon Sep 17 00:00:00 2001 From: bzoss Date: Mon, 25 May 2020 09:29:23 -0400 Subject: [PATCH 07/14] Remove "active" stand node definition --- mods/ITEMS/mcl_brewing/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 434309d1..c535831f 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -397,11 +397,11 @@ brewing_stand_def._tt_help = S("Repair and rename items") minetest.register_node("mcl_brewing:stand", brewing_stand_def) -local brewing_stand_active_def = brewing_stand_def -brewing_stand_active_def.light_source = 8 -brewing_stand_active_def.drop = "mcl_brewing:stand" -brewing_stand_active_def.groups = {not_in_creative_inventory=1, pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1} -minetest.register_node("mcl_brewing:stand_active", brewing_stand_active_def) +-- local brewing_stand_active_def = brewing_stand_def +-- brewing_stand_active_def.light_source = 8 +-- brewing_stand_active_def.drop = "mcl_brewing:stand" +-- brewing_stand_active_def.groups = {not_in_creative_inventory=1, pickaxey=1, falling_node=1, falling_node_damage=1, crush_after_fall=1, deco_block=1, brewing_stand=1} +-- minetest.register_node("mcl_brewing:stand_active", brewing_stand_active_def) if minetest.get_modpath("mcl_core") then minetest.register_craft({ From b5b00209976e34bedf47213a63aa6472bf4e153c Mon Sep 17 00:00:00 2001 From: bzoss Date: Mon, 25 May 2020 15:31:35 -0400 Subject: [PATCH 08/14] Laid the framework to brew potions...TODO make it actually swap for the potion. --- mods/ITEMS/mcl_brewing/init.lua | 46 +++++++++++++++--- mods/ITEMS/mcl_potions/init.lua | 16 +++--- .../textures/mcl_potions_healing.png | Bin 0 -> 1261 bytes 3 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 mods/ITEMS/mcl_potions/textures/mcl_potions_healing.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index c535831f..3657b10b 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -71,12 +71,37 @@ local function swap_node(pos, name) end +local function brewable(inv) + + local ingredient = inv:get_stack("input",1):get_name() + local stands = {"","",""} + + for i=1,3 do + + local bottle = inv:get_stack("stand", i):get_name() + + if ingredient == "mcl_nether:nether_wart_item" and bottle == "mcl_potions:potion_river_water" or "mcl_potions:potion_water" then + stands[i] = "mcl_potions:potion_awkward" + end + + end + + for i=1,3 do + if stands[i] then return stands end + end + + return false + +end + + local function brewing_stand_timer(pos, elapsed) -- Inizialize metadata local meta = minetest.get_meta(pos) local fuel_time = meta:get_float("fuel_time") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + local BREW_TIME = 10 local input_item = meta:get_string("input_item") or "" @@ -87,7 +112,6 @@ local function brewing_stand_timer(pos, elapsed) local input_list, stand_list, fuel_list - local brewable, brewed local fuel local update = true @@ -109,11 +133,21 @@ local function brewing_stand_timer(pos, elapsed) -- end -- end + local brew_output = brewable(inv) + if fuel_time < fuel_totaltime then fuel_time = fuel_time + elapsed - --TODO check to see if we can brew + -- Replace the stand item with the brew result + if brew_output and (stand_timer >= BREW_TIME) then + for i=1, inv:get_size("stand", i) do + if brew_output[i] then + inv:set_stack("stand", i, brew_output[i]) + end + end + end + else --get more fuel from fuel_list @@ -139,7 +173,6 @@ local function brewing_stand_timer(pos, elapsed) end end - elapsed = 0 end @@ -160,11 +193,12 @@ local function brewing_stand_timer(pos, elapsed) if fuel_totaltime ~= 0 then local fuel_percent = math.floor(fuel_time/fuel_totaltime*100) - formspec = active_brewing_formspec(fuel_percent, 60) - swap_node(pos, "mcl_brewing:stand_active") + local brew_percent = math.floor(stand_timer/BREW_TIME*100) % 100 + formspec = active_brewing_formspec(fuel_percent, stand_timer) + -- swap_node(pos, "mcl_brewing:stand_active") result = true else - swap_node(pos, "mcl_brewing:stand") + -- swap_node(pos, "mcl_brewing:stand") minetest.get_node_timer(pos):stop() end diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index dd863075..622b08e8 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -280,12 +280,6 @@ minetest.register_craftitem("mcl_potions:potion_mundane", { on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) -minetest.register_craft({ - type = "cooking", - output = "mcl_potions:potion_awkward", -recipe = "mcl_nether:nether_wart_item", --"mcl_potions:potion_river_water"}, - cooktime = 10, -}) minetest.register_craftitem("mcl_potions:potion_thick", { description = S("Thick Potion"), @@ -328,3 +322,13 @@ minetest.register_craftitem("mcl_potions:dragon_breath", { groups = { brewitem = 1, not_in_creative_inventory = 1 }, stack_max = 64, }) + +minetest.register_craftitem("mcl_potions:healing", { + description = S("Healing Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_healing.png", + inventory_image = "mcl_potions_healing.png", + -- TODO: Reveal item when it's actually useful + groups = { brewitem = 1, food=5}, + stack_max = 64, +}) diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_healing.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_healing.png new file mode 100644 index 0000000000000000000000000000000000000000..66bdbe0065be22e8cb94da875e61db61ee8da2bc GIT binary patch literal 1261 zcmds#y=#+E6vj_Xs%a%1vf0p3{D6vr;z4jwNhQTpN({9_9fX4PAa$wOK~zvgs7e)! z8aUw4!O0ppm0`P#Z4UckOwev8*#utAm9+x5Cb$QaTFYA3~fk5%OkniMvY~v z9znt%+M+U3bL0xUpuncOsUt@ujR3%f;|LmV5hd~fCT=4RFu^b!f*N9g#!X;>1C5~# zX^#=bX>6m$a!d?C!XMhAGWQr@8h=oviN-wBkOC^@9^*|>24hMmrkxB2a`F(vPgvm~ zb%HcL2TTd!!Bc9LzQlk2n!0$opD07KWAzij_%GMrhFW^7(>U8bQ#*N{sCOlv%!6IM zCHy%zQXLvUaQo%zi^B5We6F!)%k$HBXP3GsuHPA2-O*lYPA$Cp+O91%=W;h@4sIXa zwDzoZ8 GYkvT-_G^3q literal 0 HcmV?d00001 From cae4940e702918a83baa704820ad2e99488c9251 Mon Sep 17 00:00:00 2001 From: bzoss Date: Tue, 26 May 2020 18:10:20 -0400 Subject: [PATCH 09/14] Updated a few simple potions. TODO: Stop fuel burn once the potion is complete. --- mods/ITEMS/mcl_brewing/init.lua | 109 +++++++++++------- mods/ITEMS/mcl_potions/init.lua | 18 ++- .../textures/mcl_potions_weakness.png | Bin 0 -> 1260 bytes 3 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 mods/ITEMS/mcl_potions/textures/mcl_potions_weakness.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 3657b10b..75f04df9 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -75,23 +75,35 @@ local function brewable(inv) local ingredient = inv:get_stack("input",1):get_name() local stands = {"","",""} + local stand_size = inv:get_size("stand") - for i=1,3 do + for i=1,stand_size do local bottle = inv:get_stack("stand", i):get_name() + stands[i] = bottle -- initialize the stand - if ingredient == "mcl_nether:nether_wart_item" and bottle == "mcl_potions:potion_river_water" or "mcl_potions:potion_water" then - stands[i] = "mcl_potions:potion_awkward" + if bottle == "mcl_potions:potion_river_water" or bottle == "mcl_potions:potion_water" then + if ingredient == "mcl_nether:nether_wart_item" then + stands[i] = "mcl_potions:potion_awkward" + elseif ingredient == "mcl_potions:fermented_spider_eye" then + stands[i] = "mcl_potions:weakness" + end + + elseif bottle == "mcl_potions:potion_awkward" then + if ingredient == "mcl_potions:speckled_melon" then + stands[i] = "mcl_potions:healing" + end end end - - for i=1,3 do - if stands[i] then return stands end + -- if any stand holds a new potion, return the list of new potions + for i=1,stand_size do + if stands[i] ~= inv:get_stack("stand", i):get_name() then + return stands + end end return false - end @@ -101,7 +113,7 @@ local function brewing_stand_timer(pos, elapsed) local fuel_time = meta:get_float("fuel_time") or 0 local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 - local BREW_TIME = 10 + local BREW_TIME = 30 -- all brews take max of 10 local input_item = meta:get_string("input_item") or "" @@ -124,11 +136,12 @@ local function brewing_stand_timer(pos, elapsed) stand_list = inv:get_list("stand") fuel_list = inv:get_list("fuel") - -- TODO fix this function to check for change in stand content... + -- TODO ... fix this. Goal is to reset the process if the stand changes -- for i=1, inv:get_size("stand", i) do -- reset the process due to change - -- if stand_list[i]:get_name() ~= stand_list[i] then + -- local _name = inv:get_stack("stand", i):get_name() + -- if _name ~= stand_list[i] then -- stand_timer = 0 - -- stand_list[i] = stand_list[i]:get_name() + -- stand_list[i] = _name -- update = true -- need to update the stand with new data -- end -- end @@ -139,39 +152,58 @@ local function brewing_stand_timer(pos, elapsed) fuel_time = fuel_time + elapsed - -- Replace the stand item with the brew result - if brew_output and (stand_timer >= BREW_TIME) then - for i=1, inv:get_size("stand", i) do - if brew_output[i] then - inv:set_stack("stand", i, brew_output[i]) + if brew_output then + + stand_timer = stand_timer + elapsed + -- Replace the stand item with the brew result + if stand_timer >= BREW_TIME then + + local input_count = inv:get_stack("input",1):get_count() + if (input_count-1) ~= 0 then + inv:set_stack("input",1,inv:get_stack("input",1):get_name().." "..(input_count-1)) + else + inv:set_stack("input",1,"") end + + for i=1, inv:get_size("stand") do + if brew_output[i] then + inv:set_stack("stand", i, brew_output[i]) + end + end + stand_timer = 0 + update = false -- stop the update if brew is complete end + end else --get more fuel from fuel_list local after_fuel - - -- print(inv:get_stack("fuel",1):get_name()) - fuel, after_fuel = minetest.get_craft_result({method="fuel", width=1, items=fuel_list}) - if fuel.time == 0 then --no valid fuel, reset timers + if brew_output then - fuel_totaltime = 0 + if fuel.time == 0 then --no valid fuel, reset timers + + fuel_totaltime = 0 + stand_timer = 0 + + -- only allow blaze powder fuel + elseif inv:get_stack("fuel",1):get_name() == "mcl_mobitems:blaze_powder" then -- Grab another fuel + inv:set_stack("fuel", 1, after_fuel.items[1]) + + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + stand_timer = stand_timer + elapsed + + end + + else --if no output potion, stop the process + fuel_total_time = 0 stand_timer = 0 - - -- only allow blaze powder fuel - elseif inv:get_stack("fuel",1):get_name() == "mcl_mobitems:blaze_powder" then -- Grab another fuel - inv:set_stack("fuel", 1, after_fuel.items[1]) - - update = true - - fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) - stand_timer = stand_timer + elapsed end - + fuel_time = 0 end elapsed = 0 end @@ -180,11 +212,11 @@ local function brewing_stand_timer(pos, elapsed) fuel_totaltime = fuel.time end - for i=1, inv:get_size("stand", i) do - if stand_list[i]:is_empty() then - stand_timer = 0 - end - end + -- for i=1, inv:get_size("stand") do + -- if stand_list[i]:is_empty() then + -- stand_timer = 0 + -- end + -- end --update formspec local formspec = brewing_formspec @@ -193,8 +225,8 @@ local function brewing_stand_timer(pos, elapsed) if fuel_totaltime ~= 0 then local fuel_percent = math.floor(fuel_time/fuel_totaltime*100) - local brew_percent = math.floor(stand_timer/BREW_TIME*100) % 100 - formspec = active_brewing_formspec(fuel_percent, stand_timer) + local brew_percent = math.floor(stand_timer/BREW_TIME*100) + formspec = active_brewing_formspec(fuel_percent, brew_percent*2 % 100) -- swap_node(pos, "mcl_brewing:stand_active") result = true else @@ -340,7 +372,6 @@ local brewing_stand_def = { sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 1200, _mcl_hardness = 5, - _mcl_after_falling = damage_brewing_stand_by_falling, after_dig_node = function(pos, oldnode, oldmetadata, digger) local meta = minetest.get_meta(pos) diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 622b08e8..44b8885a 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -290,7 +290,7 @@ minetest.register_craftitem("mcl_potions:potion_thick", { inventory_image = potion_image("#0000FF"), wield_image = potion_image("#0000FF"), -- TODO: Reveal item when it's actually useful - groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=1 }, + groups = {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0 }, on_place = minetest.item_eat(0, "mcl_potions:glass_bottle"), on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) @@ -300,7 +300,7 @@ minetest.register_craftitem("mcl_potions:speckled_melon", { _doc_items_longdesc = S("This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else."), stack_max = 64, -- TODO: Reveal item when it's actually useful - groups = { brewitem = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1 }, + groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 1 }, inventory_image = "mcl_potions_melon_speckled.png", }) @@ -319,7 +319,7 @@ minetest.register_craftitem("mcl_potions:dragon_breath", { wield_image = "mcl_potions_dragon_breath.png", inventory_image = "mcl_potions_dragon_breath.png", -- TODO: Reveal item when it's actually useful - groups = { brewitem = 1, not_in_creative_inventory = 1 }, + groups = { brewitem = 1, not_in_creative_inventory = 0 }, stack_max = 64, }) @@ -330,5 +330,15 @@ minetest.register_craftitem("mcl_potions:healing", { inventory_image = "mcl_potions_healing.png", -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, food=5}, - stack_max = 64, + stack_max = 1, +}) + +minetest.register_craftitem("mcl_potions:weakness", { + description = S("Healing Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_weakness.png", + inventory_image = "mcl_potions_weakness.png", + -- TODO: Reveal item when it's actually useful + groups = { brewitem = 1, food=-5}, + stack_max = 1, }) diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_weakness.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_weakness.png new file mode 100644 index 0000000000000000000000000000000000000000..524ebeea6aa747c33bfc685e2cd55aac676e3ebe GIT binary patch literal 1260 zcmds#y=zoa5XEQn2quB7f=zUdZebxJKD3J#+aT{@f35MYi)DQzSZUPG&Xbf#g zdyFVfV;eP=V`2yr{?HbcxyJz0_=6%%H0GIx6i_Mm7;lO)7*jei?PNHRlZP07!U_ke z6QuDuU`hxNo>HsyCI0i*{!?dqiE?zTR^0)N|8o6psD(K_gtMJT%0r_>`4{ozrdH<* z`15?F)L&nB`Pr+D`Bt%`z0vpP$w>PNo&WlL*YxArTQfcD%V!UN-ubiKTy$k};!ERQ zZ9c2NK0eeOp_^@`>&^1iXno(Z+}+`}o|6mj4DTHu%YNxrnjtZEx+*K>9&{O4}Qq{7PmSJE5A+t9)Ei+EL8@orF)wj G=l%evV{E$s literal 0 HcmV?d00001 From c9ff19d02a7f719d4b01a3fe5ffb5999c7b81882 Mon Sep 17 00:00:00 2001 From: bzoss Date: Tue, 26 May 2020 18:15:50 -0400 Subject: [PATCH 10/14] Some small doc string updates. --- mods/ITEMS/mcl_brewing/init.lua | 2 +- mods/ITEMS/mcl_potions/init.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 75f04df9..fef771f1 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -226,7 +226,7 @@ local function brewing_stand_timer(pos, elapsed) if fuel_totaltime ~= 0 then local fuel_percent = math.floor(fuel_time/fuel_totaltime*100) local brew_percent = math.floor(stand_timer/BREW_TIME*100) - formspec = active_brewing_formspec(fuel_percent, brew_percent*2 % 100) + formspec = active_brewing_formspec(fuel_percent, brew_percent*4 % 100) -- swap_node(pos, "mcl_brewing:stand_active") result = true else diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 44b8885a..6d770482 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -320,7 +320,7 @@ minetest.register_craftitem("mcl_potions:dragon_breath", { inventory_image = "mcl_potions_dragon_breath.png", -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, not_in_creative_inventory = 0 }, - stack_max = 64, + stack_max = 1, }) minetest.register_craftitem("mcl_potions:healing", { @@ -334,7 +334,7 @@ minetest.register_craftitem("mcl_potions:healing", { }) minetest.register_craftitem("mcl_potions:weakness", { - description = S("Healing Potion"), + description = S("Weakness Potion"), _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_weakness.png", inventory_image = "mcl_potions_weakness.png", From 36ce478361786f9d7ed7d208dc83c8ac32424e60 Mon Sep 17 00:00:00 2001 From: bzoss Date: Tue, 26 May 2020 21:07:07 -0400 Subject: [PATCH 11/14] Comment some broken bits. --- mods/ITEMS/mcl_brewing/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index fef771f1..81a514ec 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -118,7 +118,7 @@ local function brewing_stand_timer(pos, elapsed) local input_item = meta:get_string("input_item") or "" local stand_timer = meta:get_float("stand_timer") or 0 - local stand_items = meta:get_string("stand_items") or {"","",""} + -- local stand_items = meta:get_list("stand_items") or {"","",""} local inv = meta:get_inventory() @@ -139,10 +139,11 @@ local function brewing_stand_timer(pos, elapsed) -- TODO ... fix this. Goal is to reset the process if the stand changes -- for i=1, inv:get_size("stand", i) do -- reset the process due to change -- local _name = inv:get_stack("stand", i):get_name() - -- if _name ~= stand_list[i] then + -- if _name ~= stand_items[i] then -- stand_timer = 0 - -- stand_list[i] = _name + -- stand_items[i] = _name -- update = true -- need to update the stand with new data + -- return 1 -- end -- end @@ -238,7 +239,7 @@ local function brewing_stand_timer(pos, elapsed) meta:set_float("fuel_totaltime", fuel_totaltime) meta:set_float("fuel_time", fuel_time) meta:set_float("stand_timer", stand_timer) - -- meta:set_string("stand_items", stand_list) + -- meta:set_list("stand_items", stand_list) meta:set_string("formspec", formspec) return result From 2ad28f1fac60254e8d6f4dcca32f3fec4dc097b7 Mon Sep 17 00:00:00 2001 From: bzoss Date: Tue, 26 May 2020 21:16:52 -0400 Subject: [PATCH 12/14] Update with sounds, and turn on some potion items. --- mods/ITEMS/mcl_brewing/init.lua | 2 ++ mods/ITEMS/mcl_potions/init.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 81a514ec..91ac7a9d 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -168,7 +168,9 @@ local function brewing_stand_timer(pos, elapsed) for i=1, inv:get_size("stand") do if brew_output[i] then + minetest.sound_play("mcl_potions_bottle_fill", {pos=pos, gain=0.4, max_hear_range=16}, true) inv:set_stack("stand", i, brew_output[i]) + minetest.sound_play("mcl_potions_bottle_pour", {pos=pos, gain=0.6, max_hear_range=16}, true) end end stand_timer = 0 diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 6d770482..bac4fdd9 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -8,7 +8,7 @@ minetest.register_craftitem("mcl_potions:fermented_spider_eye", { wield_image = "mcl_potions_spider_eye_fermented.png", inventory_image = "mcl_potions_spider_eye_fermented.png", -- TODO: Reveal item when it's actually useful - groups = { brewitem = 1, not_in_creative_inventory = 1, not_in_craft_guide = 1 }, + groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 0 }, stack_max = 64, }) From 861aedbfa34aa0eae11d54dffc0be1bf9105085b Mon Sep 17 00:00:00 2001 From: bzoss Date: Wed, 27 May 2020 18:36:10 -0400 Subject: [PATCH 13/14] Updated potion offering - moved alchemy matrix to mcl_potions --- mods/ITEMS/mcl_brewing/init.lua | 26 +++------- mods/ITEMS/mcl_potions/init.lua | 48 ++++++++++++++++-- .../textures/mcl_potions_night_vision.png | Bin 0 -> 1260 bytes .../textures/mcl_potions_swiftness.png | Bin 0 -> 1262 bytes 4 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 mods/ITEMS/mcl_potions/textures/mcl_potions_night_vision.png create mode 100644 mods/ITEMS/mcl_potions/textures/mcl_potions_swiftness.png diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 91ac7a9d..3b8577a3 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -1,5 +1,4 @@ local S = minetest.get_translator("mcl_brewing_stand") -local NAME_COLOR = "#FFFF4C" local function active_brewing_formspec(fuel_percent, item_percent) @@ -76,32 +75,23 @@ local function brewable(inv) local ingredient = inv:get_stack("input",1):get_name() local stands = {"","",""} local stand_size = inv:get_size("stand") + local was_alchemy = true for i=1,stand_size do local bottle = inv:get_stack("stand", i):get_name() - stands[i] = bottle -- initialize the stand - if bottle == "mcl_potions:potion_river_water" or bottle == "mcl_potions:potion_water" then - if ingredient == "mcl_nether:nether_wart_item" then - stands[i] = "mcl_potions:potion_awkward" - elseif ingredient == "mcl_potions:fermented_spider_eye" then - stands[i] = "mcl_potions:weakness" - end - - elseif bottle == "mcl_potions:potion_awkward" then - if ingredient == "mcl_potions:speckled_melon" then - stands[i] = "mcl_potions:healing" - end + local alchemy = mcl_potions.get_alchemy(ingredient, bottle) + if alchemy then + stands[i] = alchemy + else + stands[i] = bottle + was_alchemy = false end end -- if any stand holds a new potion, return the list of new potions - for i=1,stand_size do - if stands[i] ~= inv:get_stack("stand", i):get_name() then - return stands - end - end + if was_alchemy then return stands end return false end diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index bac4fdd9..ac2d1c26 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -299,7 +299,6 @@ minetest.register_craftitem("mcl_potions:speckled_melon", { description = S("Glistering Melon"), _doc_items_longdesc = S("This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else."), stack_max = 64, - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 1 }, inventory_image = "mcl_potions_melon_speckled.png", }) @@ -318,7 +317,6 @@ minetest.register_craftitem("mcl_potions:dragon_breath", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_dragon_breath.png", inventory_image = "mcl_potions_dragon_breath.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, not_in_creative_inventory = 0 }, stack_max = 1, }) @@ -328,7 +326,6 @@ minetest.register_craftitem("mcl_potions:healing", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_healing.png", inventory_image = "mcl_potions_healing.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, food=5}, stack_max = 1, }) @@ -338,7 +335,50 @@ minetest.register_craftitem("mcl_potions:weakness", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_weakness.png", inventory_image = "mcl_potions_weakness.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, food=-5}, stack_max = 1, }) + +minetest.register_craftitem("mcl_potions:night_vision", { + description = S("Night Vision Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_night_vision.png", + inventory_image = "mcl_potions_night_vision.png", + groups = { brewitem = 1, food=0}, + stack_max = 1, +}) + +minetest.register_craftitem("mcl_potions:swiftness", { + description = S("Swiftness Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_swiftness.png", + inventory_image = "mcl_potions_swiftness.png", + groups = { brewitem = 1, food=0}, + stack_max = 1, +}) + +mcl_potions = {} + +-- Compare two ingredients for compatable alchemy +function mcl_potions.get_alchemy(ingr, pot) + + if pot == "mcl_potions:potion_river_water" or pot == "mcl_potions:potion_water" then + if ingr == "mcl_nether:nether_wart_item" then + return "mcl_potions:potion_awkward" + elseif ingr == "mcl_potions:fermented_spider_eye" then + return "mcl_potions:weakness" + end + + elseif pot == "mcl_potions:potion_awkward" then + if ingr == "mcl_potions:speckled_melon" then + return "mcl_potions:healing" + elseif ingr == "mcl_farming:carrot_item_gold" then + return "mcl_potions:night_vision" + elseif ingr == "mcl_core:sugar" then + return "mcl_potions:swiftness" + end + + else + return false + end +end diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_night_vision.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_night_vision.png new file mode 100644 index 0000000000000000000000000000000000000000..9a4ee688c9394bacd4292c0ad7e2fa430e357b89 GIT binary patch literal 1260 zcmds#(Tj{>6vofAX=lgIxZr}FmfahrQKpUyYSpr{cBZsVYqq!$g`<_CY>KE|7ecwz zbnaGBBAW}lMX61jrB2kAB3WC?g$pYsMbq(|_b+he!du@roq6B)Ilt#Q-?jSiP(Ig{ zBcgn*S{cD_PdwQ+yeqe_KPPIV`o6{>N+Ko_A|)~+kBXUCh?UrgJvN0&ghWY<#N(_o zsgNqEk$PM;CKECxGctz~Ig<;yk{dY+XhRxWxQx>tePRi-G8?l;TT~(}%3>@Y6xdW@ zRaRs5fWlc5Hf1w52P3Ys3%jx#JGz1zVt@uEu&{^5(1tX$aM{C9)L1HFA|C$G7L}@~ ziF()t1vX8^Ow8dPP&g~D;wBDz$OD+TjX2;R5O4@;hyfauI0_ClhBl<3<&j)$qsB5- zk09X>ZBd!2IdX+vP+(Kt)R7~SMgZW#aRd#wh!S}K6Solum|z$VK@BlL<0i1cfyU5= zw8x0zG`3M=IVOf6;SX(5nR^T{jXx;TL}Q+5NCA~{kMX7`gE6HO(@us1IeCcTC#-Og zIzbwr1Ez%V;3>6AU*bQ19lvm~nTKWZPluk&EQ}3g&s}ZRdQbmY+vxl~@NE3y z^p;lU-p*~S%LN*pIKQrZe{sW`^+WxoChc8nD>dIveVm&e-F$4}OXk)_%H3`K?0?bz z;P9)XkEgoYA9a77tZyp6@BGkP>{&B^VCl~1U)xtEn;pw^>HEyew`~4YSgH*USElzI Gx%>wc!)$*5 literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_swiftness.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_swiftness.png new file mode 100644 index 0000000000000000000000000000000000000000..4dbf788a61fd9379fceb236ecc919e1f3ffdd65b GIT binary patch literal 1262 zcmds#v1^lI5XLW!k{V1D2N7GPZbDqjE#e?5sck?@jD;dth@v+HheFjsS|}n?#bO6b zI1yB^qJn~pU24f7)#AAbh2WrrlMXsKWDq@{d;bC_2VeNUaCzVNx!?2Lcda@+SjcbB z6H%cuRIcH-FP`o!-sK0^SBSDyJu)(Yl8A|fNQsQdqhcl&VkI_Wk4<3`AyE<|@i?nY zDx^wkq#jp|$%IVFjLe}#&g4R_^>GT=p;&HI|B)h=)J4MWrfg zq8@fZflX5}6LYu+6wZpPxQW9a@&G1oBM$fn1RR1IVt@uEj)DV?p$%zhc_bIxsIg4d zBS`o|TU2Ihj$C0E6xdWZb>xVo5dgSw96`e^qC_6R#BIa@CK!f8P(uvRxCtz9pfR)| z?J=S_jcwFej)@^i_(NM%<{kq~;}427(U@l%Qb48LW4tNKU`*-6w3FdLP99?T2`e0= zPLRgufGHt7cuK9(m-x?LXD?0eAj;7B+VF8;{Fm!*L+x4B2F`96A38BXRD2arX1-MH z!Jjjg^1+e4voGJjE42E$*Vmi%E@>?F&nzxawHFpI-f7&ppZjw2=;Y}BEqzx$?>e=w z{o>YdTDvf|wcbllrr+$|d~Bh2ZQJ01Qj-pU%$Az%d!Jg%qbp}#f6YAHN%=>=I@7DU zr+0rmKUtm4ekgXPA8#t3yZUXeFqb>M=X-5p>UO8~cHMZ_&+JlZzJF|En5qm6m!BP~ GU;YD}6mCfX literal 0 HcmV?d00001 From bcdb37800db5914fa0b97b451c8100d0e2a07bfd Mon Sep 17 00:00:00 2001 From: bzoss Date: Wed, 27 May 2020 21:15:46 -0400 Subject: [PATCH 14/14] Shift to table lookup for brewing combinations. Fix issue with brewing only if all slots filled. --- mods/ITEMS/mcl_brewing/init.lua | 16 +++++-------- mods/ITEMS/mcl_potions/init.lua | 41 +++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/mods/ITEMS/mcl_brewing/init.lua b/mods/ITEMS/mcl_brewing/init.lua index 3b8577a3..b87ae04a 100755 --- a/mods/ITEMS/mcl_brewing/init.lua +++ b/mods/ITEMS/mcl_brewing/init.lua @@ -73,9 +73,9 @@ end local function brewable(inv) local ingredient = inv:get_stack("input",1):get_name() - local stands = {"","",""} + local stands = {} local stand_size = inv:get_size("stand") - local was_alchemy = true + local was_alchemy = {false,false,false} for i=1,stand_size do @@ -84,14 +84,16 @@ local function brewable(inv) local alchemy = mcl_potions.get_alchemy(ingredient, bottle) if alchemy then stands[i] = alchemy + was_alchemy[i] = true else stands[i] = bottle - was_alchemy = false end end -- if any stand holds a new potion, return the list of new potions - if was_alchemy then return stands end + for i=1,table.getn(was_alchemy) do + if was_alchemy[i] then return stands end + end return false end @@ -205,12 +207,6 @@ local function brewing_stand_timer(pos, elapsed) fuel_totaltime = fuel.time end - -- for i=1, inv:get_size("stand") do - -- if stand_list[i]:is_empty() then - -- stand_timer = 0 - -- end - -- end - --update formspec local formspec = brewing_formspec diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index ac2d1c26..fe2e84a2 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -359,26 +359,33 @@ minetest.register_craftitem("mcl_potions:swiftness", { mcl_potions = {} +function key_in_table(table,key) + return table[key] ~= nil +end + +local water_table = { + ["mcl_nether:nether_wart_item"] = "mcl_potions:potion_awkward", + ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness", +} +local awkward_table = { + ["mcl_potions:speckled_melon"] = "mcl_potions:healing", + ["mcl_farming:carrot_item_gold"] = "mcl_potions:night_vision", + ["mcl_core:sugar"] = "mcl_potions:swiftness", +} +local output_table = { + ["mcl_potions:potion_river_water"] = water_table, + ["mcl_potions:potion_water"] = water_table, + ["mcl_potions:potion_awkward"] = awkward_table, +} + -- Compare two ingredients for compatable alchemy function mcl_potions.get_alchemy(ingr, pot) - if pot == "mcl_potions:potion_river_water" or pot == "mcl_potions:potion_water" then - if ingr == "mcl_nether:nether_wart_item" then - return "mcl_potions:potion_awkward" - elseif ingr == "mcl_potions:fermented_spider_eye" then - return "mcl_potions:weakness" + if output_table[pot] ~= nil then + local brew_table = output_table[pot] + if brew_table[ingr] ~= nil then + return brew_table[ingr] end - - elseif pot == "mcl_potions:potion_awkward" then - if ingr == "mcl_potions:speckled_melon" then - return "mcl_potions:healing" - elseif ingr == "mcl_farming:carrot_item_gold" then - return "mcl_potions:night_vision" - elseif ingr == "mcl_core:sugar" then - return "mcl_potions:swiftness" - end - - else - return false end + return false end