Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Illuna-Minetest/wardrobe
1 result
Show changes
Commits on Source (1)
......@@ -42,6 +42,9 @@ local function changeWardrobeSkin(playerName, skin)
error("unknown skin '"..skin.."'");
end;
-- clear homedecor wardrobe skin
player:set_attribute("homedecor:player_skin", "")
wardrobe.playerSkins[playerName] = skin;
wardrobe.storage.savePlayerSkins();
end;
......@@ -80,11 +83,23 @@ local SKIN_CHANGE_METHODS =
{
required_mods = { '3d_armor' },
initSkin = nil,
initSkin = function(player)
local playerName = player:get_player_name()
if not playerName or playerName == "" then return end
local skin = wardrobe.playerSkins[playerName]
if not skin or not wardrobe.skinNames[skin] then return end
armor.textures[playerName].skin = skin
armor:update_player_visuals(player)
end,
changeSkin = function(playerName, skin)
changeWardrobeSkin(playerName, skin);
armor.textures[playerName].skin = skin;
if skin == nil then
-- character creator skin will restore at next login, or now by pressing 'Done' in character creator
armor.textures[playerName].skin = armor.default_skin..".png"
else
armor.textures[playerName].skin = skin
end
end,
updateSkin = function(player)
......
......@@ -14,7 +14,7 @@ local function showForm(player, page)
local s = 1 + SKINS_PER_PAGE*(page-1);
local e = math.min(s+SKINS_PER_PAGE-1, n);
local fs = "size[5,10]";
local fs = "size[5,11]";
fs = fs.."label[0,0;Change Into:]";
for i = s, e do
local slot = i-s+1;
......@@ -29,6 +29,7 @@ local function showForm(player, page)
if page < nPages then
fs = fs.."button_exit[4,9;1,1;n:p"..(page+1)..";next]";
end
fs = fs.."button_exit[0,10;5,1;c:c;clear]";
minetest.show_formspec(playerName, FORM_NAME, fs);
end
......@@ -52,6 +53,9 @@ minetest.register_on_player_receive_fields(
elseif action == "s" then
wardrobe.changePlayerSkin(playerName, value);
return;
elseif action == "c" then
wardrobe.changePlayerSkin(playerName, nil);
return;
end
end
end
......