mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-05 07:13:51 +01:00
[mcl_inventory] fix warnings
This commit is contained in:
parent
52b1473657
commit
8baea02f24
@ -7,7 +7,7 @@ local players = {}
|
|||||||
-- Containing all the items for each Creative Mode tab
|
-- Containing all the items for each Creative Mode tab
|
||||||
local inventory_lists = {}
|
local inventory_lists = {}
|
||||||
|
|
||||||
local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
--local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
||||||
|
|
||||||
-- Create tables
|
-- 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"}
|
||||||
@ -161,7 +161,7 @@ end
|
|||||||
|
|
||||||
local function init(player)
|
local function init(player)
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
local inv = minetest.create_detached_inventory("creative_"..playername, {
|
minetest.create_detached_inventory("creative_"..playername, {
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
if minetest.is_creative_enabled(playername) then
|
if minetest.is_creative_enabled(playername) then
|
||||||
return count
|
return count
|
||||||
@ -203,7 +203,7 @@ local offset = {} -- string offset:
|
|||||||
local boffset = {} --
|
local boffset = {} --
|
||||||
local hoch = {}
|
local hoch = {}
|
||||||
local filtername = {}
|
local filtername = {}
|
||||||
local bg = {}
|
--local bg = {}
|
||||||
|
|
||||||
local noffset_x_start = -0.24
|
local noffset_x_start = -0.24
|
||||||
local noffset_x = noffset_x_start
|
local noffset_x = noffset_x_start
|
||||||
@ -257,7 +257,6 @@ hoch["mobs"] = "_down"
|
|||||||
hoch["matr"] = "_down"
|
hoch["matr"] = "_down"
|
||||||
hoch["inv"] = "_down"
|
hoch["inv"] = "_down"
|
||||||
|
|
||||||
filtername = {}
|
|
||||||
filtername["blocks"] = S("Building Blocks")
|
filtername["blocks"] = S("Building Blocks")
|
||||||
filtername["deco"] = S("Decoration Blocks")
|
filtername["deco"] = S("Decoration Blocks")
|
||||||
filtername["redstone"] = S("Redstone")
|
filtername["redstone"] = S("Redstone")
|
||||||
@ -272,9 +271,9 @@ filtername["brew"] = S("Brewing")
|
|||||||
filtername["matr"] = S("Materials")
|
filtername["matr"] = S("Materials")
|
||||||
filtername["inv"] = S("Survival Inventory")
|
filtername["inv"] = S("Survival Inventory")
|
||||||
|
|
||||||
local dark_bg = "crafting_creative_bg_dark.png"
|
--local dark_bg = "crafting_creative_bg_dark.png"
|
||||||
|
|
||||||
local function reset_menu_item_bg()
|
--[[local function reset_menu_item_bg()
|
||||||
bg["blocks"] = dark_bg
|
bg["blocks"] = dark_bg
|
||||||
bg["deco"] = dark_bg
|
bg["deco"] = dark_bg
|
||||||
bg["redstone"] = dark_bg
|
bg["redstone"] = dark_bg
|
||||||
@ -289,11 +288,11 @@ local function reset_menu_item_bg()
|
|||||||
bg["matr"] = dark_bg
|
bg["matr"] = dark_bg
|
||||||
bg["inv"] = dark_bg
|
bg["inv"] = dark_bg
|
||||||
bg["default"] = dark_bg
|
bg["default"] = dark_bg
|
||||||
end
|
end]]
|
||||||
|
|
||||||
|
|
||||||
mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_size, show, page, filter)
|
mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_size, show, page, filter)
|
||||||
reset_menu_item_bg()
|
--reset_menu_item_bg()
|
||||||
pagenum = math.floor(pagenum) or 1
|
pagenum = math.floor(pagenum) or 1
|
||||||
|
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
@ -310,7 +309,6 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
|||||||
end
|
end
|
||||||
local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1))
|
local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1))
|
||||||
local name = "nix"
|
local name = "nix"
|
||||||
local formspec = ""
|
|
||||||
local main_list
|
local main_list
|
||||||
local listrings = "listring[detached:creative_"..playername..";main]"..
|
local listrings = "listring[detached:creative_"..playername..";main]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
@ -322,7 +320,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
|||||||
players[playername].page = page
|
players[playername].page = page
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
bg[name] = "crafting_creative_bg.png"
|
--bg[name] = "crafting_creative_bg.png"
|
||||||
|
|
||||||
local inv_bg = "crafting_inventory_creative.png"
|
local inv_bg = "crafting_inventory_creative.png"
|
||||||
if name == "inv" then
|
if name == "inv" then
|
||||||
@ -428,7 +426,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
|||||||
caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]"
|
caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
formspec = "size[10,9.3]"..
|
local formspec = "size[10,9.3]"..
|
||||||
"no_prepend[]"..
|
"no_prepend[]"..
|
||||||
mcl_vars.gui_nonbg..mcl_vars.gui_bg_color..
|
mcl_vars.gui_nonbg..mcl_vars.gui_bg_color..
|
||||||
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
|
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
|
||||||
@ -560,7 +558,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Figure out current scroll bar from formspec
|
-- Figure out current scroll bar from formspec
|
||||||
local formspec = player:get_inventory_formspec()
|
--local formspec = player:get_inventory_formspec()
|
||||||
|
|
||||||
local start_i = players[name].start_i
|
local start_i = players[name].start_i
|
||||||
|
|
||||||
@ -628,7 +626,7 @@ if minetest.is_creative_enabled("") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
mcl_inventory.update_inventory_formspec = function(player)
|
mcl_inventory.update_inventory_formspec = function(player)
|
||||||
local page = nil
|
local page
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
@ -639,7 +637,7 @@ if minetest.is_creative_enabled("") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Figure out current scroll bar from formspec
|
-- Figure out current scroll bar from formspec
|
||||||
local formspec = player:get_inventory_formspec()
|
--local formspec = player:get_inventory_formspec()
|
||||||
local start_i = players[name].start_i
|
local start_i = players[name].start_i
|
||||||
|
|
||||||
local inv_size
|
local inv_size
|
||||||
|
@ -3,8 +3,8 @@ local F = minetest.formspec_escape
|
|||||||
|
|
||||||
mcl_inventory = {}
|
mcl_inventory = {}
|
||||||
|
|
||||||
local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
--local mod_player = minetest.get_modpath("mcl_player") ~= nil
|
||||||
local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil
|
--local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil
|
||||||
|
|
||||||
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
|
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
|
||||||
function return_item(itemstack, dropper, pos, inv)
|
function return_item(itemstack, dropper, pos, inv)
|
||||||
@ -60,8 +60,6 @@ local function set_inventory(player, armor_change_only)
|
|||||||
inv:set_width("craft", 2)
|
inv:set_width("craft", 2)
|
||||||
inv:set_size("craft", 4)
|
inv:set_size("craft", 4)
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
|
|
||||||
-- Show armor and player image
|
-- Show armor and player image
|
||||||
local player_preview
|
local player_preview
|
||||||
if minetest.settings:get_bool("3d_player_preview", true) then
|
if minetest.settings:get_bool("3d_player_preview", true) then
|
||||||
@ -180,6 +178,6 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if minetest.is_creative_enabled("") then
|
if minetest.is_creative_enabled("") then
|
||||||
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
|
dofile(minetest.get_modpath(minetest.get_current_modname()).."/creative.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name = mcl_inventory
|
name = mcl_inventory
|
||||||
author = BlockMen
|
author = BlockMen
|
||||||
description = Adds the player inventory and creative inventory.
|
description = Adds the player inventory and creative inventory.
|
||||||
depends = mcl_init, mcl_formspec
|
depends = mcl_init, mcl_formspec, mcl_player
|
||||||
optional_depends = mcl_player, _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting
|
optional_depends = _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user