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 000000000..4c84c7290 --- /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 000000000..6342364f4 --- /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 000000000..ebc741c00 --- /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 000000000..de164abf9 --- /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!ia0y~yU=RRdCT0c(hNQXTpBNYzI0Jk_T$PoTb#!!0O-+Al zsT(mcFz9=_IEGX(COa@i21`mvY!0(B*wEI-X0V~P&5uElTVjU*OGpk=1gDFk^9wH( aV+MH(Mp0}$_yCc6F&9DzNt$%x&lFY{v=GrkEyT_y#rO;& zmX;Pa>hVo{hml!dz)tYM7R&CQGxN>9-QT-2S--FjU^3sC9soF(b$S`V)f;CIfo1IP z9?g&{fPjDooLv=)D4`nV9I`-y0vmMhsvtsw8gia?p@|l{(S`vROjvNkPUEy@<#89B zIVo1Ds;iu_tRjmlcF|FxDzT(emmE=D)vQ)^SG$aIm04D~%Z}uDAfvJg$3Z5M>D4U9 zQ1&E6HtG0NWhYThId;2p*kU)^H0Yv9i*DM15m;1kwBWFbB`Ts@<)F%7Dy>^|$mN(y zwd8>8%Gj2=)s`WbOj&Zv4(6o7+zn`lde|{fgTo0S4w+67?PL-iOyjh6BFb%MPRebx ztIf9B-F5;T@khl-G?xOA>j{MaWE#?`3`pA*?&g;n|k={ z`9)v}PY(7D{h!v~lHK~IM*!9qJI9ZKjjvftC)YQ&09=_*w~sbY?tgx{y17{UaQyn( tCr)-(-h6p~YjJ*c<k44ofy`glX=O&z+jOY z;hE;^%b>-;z`()4*q+J20#d@jz#zo{0!#~-;35JGm=SD{r1;$66ATOt1)eUBAr^vH zCpdB)P~c(7ji35|{-03q7Qxx;ns!d9;+%E&?2(|l!mPE|dA`gst%#o)TddF%DtY$J z(&;RxWY`O)Gnyoa9^_Y1?NGcEncmItIl}tjxe}&1iv&~7v@8jKz#pWYP}U{Ka4Bo< d#g2c!tC*W_spehvXVM0_!PC{xWt~$(69C>oNXGyG 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|2q?S0LMRuLqh2x%eS7h5%M*{aU3~97Fv|F)mX(a5eX+QStaJXCtvb4blS$* zd|RXBOS43FwjRfpR%y2^n$^bW9>3h*aPQ~+!~1!?et+K%LHKL!*tY`!pcQb`Hw*yK z005{~R{;RzSrjAy09>)B0xkpx11kW4I#43Sf^De;0N4k%18IQ#M;aQG|J&8u5>Kls z2S7DEz}Fj@uC!c(PG;Nh8q>?yl*0SH(TghfMmdJm7xwQBcIwRML{C@o)E6hy%$TUt z*W;Opb+~d@%h_0|B)c;HhJ!5U$)s*y_u6C~>Na+evgjqzpQLNp+z>k%cdWoOU z_A$fix|5`dU&O;tdS>2wENzZv7xKrT2i!&**H6=6vd##xrEh=BH%I;$pq(=?(V{@Y0wwfE+g(6uS2|rKt^d|*3FB5;nD(pmO!?jBxW_t1Ixc8^^|p5C8JR(* ze8gwYr~$kI(1jGIDa6t|^=r5M=hvNh@>H`tRJi9xFEImW%a2A5oNxEXEw?@WdP!*5 zGaC3#5+d9qlH3t#_{Yi;vYIfKS`->X=Po&yvmW8|+nR}I4O&_HkccBm_v%9gRpXo} z@%v`tU`M23l<)_sHr9(yJ(nrJ6#bc8lq5He+!+Qkefz*Fj4&gi zJQv_u)G0zOU7bKIswB7DU`_qz8q4RN1|OMjsrUzLQ(yk6?UlH*waN%LCbT{OT~S=S znXE{En0F>|P!Q^p*fdCgVNuHwT_4^j^1L>bKO#y7D(-=Pgs2fW|#3J%O2^}2?gjNY4Ceo_H(*Ds1< z$$F8<`3@So472mSe}6jlfpy$VS3Rh!pWuk=MgEI-^SVA$G0EMj9vH+un1`Zkk2t>cXO)srORR`Vl|huoL=Cl4OY(-_VYcHT^UXVAFY%z(j=NnT0O8L4BT zL_+78)ATwz`(`LToYNbPxkyE*sAx%lD4j^aulAgb{P<$x+u~z(W7v=hw&sB&_#2Q9$u5#-)TEowyu5gGK$m8MAKH25Up^}%Gsb-YYxdk=R z{!C(>I^Db=TD)a`kBO&ziy{ND>z*;4*g#@Aid S+-VT;EN*8Ir?3iWB_isr>}*oZ8(3U| zO(3O(g~BQF2BL3aAtUqq0(OE2wpe!eoSAR--R}6o%JS7^04t;I%{>5XSr_L4+`N5d zADGAP&cPN^1rQL>fU~PY5hYZkoI@5!P+)`3T@^$~P(#ksE;P|XH`*}Zf(Z+5*lC>B ztUT_5GbhC=Rdtm!mQ`d?#V$H3R3(;F>XIX>tD4oS?rN7&t}@FiciE8~4`fs};W)@7 zGQFDR7|Ncc$R-_ss_Z1HDaUSC4qNPIn+9DpY0*tPFanDTjusp?u|!35s~l7rOr>>; z4!Imtsg@j&T^ZX_x7sq~k||4W*}d3p#39ouqMb~lgK3=BPDHuQ z%t^V8cD317yW38HL;O)OB$_;jkRoc}o_Gh8(Kyga+JoUp9y}!cK~@|Llk9v4JMip3 zqy9}jdGYcZFo)-R<9+|9^|xd|*4*)})eQi5Mw|Bz){h^by;)p8 zTAEF!*FP>^e*f^(&$ET|)7fOYc6j&4bnC;7*N2y0eY=43UthkT?kvnQdbBm(Jh}hq F?Qf6bLTdm3 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 6342364f4..dd7ba14e2 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 ebc741c00..56cf672ac 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_$LMi2F?JV5LaboWgQ(IQ&ZEQTIxm&3=I07E{-7;jL8m6 zk-?G@5}U)U3^ug2u^DV=ZS!Lgp)w3gGpYiM-;?CXsE`-SK!crgHFLz@MVkoi=7)!yw7EbJqPLf1CWT?%u=d0qk2N zi(Iv7{mTBtKDtbJpg!{2g4MsBoZMO{LYtv^lrx}t;2quXXDoTs^bVEd%NbitCF`m( zrne^4S-Q0L>pCHF_*56^Y$pVf#!kgxjF&m%kU4Fc)}X#FL=Mjgyh6~j(HVXt?Lq&07i=tCp8!J(Gs$VSBB$#fFfzo)boxdo?1c@9z(lqurTsv zzMoVk@E!ORZlZQ*q8L4mHH~-z-=5QLXHyA^rx&Rd^xDS?DlJedgT=lJ3LbIi%lCU- zx;J)fX%)^$uv@6%KA&@4%RTz-`$vhCF`X{$)B1Yjdb^bAbhG52q(8XK$5kJuRP7#} zt!HFH5QI8A?{{dDTvb()H(VwgmNxwRd(;R|P`h_ldKv^xmw05AWj2CNpfKqdH6-PY z-ke2d^a;vNS@`E?)=vWY@I&f2ql+b4p?zbsS0fC8z)>e#k~^bt$_sIhZF=P71N$8u zEs7NbznPX|8HI(`M65Eqs{|i4gx90RT^Rbfu~Chy#ys9cj|P|Cs4Fw@Aj^clR@Vc^ z=8wW-TYd>BJ6;c^pP#u`i~e9Dy06+T^8PNueUGTDjoy-wvSc6@ieI(T1=r^Pei2A1 zGMGO0Qe;n#a^E8|mwQ>@#`RHD@P&1rTTcOf(u*0nS5!-m`kAF&e=ct+pIo7~;a?uM z2zgpF`ylIPg!UjWa`krhz}uH~ZXp3~vH6s&ocWTs=-%C?GaUNu0JSbdVC50u?=AL#=d3;cwIfaaQ5A$rUPmvTKnHfT? zWT#lBizNy}d3B6Gy^5>;-iTVZk8I!T+H~26z!G8n(^5gu+1VLq)MHY)agL!0+hX~0 zwh(=`nguq|@jgvva;GNL?E$~Mj^r+|_Kf2p=MIHuu#S9cPK)Wk-0_1im7j>+p;$35Lxy#M zGrBxD4I$Xa{JG83$4_F%^<(FPp53$Kp>SclO~8?`5B;O_{sRF;DWL!W literal 1491 zcmd6n|2q?S0LMRuLqh2x%eS7h5%M*{aU3~97Fv|F)mX(a5eX+QStaJXCtvb4blS$* zd|RXBOS43FwjRfpR%y2^n$^bW9>3h*aPQ~+!~1!?et+K%LHKL!*tY`!pcQb`Hw*yK z005{~R{;RzSrjAy09>)B0xkpx11kW4I#43Sf^De;0N4k%18IQ#M;aQG|J&8u5>Kls z2S7DEz}Fj@uC!c(PG;Nh8q>?yl*0SH(TghfMmdJm7xwQBcIwRML{C@o)E6hy%$TUt z*W;Opb+~d@%h_0|B)c;HhJ!5U$)s*y_u6C~>Na+evgjqzpQLNp+z>k%cdWoOU z_A$fix|5`dU&O;tdS>2wENzZv7xKrT2i!&**H6=6vd##xrEh=BH%I;$pq(=?(V{@Y0wwfE+g(6uS2|rKt^d|*3FB5;nD(pmO!?jBxW_t1Ixc8^^|p5C8JR(* ze8gwYr~$kI(1jGIDa6t|^=r5M=hvNh@>H`tRJi9xFEImW%a2A5oNxEXEw?@WdP!*5 zGaC3#5+d9qlH3t#_{Yi;vYIfKS`->X=Po&yvmW8|+nR}I4O&_HkccBm_v%9gRpXo} z@%v`tU`M23l<)_sHr9(yJ(nrJ6#bc8lq5He+!+Qkefz*Fj4&gi zJQv_u)G0zOU7bKIswB7DU`_qz8q4RN1|OMjsrUzLQ(yk6?UlH*waN%LCbT{OT~S=S znXE{En0F>|P!Q^p*fdCgVNuHwT_4^j^1L>bKO#y7D(-=Pgs2fW|#3J%O2^}2?gjNY4Ceo_H(*Ds1< z$$F8<`3@So472mSe}6jlfpy$VS3Rh!pWuk=MgEI-^SVA$G0EMj9vH+un1`Zkk2t>cXO)srORR`Vl|huoL=Cl4OY(-_VYcHT^UXVAFY%z(j=NnT0O8L4BT zL_+78)ATwz`(`LToYNbPxkyE*sAx%lD4j^aulAgb{P<$x+u~z(W7v=hw&sB&_#2Q9$u5#-)TEowyu5gGK$m8MAKH25Up^}%Gsb-YYxdk=R z{!C(>I^Db=TD)a`kBO&ziy{ND>z*;4*g#@Aid S+-Hz7jM{;rey9v^Ab zEop?&jBX5L8Y#*0;4YQvpd4tDyLzP?Wk`E>5BGGZ{Do;3;gKGc-83C$c%~K&EMIMr1}Zh@b^M7{Lrun3am_ zu0T`N#m@CqIH(Zh(A7zzsZ6B9)mW{mh;-XEN5v$Pmh@yKGf4$l#4i;^qRO)fNumnw zinl;1jRhU0T^N?+!h^yuWXVA>iPU!>1&{nQ>fh9n(`P$@CX5YM>-X@dX& 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 deleted file mode 100755 index 4203949c6f94bd44a6281a343e3d2e8399ebc77c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 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 dd7ba14e2..4ba2b7e03 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#&r8)&5XFxOVS=xsMdC~77bHYKXmAm2Qj~lUkB3hX7eR}fMGGskg%wy9QBVej z*aY^2pk09xv?&P6LYPfK(87YCM~lEs(b5y=+dt4QXy7g`_uiRvKIdMkRrj~GcC-R$ zs|@rF0$8op(hQ($`>Hz7jM{;rey9v^Ab zEop?&jBX5L8Y#*0;4YQvpd4tDyLzP?Wk`E>5BGGZ{Do;3;gKGc-83C$c%~K&EMIMr1}Zh@b^M7{Lrun3am_ zu0T`N#m@CqIH(Zh(A7zzsZ6B9)mW{mh;-XEN5v$Pmh@yKGf4$l#4i;^qRO)fNumnw zinl;1jRhU0T^N?+!h^yuWXVA>iPU!>1&{nQ>fh9n(`P$@CX5YM>-X@dX& 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 100644 index 0000000000000000000000000000000000000000..0c15ddd8ad3d7497d363f5db40e4053229cd177a GIT binary patch literal 342 zcmV-c0jd6pP)Lk}*!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 4ba2b7e03..0e22b472f 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 zcmV;y06zbTP)>*kKg5%nJm_fh)y+-M7@?M$d;&&- vkFTom4w{J8-NIkZ(l)~EJ{~jYI%YTlrVDKoM%}Yo00000NkvXXu0mjfEX7K& 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 zcmV;z06qVSP)QFQdyOht*h$WQhsMdg+HqBFa_WQ||Qu#yLF37z6-BM3+MO wKeLcmkRn#hNA9w$6~c1b2Hos3o;tw}CxEM!uNytrDF6Tf07*qoM6N<$g3&cdVgLXD literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner.png new file mode 100644 index 0000000000000000000000000000000000000000..e2e8e8afeb20074143562bc5bf4e7722417e91de GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0y~yU|?flU=Zd2k(;mABrq^Aa29w(7BevL9RXp+soH$f z3=9meo-U3d5>ww^G-N!WAaLNoZz*SXz6mWXISbxcUo1;V$vKwdSV>F+^lCUY6>J=xJ#3=9kmp00i_>zopr01BHeI{*Lx literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner_active.png b/mods/ITEMS/mcl_brewing/textures/mcl_brewing_burner_active.png new file mode 100644 index 0000000000000000000000000000000000000000..93655b67322e5ed2a483a4017747af703f9682ea GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0y~yU|?flU=Zd2k(;mABrq^Aa29w(7BevL9RXp+soH$f z3=9nZo-U3d5>ww^+{oErAi{7_y!znWIZAsu{8T!aQ#i|oWFADj>gwq3{j_cmi=g0y zVz#AIrmV8L#@Tb5Z`SgbrSIQ;I3~Z3>#afjqJJKHAX!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 5123d8b74..dd863075e 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 4c84c7290..73f7dce82 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 0e22b472f..4b0a975a5 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 3e6aef485..0b4d47e0d 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 4b0a975a5..434309d16 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 434309d16..c535831f9 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 c535831f9..3657b10b5 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 dd863075e..622b08e82 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#zf0Cp6vm%7wbanTEngJr2N(rKhoGTCW4$a6VJDQpe^XY9WM9YbDrn(-0Oq2!!6D2%>Y{Z ztCb-DU0RKG04fh|yaehnI56A?l>rU}kN~wagE=f<38N0(;0_OX!l}Dq2uB1W5!BN( zq$2~FNP++jbTGgKsm5yUrpIZZ=BV5(%+ib+>t^oeVV>rciZBbe2#d6!M5S4}Wmu*q zjWC+gjbTh9C0QQar7|6q15I*QuXLjfY47ggp6-;tFzq5d(u1;_ro#-+^rRC`bGkE} z>7-x?mWOa;fMO#{9ul2l6ey%O%t!_iw4etgm_Z7&QgPiC zXo|YnxtG z7AU2$prf=4!;)NhQ22!`IVdKP`VOSvk$*=0n;JWRu>&Y!a;SEU|7ra#+4Acc2hcQ8 zJ$@EwUD7Ju+tFGEFx6k_9o~2I`SP=t#odkdgS$38J$ZX_p=spmt={ErD@(IuGcUfZ zR2OEa>aR`g-#W12=n^zFKAe(CC%lvG!|x 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 3657b10b5..75f04df9d 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 622b08e82..44b8885a4 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#&uhA}rE^5|w7@mSLHe zG{R^`H-<5dlw^5um&$Zd4m8PKz0!>`q`kX`d%9Ep!nBLLk%rCeq<*tkzUSy6u{yViHM9dNPukqyjABmx>}$D>N}8vNB$Z0Z))$!(``Tvj`sCz<9}LzOSW}34ghF4 zROvqgG(Xp>nOND}3gBFKxwE?F($kmgo2T0A>jpbsKOU+(9&=xw?U;Ntb91_7ZRO0t zPuqV~MiyKiANxG`wr{RfeRZsVWC%BE%hyIK6Gy6hmekxCsBJkh|MtM{(c#k1opG=2 z*1WM(SaIe1htjTP4~J)G4tK6<-nZ^u>Enj>2a6^*t)5zX{{E9KFTU-6U+P#m)zG^9 U>-ewHH& 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 75f04df9d..fef771f13 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 44b8885a4..6d7704821 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 fef771f13..81a514ec0 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 81a514ec0..91ac7a9d0 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 6d7704821..bac4fdd96 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 91ac7a9d0..3b8577a31 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 bac4fdd96..ac2d1c26c 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#(QD6P6vm&mwBLTVx!{7WvE3+5`PFejO^t1~mDZZAxDbUSQk12L+FS_bQtRAJ zQ6kHQtthp$j5<*(MKUYp!i7mm(R%cJ{R8flQ}4yw`@ZKq&*yos4)pibmmA9f>ic@T z1_88am8t=B-MaP+sK&sap>C)Qa3FvLsGS+iVF61Rb?63nc)$}*-3>!HA`pq7o~9uk z8OTHu1Zbdx0VYT_R%7X2FlDm4P8)Zm)cMtb;r~HL!7vYf}l-)EPW_YG2op74do#9L; z1w*hrgd+nK8(H#@=nSJ!X|RV{XE;Sp#~!MTpg^W+Y(`{8GKioBJs80ZQka#B>#jgk z)Wy#AR5+**e(eoFYfhvp)_V49?T7OHn=|!9XPT%!9#733?<}3YvfS5t z>ig=Ux?i17M;=UWTCTdgeap&91BOS>t*P9bU-x=#Pe8@yOig zs+;RkzO($J<9W^fgD($1nrN(f*!*Q|U_<3y-TT(2mQ}O+7H)s~xpir5ymk>6zfCQD SE!CftrM~X|uE|}8F8u}*!)$*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#u}jxc6vdDJ3QhW1G(@C@ZNaZa?h*}A@iP@l%mfJ%ens6u8Um{!6eJ=nk{lAb z5mb;-K|xC{CJtdqw zUDZASZCZ^b0M+}~7J(9a5A}CIWq<<#BtY%VU=9md!l*+xxWfaUaO!Rt!V!T;1obox z>BvAPk|00>9Skr*s2VsUIVv{`voxc|x|zFqn5Q|VBFw@q!XhmwQE8TL8J1~D zBaCKrV;Iv&NtOq9sZ0muK$G0nE8QqV+PizWr#s~@OuGn=^q}mf=`h1HJ?VtgobC)~ zIw=@}g-U}x)H=f{ays@O=B}6Gm=3BE$G1rW{|?HR9trj znxZatuBXC5g&>EnP7+OJA|0;AYE4C?+pak(CXuwHCnK3jD!?LssVEXvo<&F!Rd83l z1xjfw=qT;Nup}2A6n-H~4vI;nz5^+E 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 3b8577a31..b87ae04a1 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 ac2d1c26c..fe2e84a2d 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