1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2025-06-28 14:26:18 +02:00

Version update: 0.3.0

This commit is contained in:
stujones11
2013-06-22 19:31:57 +01:00
parent 4a86ba8260
commit efea71a63e
54 changed files with 1687 additions and 810 deletions

View File

@ -1,70 +1,51 @@
uniskins = {
skins = {},
default_character_skin = "character.png",
skin = {},
armor = {},
wielditem = {},
default_skin = "character.png",
default_texture = nil
}
uniskins.get_player_skin = function(self, name)
if minetest.get_modpath("skins") then
local skin = skins.skins[name]
if skin then
if skins.get_type(skin) == skins.type.MODEL then
return skin..".png"
end
end
end
if self.skins[name] then
return self.skins[name]
end
return self.default_character_skin
end
uniskins.update_player_visuals = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local texture = self:get_player_skin(name)
local has_wieldview = minetest.get_modpath("wieldview")
if has_wieldview then
texture = "wieldview_character_bg.png^[combine:64x64:0,32="..texture
local wielded_item_texture = wieldview:get_wielded_item_texture(player)
if wielded_item_texture then
texture = texture.."^[combine:64x64:0,0="..wielded_item_texture
end
local texture = "uniskins_trans.png"
if self.wielditem[name] then
texture = texture.."^[combine:64x64:0,0="..self.wielditem[name]
end
if minetest.get_modpath("3d_armor") then
local textures = armor_api:get_armor_textures(player)
for _,v in ipairs({"head", "torso", "legs"}) do
if textures[v] then
texture = texture.."^"
if has_wieldview then
texture = texture.."[combine:64x64:0,32="
end
texture = texture..textures[v]
end
end
if has_wieldview and textures["shield"] then
texture = texture.."^[combine:64x64:16,0="..textures["shield"]
end
if self.skin[name] then
texture = texture.."^[combine:64x64:0,32="..self.skin[name]
end
if self.armor[name] then
texture = texture.."^[combine:64x64:0,0="..self.armor[name]
end
player:set_properties({
visual = "mesh",
mesh = "uniskins_character.x",
textures = {texture},
visual_size = {x=1, y=1},
})
end
minetest.register_on_joinplayer(function(player)
if not minetest.get_modpath("player_textures") then
return
end
local name = player:get_player_name()
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name
local f = io.open(filename..".png")
if f then
f:close()
uniskins.skins[name] = "player_"..player:get_player_name()..".png"
uniskins.skin[name] = uniskins.default_skin
if minetest.get_modpath("player_textures") then
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name
local f = io.open(filename..".png")
if f then
f:close()
uniskins.skin[name] = "player_"..name..".png"
end
end
if minetest.get_modpath("skins") then
local skin = skins.skins[name]
if skin and skins.get_type(skin) == skins.type.MODEL then
uniskins.skin[name] = skin..".png"
end
end
end)

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B