0
0
Fork 0

mcl_skins now obeys file name conventions

This commit is contained in:
Wuzzy 2019-03-05 14:26:44 +01:00
parent 9e84763478
commit 918c408e4d
6 changed files with 11 additions and 6 deletions

View File

@ -20,8 +20,8 @@ while true do
skin = "character" skin = "character"
mcl_skins.has_preview[id] = true mcl_skins.has_preview[id] = true
else else
skin = "character_" .. id skin = "mcl_skins_character_" .. id
local preview = "player_" .. id local preview = "mcl_skins_player_" .. id
-- Does skin file exist? -- Does skin file exist?
f = io.open(mcl_skins.modpath .. "/textures/" .. skin .. ".png") f = io.open(mcl_skins.modpath .. "/textures/" .. skin .. ".png")
@ -46,7 +46,12 @@ while true do
mcl_skins.list[id] = skin mcl_skins.list[id] = skin
-- does metadata exist for that skin file ? -- does metadata exist for that skin file ?
f = io.open(mcl_skins.modpath .. "/meta/" .. skin .. ".txt") if id == 0 then
metafile = "mcl_skins_character.txt"
else
metafile = "mcl_skins_character_"..id..".txt"
end
f = io.open(mcl_skins.modpath .. "/meta/" .. metafile)
if f then if f then
data = minetest.deserialize("return {" .. f:read('*all') .. "}") data = minetest.deserialize("return {" .. f:read('*all') .. "}")
@ -89,12 +94,12 @@ mcl_skins.set_player_skin = function(player, skin_id)
skin = "character" skin = "character"
preview = "player" preview = "player"
else else
skin = "character_" .. tostring(skin_id) skin = "mcl_skins_character_" .. tostring(skin_id)
if mcl_skins.has_preview[skin_id] then if mcl_skins.has_preview[skin_id] then
preview = "player_" .. tostring(skin_id) preview = "mcl_skins_player_" .. tostring(skin_id)
else else
-- Fallback preview image if preview image is missing -- Fallback preview image if preview image is missing
preview = "player_dummy" preview = "mcl_skins_player_dummy"
end end
end end
skin_file = skin .. ".png" skin_file = skin .. ".png"

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 982 B

After

Width:  |  Height:  |  Size: 982 B