1
0
Fork 0

Updated potion offering - moved alchemy matrix to mcl_potions

This commit is contained in:
bzoss 2020-05-27 18:36:10 -04:00
parent 2ad28f1fac
commit 861aedbfa3
4 changed files with 52 additions and 22 deletions

View File

@ -1,5 +1,4 @@
local S = minetest.get_translator("mcl_brewing_stand") local S = minetest.get_translator("mcl_brewing_stand")
local NAME_COLOR = "#FFFF4C"
local function active_brewing_formspec(fuel_percent, item_percent) 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 ingredient = inv:get_stack("input",1):get_name()
local stands = {"","",""} local stands = {"","",""}
local stand_size = inv:get_size("stand") local stand_size = inv:get_size("stand")
local was_alchemy = true
for i=1,stand_size do for i=1,stand_size do
local bottle = inv:get_stack("stand", i):get_name() 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 local alchemy = mcl_potions.get_alchemy(ingredient, bottle)
if ingredient == "mcl_nether:nether_wart_item" then if alchemy then
stands[i] = "mcl_potions:potion_awkward" stands[i] = alchemy
elseif ingredient == "mcl_potions:fermented_spider_eye" then else
stands[i] = "mcl_potions:weakness" stands[i] = bottle
end was_alchemy = false
elseif bottle == "mcl_potions:potion_awkward" then
if ingredient == "mcl_potions:speckled_melon" then
stands[i] = "mcl_potions:healing"
end
end end
end end
-- if any stand holds a new potion, return the list of new potions -- if any stand holds a new potion, return the list of new potions
for i=1,stand_size do if was_alchemy then return stands end
if stands[i] ~= inv:get_stack("stand", i):get_name() then
return stands
end
end
return false return false
end end

View File

@ -299,7 +299,6 @@ minetest.register_craftitem("mcl_potions:speckled_melon", {
description = S("Glistering 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."), _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, stack_max = 64,
-- TODO: Reveal item when it's actually useful
groups = { brewitem = 1, not_in_creative_inventory = 0, 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", inventory_image = "mcl_potions_melon_speckled.png",
}) })
@ -318,7 +317,6 @@ minetest.register_craftitem("mcl_potions:dragon_breath", {
_doc_items_longdesc = brewhelp, _doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_dragon_breath.png", wield_image = "mcl_potions_dragon_breath.png",
inventory_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 }, groups = { brewitem = 1, not_in_creative_inventory = 0 },
stack_max = 1, stack_max = 1,
}) })
@ -328,7 +326,6 @@ minetest.register_craftitem("mcl_potions:healing", {
_doc_items_longdesc = brewhelp, _doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_healing.png", wield_image = "mcl_potions_healing.png",
inventory_image = "mcl_potions_healing.png", inventory_image = "mcl_potions_healing.png",
-- TODO: Reveal item when it's actually useful
groups = { brewitem = 1, food=5}, groups = { brewitem = 1, food=5},
stack_max = 1, stack_max = 1,
}) })
@ -338,7 +335,50 @@ minetest.register_craftitem("mcl_potions:weakness", {
_doc_items_longdesc = brewhelp, _doc_items_longdesc = brewhelp,
wield_image = "mcl_potions_weakness.png", wield_image = "mcl_potions_weakness.png",
inventory_image = "mcl_potions_weakness.png", inventory_image = "mcl_potions_weakness.png",
-- TODO: Reveal item when it's actually useful
groups = { brewitem = 1, food=-5}, groups = { brewitem = 1, food=-5},
stack_max = 1, 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB