summaryrefslogtreecommitdiff
path: root/sfinv_page.lua
diff options
context:
space:
mode:
authorAlexander Weber <web.alexander@web.de>2017-06-18 23:15:58 +0200
committerAlexander Weber <web.alexander@web.de>2017-06-18 23:15:58 +0200
commit57b815f91ffd9bdd165c741350c6099f6b08685b (patch)
tree7070f5ff9fa564e68911defa017f328366f3d351 /sfinv_page.lua
parent920061c0f190d6e79bf6720c983bf1b24aba4bc7 (diff)
changes needed for character_creator support
Diffstat (limited to 'sfinv_page.lua')
-rw-r--r--sfinv_page.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/sfinv_page.lua b/sfinv_page.lua
index c462efe..4e429d1 100644
--- a/sfinv_page.lua
+++ b/sfinv_page.lua
@@ -9,15 +9,16 @@ end
local function get_formspec(player, context)
local name = player:get_player_name()
local skin = skins.get_player_skin(player)
-
- -- overview page
- local formspec = "image[0,.75;1,2;"..skin:get_preview().."]"
- .."label[6,.5;"..S("Raw texture")..":]"
- .."image[6,1;2,1;"..skin:get_texture().."]"
-
+ local texture = skin:get_texture()
local m_name = skin:get_meta_string("name")
local m_author = skin:get_meta_string("author")
local m_license = skin:get_meta_string("license")
+ -- overview page
+ local formspec = "image[0,.75;1,2;"..skin:get_preview().."]"
+ if texture then
+ formspec = formspec.."label[6,.5;"..S("Raw texture")..":]"
+ .."image[6,1;2,1;"..skin:get_texture().."]"
+ end
if m_name ~= "" then
formspec = formspec.."label[2,.5;"..S("Name")..": "..minetest.formspec_escape(m_name).."]"
end
@@ -62,10 +63,10 @@ local function get_formspec(player, context)
page_next = 1
end
local page_list = ""
- dropdown_values = {}
+ context.dropdown_values = {}
for pg=1, context.total_pages do
local pagename = S("Page").." "..pg.."/"..context.total_pages
- dropdown_values[pagename] = pg
+ context.dropdown_values[pagename] = pg
if pg > 1 then page_list = page_list.."," end
page_list = page_list..pagename
end
@@ -106,7 +107,7 @@ sfinv.register_page("skins:overview", {
end
end
if fields.skins_selpg then
- context.skins_page = tonumber(dropdown_values[fields.skins_selpg])
+ context.skins_page = tonumber(context.dropdown_values[fields.skins_selpg])
sfinv.set_player_inventory_formspec(player)
return
end