Tweak skin selection dialog
This commit is contained in:
parent
e66d211cf7
commit
dfbbdcb9ea
@ -16,7 +16,7 @@ local timer = 10
|
|||||||
function player_skins.get_skin(name)
|
function player_skins.get_skin(name)
|
||||||
if not player_skins.skins[name] then
|
if not player_skins.skins[name] then
|
||||||
-- Fallback skin
|
-- Fallback skin
|
||||||
return "player_skins_male.png"
|
return "character.png"
|
||||||
else
|
else
|
||||||
return player_skins.skins[name]
|
return player_skins.skins[name]
|
||||||
end
|
end
|
||||||
@ -83,6 +83,8 @@ local components = {
|
|||||||
function player_skins.get_formspec(playername)
|
function player_skins.get_formspec(playername)
|
||||||
local form = default.ui.get_page("default:default")
|
local form = default.ui.get_page("default:default")
|
||||||
|
|
||||||
|
form = form .. "model[0,0.1;10.5,8;player_skins_skin_select_model;character.b3d;"..player_skins.skins[playername]..";0,180;false;false;0,0;0]"
|
||||||
|
|
||||||
--[[ TODO: Add skin selection buttons
|
--[[ TODO: Add skin selection buttons
|
||||||
local x, y = 0.1, 0.1
|
local x, y = 0.1, 0.1
|
||||||
for c,component in pairs(components) do
|
for c,component in pairs(components) do
|
||||||
@ -95,20 +97,20 @@ function player_skins.get_formspec(playername)
|
|||||||
y = y + 1
|
y = y + 1
|
||||||
end
|
end
|
||||||
]]
|
]]
|
||||||
form = form .. default.ui.button(1, 1, 3, 1, "skin_select_random", S("Random skin"))
|
form = form .. default.ui.button(2.75, 7.75, 3, 1, "player_skins_skin_select_random", S("New skin"))
|
||||||
|
|
||||||
return form
|
return form
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, form_name, fields)
|
minetest.register_on_player_receive_fields(function(player, form_name, fields)
|
||||||
if (form_name ~= "") or (not fields.skin_select_random) then
|
if not fields.player_skins_skin_select_random then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
player_skins.set_random_skin(name)
|
player_skins.set_random_skin(name)
|
||||||
local form = player_skins.get_formspec(name)
|
local form = player_skins.get_formspec(name)
|
||||||
player:set_inventory_formspec(form)
|
player:set_inventory_formspec(form)
|
||||||
minetest.show_formspec(name, "player_skins:player_skins", form)
|
minetest.show_formspec(name, "", form)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function player_skins.set_random_skin(name)
|
function player_skins.set_random_skin(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user