forked from mtcontrib/minetest-u_skinsdb
Add default; do not use character.x
This commit is contained in:
parent
29332b7cf3
commit
7c25df22dc
@ -5,6 +5,7 @@
|
|||||||
u_skins = {}
|
u_skins = {}
|
||||||
u_skins.modpath = minetest.get_modpath("u_skins")
|
u_skins.modpath = minetest.get_modpath("u_skins")
|
||||||
u_skins.file = minetest.get_worldpath().."/u_skins.mt"
|
u_skins.file = minetest.get_worldpath().."/u_skins.mt"
|
||||||
|
u_skins.default = "character_1"
|
||||||
u_skins.pages = {}
|
u_skins.pages = {}
|
||||||
u_skins.u_skins = {}
|
u_skins.u_skins = {}
|
||||||
u_skins.file_save = false
|
u_skins.file_save = false
|
||||||
@ -35,13 +36,10 @@ dofile(u_skins.modpath.."/players.lua")
|
|||||||
u_skins.update_player_skin = function(player)
|
u_skins.update_player_skin = function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not u_skins.is_skin(u_skins.u_skins[name]) then
|
if not u_skins.is_skin(u_skins.u_skins[name]) then
|
||||||
u_skins.u_skins[name] = "character_1"
|
u_skins.u_skins[name] = u_skins.default
|
||||||
end
|
end
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
visual = "mesh",
|
|
||||||
mesh = "character.x",
|
|
||||||
textures = {u_skins.u_skins[name]..".png"},
|
textures = {u_skins.u_skins[name]..".png"},
|
||||||
visual_size = {x=1, y=1},
|
|
||||||
})
|
})
|
||||||
u_skins.file_save = true
|
u_skins.file_save = true
|
||||||
end
|
end
|
||||||
@ -51,7 +49,7 @@ unified_inventory.register_page("u_skins", {
|
|||||||
get_formspec = function(player)
|
get_formspec = function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not u_skins.is_skin(u_skins.u_skins[name]) then
|
if not u_skins.is_skin(u_skins.u_skins[name]) then
|
||||||
u_skins.u_skins[name] = "character_1"
|
u_skins.u_skins[name] = u_skins.default
|
||||||
end
|
end
|
||||||
|
|
||||||
local formspec = ("background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
|
local formspec = ("background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
|
||||||
@ -158,7 +156,7 @@ end)
|
|||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if not u_skins.is_skin(u_skins.u_skins[player_name]) then
|
if not u_skins.is_skin(u_skins.u_skins[player_name]) then
|
||||||
u_skins.u_skins[player_name] = "character_1"
|
u_skins.u_skins[player_name] = u_skins.default
|
||||||
end
|
end
|
||||||
u_skins.update_player_skin(player)
|
u_skins.update_player_skin(player)
|
||||||
end)
|
end)
|
||||||
|
@ -30,7 +30,7 @@ u_skins.save = function()
|
|||||||
local output = io.open(u_skins.file, "w")
|
local output = io.open(u_skins.file, "w")
|
||||||
for name, skin in pairs(u_skins.u_skins) do
|
for name, skin in pairs(u_skins.u_skins) do
|
||||||
if name and skin then
|
if name and skin then
|
||||||
if skin ~= "character_1" then
|
if skin ~= u_skins.default then
|
||||||
output:write(name.." "..skin.."\n")
|
output:write(name.." "..skin.."\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user