mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-01-09 23:50:17 +01:00
finished work on sfinv support
This commit is contained in:
parent
fa54b0ec62
commit
2b6a395a49
@ -59,7 +59,7 @@ local function get_formspec(player, context)
|
|||||||
local x = (index_p-1) % 8
|
local x = (index_p-1) % 8
|
||||||
local y
|
local y
|
||||||
if index_p > 8 then
|
if index_p > 8 then
|
||||||
y = 5
|
y = 5.5
|
||||||
else
|
else
|
||||||
y = 3.2
|
y = 3.2
|
||||||
end
|
end
|
||||||
@ -91,38 +91,28 @@ local function get_formspec(player, context)
|
|||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sfinv.register_page("skins:overview", {
|
sfinv.register_page("skins:overview", {
|
||||||
title = "Skins",
|
title = "Skins",
|
||||||
get = function(self, player, context)
|
get = function(self, player, context)
|
||||||
print(dump(context))
|
|
||||||
return sfinv.make_formspec(player, context, get_formspec(player, context))
|
return sfinv.make_formspec(player, context, get_formspec(player, context))
|
||||||
end
|
end,
|
||||||
})
|
on_player_receive_fields = function(self, player, context, fields)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- click button handlers
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if fields.skins then
|
|
||||||
-- unified_inventory.set_inventory_formspec(player, "craft")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for field, _ in pairs(fields) do
|
for field, _ in pairs(fields) do
|
||||||
local current = string.split(field, "$", 2)
|
local current = string.split(field, "$", 2)
|
||||||
if current[1] == "skins_set" then
|
if current[1] == "skins_set" then
|
||||||
skins.set_player_skin(player, skins_reftab[tonumber(current[2])].skin)
|
skins.set_player_skin(player, skins_reftab[tonumber(current[2])].skin)
|
||||||
-- unified_inventory.set_inventory_formspec(player, "skins")
|
sfinv.set_player_inventory_formspec(player)
|
||||||
return
|
return
|
||||||
elseif current[1] == "skins_page" then
|
elseif current[1] == "skins_page" then
|
||||||
-- unified_inventory.set_inventory_formspec(player, "skins_page$"..current[2])
|
context.skins_page = tonumber(current[2])
|
||||||
|
sfinv.set_player_inventory_formspec(player)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fields.skins_selpg then
|
if fields.skins_selpg then
|
||||||
local page = dropdown_values[fields.skins_selpg]
|
context.skins_page = tonumber(dropdown_values[fields.skins_selpg])
|
||||||
-- unified_inventory.set_inventory_formspec(player, "skins_page$"..(page))
|
sfinv.set_player_inventory_formspec(player)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user