summaryrefslogtreecommitdiff
path: root/u_skins/init.lua
diff options
context:
space:
mode:
authorSmallJoker <st.rentsch@hotmail.com>2014-04-17 11:03:20 +0200
committerSmallJoker <st.rentsch@hotmail.com>2014-04-17 11:03:20 +0200
commit597213a67d3e224ef0e5f8aabdb53861d8c4db77 (patch)
treee1a0ebbb2341edfd31a1165605093e09d8a2bede /u_skins/init.lua
parent0e84c6cc478134bc09b4df8d1e2c9e20c8b7c444 (diff)
Add hacky skin preview, update README
Diffstat (limited to 'u_skins/init.lua')
-rw-r--r--u_skins/init.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/u_skins/init.lua b/u_skins/init.lua
index abc73b0..5e3119b 100644
--- a/u_skins/init.lua
+++ b/u_skins/init.lua
@@ -6,6 +6,7 @@ u_skins = {}
u_skins.type = { SPRITE=0, MODEL=1 }
u_skins.pages = {}
u_skins.u_skins = {}
+u_skins.used_hacky = false -- set to true if used hacky way to update skins
u_skins.get_type = function(texture)
if not texture then return end
@@ -34,6 +35,7 @@ u_skins.update_player_skin = function(player)
elseif u_skins.get_type(u_skins.u_skins[name]) == u_skins.type.MODEL then
player:set_properties({
visual = "mesh",
+ mesh = "character.x",
textures = {u_skins.u_skins[name]..".png"},
visual_size = {x=1, y=1},
})
@@ -47,11 +49,13 @@ unified_inventory.register_page("u_skins", {
name = player:get_player_name()
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
if u_skins.get_type(u_skins.u_skins[name]) == u_skins.type.MODEL then
- formspec = formspec
- .. "image[0,.75;1,2;"..u_skins.u_skins[name].."_preview.png]"
- .. "image[1,.75;1,2;"..u_skins.u_skins[name].."_preview_back.png]"
- .. "label[6,.5;Raw texture:]"
- .. "image[6,1;2,1;"..u_skins.u_skins[name]..".png]"
+ formspec = formspec.."image[0,.75;1,2;"..u_skins.u_skins[name].."_preview.png]"
+ if not u_skins.used_hacky then
+ -- player back view
+ formspec = formspec.."image[1,.75;1,2;"..u_skins.u_skins[name].."_preview_back.png]"
+ end
+ formspec = formspec.."label[6,.5;Raw texture:]"
+ .."image[6,1;2,1;"..u_skins.u_skins[name]..".png]"
else
formspec = formspec