Transfer Inventory, player_skin to sfinv API. Improve other formspecs
This commit is contained in:
parent
2a76000473
commit
bac3013770
@ -9,12 +9,7 @@ local function handle_inventory(player)
|
|||||||
if player and player:is_player() then
|
if player and player:is_player() then
|
||||||
armor:save_armor_inventory(player)
|
armor:save_armor_inventory(player)
|
||||||
armor:set_player_armor(player)
|
armor:set_player_armor(player)
|
||||||
if creative and creative.is_enabled_for and
|
sfinv.set_player_inventory_formspec(player)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ function sfinv.register_page(name, def)
|
|||||||
|
|
||||||
sfinv.pages[name] = def
|
sfinv.pages[name] = def
|
||||||
def.name = name
|
def.name = name
|
||||||
table.insert(sfinv.pages_unordered, def)
|
|
||||||
|
local unpages = sfinv.pages_unordered
|
||||||
|
unpages[#unpages+1] = def
|
||||||
end
|
end
|
||||||
|
|
||||||
function sfinv.override_page(name, def)
|
function sfinv.override_page(name, def)
|
||||||
@ -39,7 +41,7 @@ end]]
|
|||||||
local theme_inv = [[
|
local theme_inv = [[
|
||||||
list[current_player;main;0.01,4.51;9,3;9]
|
list[current_player;main;0.01,4.51;9,3;9]
|
||||||
list[current_player;main;0.01,7.74;9,1;]
|
list[current_player;main;0.01,7.74;9,1;]
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function sfinv.make_formspec(_, _, content, show_inv, size)
|
function sfinv.make_formspec(_, _, content, show_inv, size)
|
||||||
local tmp = {
|
local tmp = {
|
||||||
@ -173,11 +175,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.quit then
|
|
||||||
sfinv.reset_context(player)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get Context
|
-- Get Context
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local context = sfinv.contexts[name]
|
local context = sfinv.contexts[name]
|
||||||
|
@ -2,6 +2,6 @@ dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
|||||||
|
|
||||||
sfinv.register_page("sfinv:inventory", {
|
sfinv.register_page("sfinv:inventory", {
|
||||||
get = function(_, player, context)
|
get = function(_, player, context)
|
||||||
return sfinv.make_formspec(player, context, [[ ]], true)
|
return sfinv.make_formspec(player, context, "")
|
||||||
end
|
end
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user