diff options
author | Alexander Weber <web.alexander@web.de> | 2018-02-13 22:31:44 +0100 |
---|---|---|
committer | sofar <sofar+github@foo-projects.org> | 2018-02-19 11:18:18 -0800 |
commit | 5498faa88aff6893ee68fa4d6da83f0d5d3a24da (patch) | |
tree | 315502f521a67b914278675be6b0f10eebc0855e /sfinv_page.lua | |
parent | 51b6cf2e3a6d0c2fb054863714abdae9d69aadd1 (diff) |
consolidate redundant skinsinfo formspec code
Diffstat (limited to 'sfinv_page.lua')
-rw-r--r-- | sfinv_page.lua | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/sfinv_page.lua b/sfinv_page.lua index 1d63163..ab9cb3c 100644 --- a/sfinv_page.lua +++ b/sfinv_page.lua @@ -1,33 +1,10 @@ -local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() -else - S = function(s) return s end -end +local S = skins.S -- generate the current formspec local function get_formspec(player, context) local name = player:get_player_name() local skin = skins.get_player_skin(player) - 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 - if m_author ~= "" then - formspec = formspec.."label[2,1;"..S("Author")..": "..minetest.formspec_escape(m_author).."]" - end - if m_license ~= "" then - formspec = formspec.."label[2,1.5;"..S("License")..": "..minetest.formspec_escape(m_license).."]" - end + local formspec = skins.get_skin_info_formspec(skin) local page = 1 if context.skins_page then |