master
Zughy 2022-04-23 16:36:45 +02:00
parent f8e8c13e7b
commit 50941a2357
2 changed files with 10 additions and 15 deletions

View File

@ -217,6 +217,12 @@ end
-----------------GETTERS----------------------
----------------------------------------------
function skins_collectible.get_skins()
return loaded_skins
end
function skins_collectible.get_skin(skin_ID)
return loaded_skins[skin_ID]
end
@ -236,13 +242,6 @@ end
function skins_collectible.get_loaded_skins_amount()
return #loaded_skins
end
----------------------------------------------
-----------------SETTERS----------------------

View File

@ -7,9 +7,8 @@ local locked_skin = {
description = "???",
model = nil,
texture = nil,
tier = 1,
img = "blank.png",
author = ""
preview = "skinsc_locked.png",
splash_art = "blank.png"
}
@ -18,14 +17,12 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
local selected_skin
local skin_bg
local skin_preview
local skin_stars
-- se la skin è bloccata o meno
if skin_ID == "LOCKED" then
selected_skin = locked_skin
skin_bg = "skinsc_gui_bg_locked.png"
skin_preview = "skinsc_locked.png"
skin_stars = "blank.png"
minetest.get_player_by_name(p_name):get_meta():set_int("skins_collectible:selected_skin_ID", -1) -- metadato per "Wear" se è bloccata
@ -33,7 +30,6 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
else
selected_skin = skins_collectible.get_skin(skin_ID)
skin_bg = "skinsc_gui_bg_tier" .. selected_skin.tier .. ".png"
skin_preview = selected_skin.preview
skin_stars = "skinsc_gui_stars" .. selected_skin.tier .. ".png"
minetest.get_player_by_name(p_name):get_meta():set_int("skins_collectible:selected_skin_ID", skin_ID) -- metadato per "Wear" se è sbloccata
@ -46,7 +42,7 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
"image[0,0;16.15,9.24;skinsc_gui_overlay.png]",
-- skin selezionata
"image[1.95,0.85;1.05,0.15;" .. skin_stars .. "]",
"image[1.77,0.92;1.5,2.34;" .. skin_preview .. "]",
"image[1.77,0.92;1.5,2.34;" .. selected_skin.preview .. "]",
-- pulsanti
"image_button[1.87,3.2;1.3,0.3;skinsc_gui_button_wear.png;WEAR;" .. S("Wear") .. "]",
"image_button[0.2,6;0.7,1.2;skinsc_gui_arrow_left.png;GO_LEFT;]",
@ -56,7 +52,7 @@ function skins_collectible.get_formspec(p_name, page, skin_ID)
"hypertext[3.6,1.25;3.2,2;desc; <global size=12 font=mono halign=justify color=#a05b53><i>" .. FS(selected_skin.description) .. "</i>]"
}
local skins_amount = skins_collectible.get_loaded_skins_amount()
local skins_amount = #skins_collectible.get_skins()
local first_idx = (math.floor(skins_amount / 16) + 1) * page
-- creo slot in matrice x*y