summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <st.rentsch@hotmail.com>2014-07-30 17:49:51 +0200
committerSmallJoker <st.rentsch@hotmail.com>2014-07-30 17:49:51 +0200
commit7c25df22dceac0acca1f219baa3bd3269dd55e70 (patch)
tree4a3a3970a80acc2fc4396a959cc1225ef3ca87e9
parent29332b7cf3d4fe588539ea2b6f596828855d4148 (diff)
Add default; do not use character.x
-rw-r--r--u_skins/init.lua10
-rw-r--r--u_skins/players.lua2
2 files changed, 5 insertions, 7 deletions
diff --git a/u_skins/init.lua b/u_skins/init.lua
index b4b32d4..a0be27d 100644
--- a/u_skins/init.lua
+++ b/u_skins/init.lua
@@ -5,6 +5,7 @@
u_skins = {}
u_skins.modpath = minetest.get_modpath("u_skins")
u_skins.file = minetest.get_worldpath().."/u_skins.mt"
+u_skins.default = "character_1"
u_skins.pages = {}
u_skins.u_skins = {}
u_skins.file_save = false
@@ -35,13 +36,10 @@ dofile(u_skins.modpath.."/players.lua")
u_skins.update_player_skin = function(player)
local name = player:get_player_name()
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
player:set_properties({
- visual = "mesh",
- mesh = "character.x",
textures = {u_skins.u_skins[name]..".png"},
- visual_size = {x=1, y=1},
})
u_skins.file_save = true
end
@@ -51,7 +49,7 @@ unified_inventory.register_page("u_skins", {
get_formspec = function(player)
local name = player:get_player_name()
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
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)
local player_name = player:get_player_name()
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
u_skins.update_player_skin(player)
end)
diff --git a/u_skins/players.lua b/u_skins/players.lua
index 772481e..3053530 100644
--- a/u_skins/players.lua
+++ b/u_skins/players.lua
@@ -30,7 +30,7 @@ u_skins.save = function()
local output = io.open(u_skins.file, "w")
for name, skin in pairs(u_skins.u_skins) do
if name and skin then
- if skin ~= "character_1" then
+ if skin ~= u_skins.default then
output:write(name.." "..skin.."\n")
end
end