0
0
Fork 0

Add potions/brewing to creative inventory

This commit is contained in:
Brandon 2020-06-28 09:38:06 -04:00
parent abd1b682cb
commit 44ee9cde86
5 changed files with 37 additions and 39 deletions

View File

@ -10,10 +10,8 @@ local inventory_lists = {}
local show_armor = minetest.get_modpath("mcl_armor") ~= nil
local mod_player = minetest.get_modpath("mcl_player") ~= nil
-- TODO: Brewing is disabled. Add brewing (uncommented code) when it is implemented properly
-- Create tables
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs",--[["brew",]]"matr","misc","all"}
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"}
for _, f in pairs(builtin_filter_ids) do
inventory_lists[f] = {}
end
@ -67,11 +65,10 @@ do
table.insert(inventory_lists["mobs"], name)
nonmisc = true
end
-- TODO: add brew
--if def.groups.brewitem then
--table.insert(inventory_lists["brew"], name)
--nonmisc = true
--end
if def.groups.brewitem then
table.insert(inventory_lists["brew"], name)
nonmisc = true
end
if def.groups.craftitem then
table.insert(inventory_lists["matr"], name)
nonmisc = true
@ -160,7 +157,7 @@ trash:set_size("main", 1)
local noffset = {} -- numeric tab offset
local offset = {} -- string offset:
local boffset = {} --
local boffset = {} --
local hoch = {}
local filtername = {}
local bg = {}
@ -182,6 +179,7 @@ next_noffset("blocks")
next_noffset("deco")
next_noffset("redstone")
next_noffset("rail")
next_noffset("brew")
next_noffset("misc")
next_noffset("nix", true)
@ -193,7 +191,6 @@ next_noffset("food")
next_noffset("tools")
next_noffset("combat")
next_noffset("mobs")
--next_noffset("brew") -- TODO: add brew
next_noffset("matr")
next_noffset("inv", true)
@ -206,6 +203,7 @@ hoch["blocks"] = ""
hoch["deco"] = ""
hoch["redstone"] = ""
hoch["rail"] = ""
hoch["brew"] = ""
hoch["misc"] = ""
hoch["nix"] = ""
hoch["default"] = ""
@ -213,7 +211,6 @@ hoch["food"] = "_down"
hoch["tools"] = "_down"
hoch["combat"] = "_down"
hoch["mobs"] = "_down"
--hoch["brew"] = "_down" -- TODO: add brew
hoch["matr"] = "_down"
hoch["inv"] = "_down"
@ -228,26 +225,26 @@ filtername["food"] = S("Foodstuffs")
filtername["tools"] = S("Tools")
filtername["combat"] = S("Combat")
filtername["mobs"] = S("Mobs")
--filtername["brew"] = S("Brewing") -- TODO: add brew
filtername["brew"] = S("Brewing")
filtername["matr"] = S("Materials")
filtername["inv"] = S("Survival Inventory")
local dark_bg = "crafting_creative_bg_dark.png"
local function reset_menu_item_bg()
bg["blocks"] = dark_bg
bg["deco"] = dark_bg
bg["redstone"] = dark_bg
bg["rail"] = dark_bg
bg["misc"] = dark_bg
bg["nix"] = dark_bg
bg["food"] = dark_bg
bg["tools"] = dark_bg
bg["combat"] = dark_bg
bg["blocks"] = dark_bg
bg["deco"] = dark_bg
bg["redstone"] = dark_bg
bg["rail"] = dark_bg
bg["misc"] = dark_bg
bg["nix"] = dark_bg
bg["food"] = dark_bg
bg["tools"] = dark_bg
bg["combat"] = dark_bg
bg["mobs"] = dark_bg
--bg["brew"] = dark_bg -- TODO: add brew
bg["matr"] = dark_bg
bg["inv"] = dark_bg
bg["brew"] = dark_bg
bg["matr"] = dark_bg
bg["inv"] = dark_bg
bg["default"] = dark_bg
end
@ -377,7 +374,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
tools = "mcl_core:axe_iron",
combat = "mcl_core:sword_gold",
mobs = "mobs_mc:cow",
brew = "mcl_potions:potion_water",
brew = "mcl_potions:water",
matr = "mcl_core:stick",
inv = "mcl_chests:chest",
}
@ -388,7 +385,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
else
bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png"
end
return
return
"style["..this_tab..";border=false;bgimg=;bgimg_pressed=]"..
"item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]"..
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" ..
@ -428,9 +425,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
"tooltip[combat;"..F(filtername["combat"]).."]"..
tab(name, "mobs") ..
"tooltip[mobs;"..F(filtername["mobs"]).."]"..
-- TODO: Add brew
--tab(name, "brew") ..
--"tooltip[brew;"..F(filtername["brew"]).."]"..
tab(name, "brew") ..
"tooltip[brew;"..F(filtername["brew"]).."]"..
tab(name, "matr") ..
"tooltip[matr;"..F(filtername["matr"]).."]"..
tab(name, "inv") ..
@ -504,12 +500,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if players[name].page == "mobs" then return end
set_inv_page("mobs",player)
page = "mobs"
--[[ TODO: add brew
elseif fields.brew then
if players[name].page == "brew" then return end
set_inv_page("brew",player)
page = "brew"
]]
elseif fields.matr then
if players[name].page == "matr" then return end
set_inv_page("matr",player)

View File

@ -3,3 +3,5 @@ mcl_formspec
mcl_player?
_mcl_autogroup?
mcl_armor?
mcl_brewing?
mcl_potions?

View File

@ -384,7 +384,7 @@ minetest.register_node("mcl_brewing:stand_000", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 0, not_in_craft_guide = 0},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 0, not_in_craft_guide = 0},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -469,7 +469,7 @@ minetest.register_node("mcl_brewing:stand_100", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -553,7 +553,7 @@ minetest.register_node("mcl_brewing:stand_010", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -637,7 +637,7 @@ minetest.register_node("mcl_brewing:stand_001", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -721,7 +721,7 @@ minetest.register_node("mcl_brewing:stand_110", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -805,7 +805,7 @@ minetest.register_node("mcl_brewing:stand_101", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -889,7 +889,7 @@ minetest.register_node("mcl_brewing:stand_011", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",
@ -973,7 +973,7 @@ minetest.register_node("mcl_brewing:stand_111", {
_doc_items_longdesc = S("The stand allows you to brew potions!"),
_doc_items_usagehelp = doc_string,
_tt_help = S("Brew Potions"),
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, deco_block=1, brewing_stand=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
groups = {pickaxey=1, material_stone=1, falling_node=1, crush_after_fall=1, brewitem=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
tiles = tiles,
drop = "mcl_brewing:stand",
paramtype = "light",

View File

@ -70,6 +70,7 @@ local function register_lingering(name, descr, color, def)
minetest.register_craftitem(id, {
description = descr,
inventory_image = lingering_image(color),
groups = {brewitem=1, not_in_creative_inventory=0},
on_use = function(item, placer, pointed_thing)
local velocity = 10
local dir = placer:get_look_dir();

View File

@ -12,6 +12,7 @@ local function register_splash(name, descr, color, def)
minetest.register_craftitem(id, {
description = descr,
inventory_image = splash_image(color),
groups = {brewitem=1, not_in_creative_inventory=0},
on_use = function(item, placer, pointed_thing)
local velocity = 10
local dir = placer:get_look_dir();