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:
@ -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)
|
||||
|
||||
|
BIN
unified_skins/models/uniskins_character.blend
Normal file
BIN
unified_skins/models/uniskins_character.blend
Normal file
Binary file not shown.
7718
unified_skins/models/uniskins_character.x
Normal file
7718
unified_skins/models/uniskins_character.x
Normal file
File diff suppressed because it is too large
Load Diff
BIN
unified_skins/textures/uniskins_trans.png
Normal file
BIN
unified_skins/textures/uniskins_trans.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 B |
Reference in New Issue
Block a user