Transfer Inventory, player_skin to sfinv API. Improve other formspecs

This commit is contained in:
MoNTE48 2020-03-07 17:11:56 +01:00
parent 2a76000473
commit bac3013770
3 changed files with 9 additions and 17 deletions

View File

@ -9,12 +9,7 @@ local function handle_inventory(player)
if player and player:is_player() then
armor:save_armor_inventory(player)
armor:set_player_armor(player)
if creative and creative.is_enabled_for and
creative.is_enabled_for(player) then
local set = set_creative_inventory and set_creative_inventory(player)
else
local set = set_survival_inventory and set_survival_inventory(player)
end
sfinv.set_player_inventory_formspec(player)
end
end

View File

@ -13,7 +13,9 @@ function sfinv.register_page(name, def)
sfinv.pages[name] = def
def.name = name
table.insert(sfinv.pages_unordered, def)
local unpages = sfinv.pages_unordered
unpages[#unpages+1] = def
end
function sfinv.override_page(name, def)
@ -39,7 +41,7 @@ end]]
local theme_inv = [[
list[current_player;main;0.01,4.51;9,3;9]
list[current_player;main;0.01,7.74;9,1;]
]]
]]
function sfinv.make_formspec(_, _, content, show_inv, size)
local tmp = {
@ -173,11 +175,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return false
end
if fields.quit then
sfinv.reset_context(player)
return false
end
-- Get Context
local name = player:get_player_name()
local context = sfinv.contexts[name]

View File

@ -2,6 +2,6 @@ dofile(minetest.get_modpath("sfinv") .. "/api.lua")
sfinv.register_page("sfinv:inventory", {
get = function(_, player, context)
return sfinv.make_formspec(player, context, [[ ]], true)
return sfinv.make_formspec(player, context, "")
end
})