From 861aedbfa34aa0eae11d54dffc0be1bf9105085b Mon Sep 17 00:00:00 2001 From: bzoss Date: Wed, 27 May 2020 18:36:10 -0400 Subject: [PATCH] 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 91ac7a9d04..3b8577a31c 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 bac4fdd967..ac2d1c26c0 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -299,7 +299,6 @@ minetest.register_craftitem("mcl_potions:speckled_melon", { description = S("Glistering Melon"), _doc_items_longdesc = S("This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else."), stack_max = 64, - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, not_in_creative_inventory = 0, not_in_craft_guide = 1 }, inventory_image = "mcl_potions_melon_speckled.png", }) @@ -318,7 +317,6 @@ minetest.register_craftitem("mcl_potions:dragon_breath", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_dragon_breath.png", inventory_image = "mcl_potions_dragon_breath.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, not_in_creative_inventory = 0 }, stack_max = 1, }) @@ -328,7 +326,6 @@ minetest.register_craftitem("mcl_potions:healing", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_healing.png", inventory_image = "mcl_potions_healing.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, food=5}, stack_max = 1, }) @@ -338,7 +335,50 @@ minetest.register_craftitem("mcl_potions:weakness", { _doc_items_longdesc = brewhelp, wield_image = "mcl_potions_weakness.png", inventory_image = "mcl_potions_weakness.png", - -- TODO: Reveal item when it's actually useful groups = { brewitem = 1, food=-5}, stack_max = 1, }) + +minetest.register_craftitem("mcl_potions:night_vision", { + description = S("Night Vision Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_night_vision.png", + inventory_image = "mcl_potions_night_vision.png", + groups = { brewitem = 1, food=0}, + stack_max = 1, +}) + +minetest.register_craftitem("mcl_potions:swiftness", { + description = S("Swiftness Potion"), + _doc_items_longdesc = brewhelp, + wield_image = "mcl_potions_swiftness.png", + inventory_image = "mcl_potions_swiftness.png", + groups = { brewitem = 1, food=0}, + stack_max = 1, +}) + +mcl_potions = {} + +-- Compare two ingredients for compatable alchemy +function mcl_potions.get_alchemy(ingr, pot) + + if pot == "mcl_potions:potion_river_water" or pot == "mcl_potions:potion_water" then + if ingr == "mcl_nether:nether_wart_item" then + return "mcl_potions:potion_awkward" + elseif ingr == "mcl_potions:fermented_spider_eye" then + return "mcl_potions:weakness" + end + + elseif pot == "mcl_potions:potion_awkward" then + if ingr == "mcl_potions:speckled_melon" then + return "mcl_potions:healing" + elseif ingr == "mcl_farming:carrot_item_gold" then + return "mcl_potions:night_vision" + elseif ingr == "mcl_core:sugar" then + return "mcl_potions:swiftness" + end + + else + return false + end +end diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_night_vision.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_night_vision.png new file mode 100644 index 0000000000000000000000000000000000000000..9a4ee688c9394bacd4292c0ad7e2fa430e357b89 GIT binary patch literal 1260 zcmds#(Tj{>6vofAX=lgIxZr}FmfahrQKpUyYSpr{cBZsVYqq!$g`<_CY>KE|7ecwz zbnaGBBAW}lMX61jrB2kAB3WC?g$pYsMbq(|_b+he!du@roq6B)Ilt#Q-?jSiP(Ig{ zBcgn*S{cD_PdwQ+yeqe_KPPIV`o6{>N+Ko_A|)~+kBXUCh?UrgJvN0&ghWY<#N(_o zsgNqEk$PM;CKECxGctz~Ig<;yk{dY+XhRxWxQx>tePRi-G8?l;TT~(}%3>@Y6xdW@ zRaRs5fWlc5Hf1w52P3Ys3%jx#JGz1zVt@uEu&{^5(1tX$aM{C9)L1HFA|C$G7L}@~ ziF()t1vX8^Ow8dPP&g~D;wBDz$OD+TjX2;R5O4@;hyfauI0_ClhBl<3<&j)$qsB5- zk09X>ZBd!2IdX+vP+(Kt)R7~SMgZW#aRd#wh!S}K6Solum|z$VK@BlL<0i1cfyU5= zw8x0zG`3M=IVOf6;SX(5nR^T{jXx;TL}Q+5NCA~{kMX7`gE6HO(@us1IeCcTC#-Og zIzbwr1Ez%V;3>6AU*bQ19lvm~nTKWZPluk&EQ}3g&s}ZRdQbmY+vxl~@NE3y z^p;lU-p*~S%LN*pIKQrZe{sW`^+WxoChc8nD>dIveVm&e-F$4}OXk)_%H3`K?0?bz z;P9)XkEgoYA9a77tZyp6@BGkP>{&B^VCl~1U)xtEn;pw^>HEyew`~4YSgH*USElzI Gx%>wc!)$*5 literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_potions/textures/mcl_potions_swiftness.png b/mods/ITEMS/mcl_potions/textures/mcl_potions_swiftness.png new file mode 100644 index 0000000000000000000000000000000000000000..4dbf788a61fd9379fceb236ecc919e1f3ffdd65b GIT binary patch literal 1262 zcmds#v1^lI5XLW!k{V1D2N7GPZbDqjE#e?5sck?@jD;dth@v+HheFjsS|}n?#bO6b zI1yB^qJn~pU24f7)#AAbh2WrrlMXsKWDq@{d;bC_2VeNUaCzVNx!?2Lcda@+SjcbB z6H%cuRIcH-FP`o!-sK0^SBSDyJu)(Yl8A|fNQsQdqhcl&VkI_Wk4<3`AyE<|@i?nY zDx^wkq#jp|$%IVFjLe}#&g4R_^>GT=p;&HI|B)h=)J4MWrfg zq8@fZflX5}6LYu+6wZpPxQW9a@&G1oBM$fn1RR1IVt@uEj)DV?p$%zhc_bIxsIg4d zBS`o|TU2Ihj$C0E6xdWZb>xVo5dgSw96`e^qC_6R#BIa@CK!f8P(uvRxCtz9pfR)| z?J=S_jcwFej)@^i_(NM%<{kq~;}427(U@l%Qb48LW4tNKU`*-6w3FdLP99?T2`e0= zPLRgufGHt7cuK9(m-x?LXD?0eAj;7B+VF8;{Fm!*L+x4B2F`96A38BXRD2arX1-MH z!Jjjg^1+e4voGJjE42E$*Vmi%E@>?F&nzxawHFpI-f7&ppZjw2=;Y}BEqzx$?>e=w z{o>YdTDvf|wcbllrr+$|d~Bh2ZQJ01Qj-pU%$Az%d!Jg%qbp}#f6YAHN%=>=I@7DU zr+0rmKUtm4ekgXPA8#t3yZUXeFqb>M=X-5p>UO8~cHMZ_&+JlZzJF|En5qm6m!BP~ GU;YD}6mCfX literal 0 HcmV?d00001