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 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