Removed dependancy on previews, added 2 settings, `skin_detail` and `skin_transparency`
67
init.lua
|
@ -27,13 +27,30 @@ while true do
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
f = io.open(minetest.get_modpath("auriskins") .. "/textures/preview_" .. i .. ".png")
|
--[[
|
||||||
if f then
|
THIS PART GENERATES PREVIEWS FROM SKIN FILES INDEPENDANT OF *ANY* EXTERNAL SCRIPS
|
||||||
auriskins.skindata[i].preview = "preview_" .. i .. ".png"
|
How it works:
|
||||||
f:close()
|
|
||||||
else
|
'([combine: 16x32 : -16,-12 = char_1.png ^[mask: auriskins_mask_chest.png)^'
|
||||||
auriskins.skindata[i].preview = nil
|
Size of completed image Position of part Image to copy from Mask for what part of image to copy
|
||||||
end
|
]]
|
||||||
|
|
||||||
|
--Chest
|
||||||
|
local skin = '([combine:16x32:-16,-12=char_' .. i .. '.png^[mask:auriskins_mask_chest.png)^'
|
||||||
|
--Head
|
||||||
|
skin = skin .. '([combine:16x32:-4,-8=char_' .. i .. '.png^[mask:auriskins_mask_head.png)^'
|
||||||
|
--Hat
|
||||||
|
skin = skin .. '([combine:16x32:-36,-8=char_' .. i .. '.png^[mask:auriskins_mask_head.png)^'
|
||||||
|
--Left Arm
|
||||||
|
skin = skin .. '([combine:16x32:-44,-12=char_' .. i .. '.png^[mask:auriskins_mask_larm.png)^'
|
||||||
|
--Right Arm
|
||||||
|
skin = skin .. '([combine:16x32:-44,-12=char_' .. i .. '.png^[mask:auriskins_mask_larm.png^[transformFX)^'
|
||||||
|
--Left Leg
|
||||||
|
skin = skin .. '([combine:16x32:0,0=char_' .. i .. '.png^[mask:auriskins_mask_lleg.png)^'
|
||||||
|
--Right Leg
|
||||||
|
skin = skin .. '([combine:16x32:0,0=char_' .. i .. '.png^[mask:auriskins_mask_lleg.png^[transformFX)'
|
||||||
|
|
||||||
|
auriskins.skindata[i].preview = skin
|
||||||
end
|
end
|
||||||
auriskins.skinsloaded = i - 1
|
auriskins.skinsloaded = i - 1
|
||||||
|
|
||||||
|
@ -61,17 +78,43 @@ auriskins.load();
|
||||||
function auriskins.update_skin(player)
|
function auriskins.update_skin(player)
|
||||||
if player and player:is_player() then
|
if player and player:is_player() then
|
||||||
if auriskins.playerskins[player:get_player_name()] then
|
if auriskins.playerskins[player:get_player_name()] then
|
||||||
|
|
||||||
|
local detail = minetest.setting_get("skin_detail")
|
||||||
|
if not detail then minetest.setting_set("skin_detail", "1"); detail = "1" end
|
||||||
|
detail = tonumber(detail)
|
||||||
|
|
||||||
|
local r = "^[resize:1024x512";
|
||||||
|
if detail == 1 then
|
||||||
|
r = "^[resize:64x32"
|
||||||
|
elseif detail == 2 then
|
||||||
|
r = "^[resize:128x64"
|
||||||
|
elseif detail == 3 then
|
||||||
|
r = "^[resize:256x128"
|
||||||
|
elseif detail == 4 then
|
||||||
|
r = "^[resize:512x256"
|
||||||
|
elseif detail == 0.5 then
|
||||||
|
r = "^[resize:32x16"
|
||||||
|
end
|
||||||
|
|
||||||
|
local trans = minetest.setting_get("skin_transparency")
|
||||||
|
if not trans then minetest.setting_set("skin_transparency", "0"); trans = "0" end
|
||||||
|
trans = tonumber(trans)
|
||||||
|
|
||||||
|
local t = ""
|
||||||
|
if trans == 0 then
|
||||||
|
t = "(auriskins_no_transparency.png" .. r .. ")^"
|
||||||
|
end
|
||||||
|
|
||||||
|
local skinval = t .. "(" .. auriskins.skindata[ auriskins.playerskins[ player:get_player_name() ]].skin .. r .. ")"
|
||||||
|
|
||||||
if minetest.get_modpath("3d_armor") then
|
if minetest.get_modpath("3d_armor") then
|
||||||
--Handle 3D-Armor Layers
|
--Handle 3D-Armor Layers
|
||||||
if armor.textures then --Check if loaded
|
if armor.textures then --Check if loaded
|
||||||
|
armor.textures[player:get_player_name()].skin = skinval
|
||||||
armor.textures[player:get_player_name()].skin =
|
|
||||||
auriskins.skindata[ auriskins.playerskins[ player:get_player_name() ]].skin
|
|
||||||
|
|
||||||
armor:update_player_visuals(player)
|
armor:update_player_visuals(player)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
player_api.set_textures(player, {auriskins.skindata[auriskins.playerskins[player:get_player_name()]].skin})
|
player_api.set_textures(player, {skinval})
|
||||||
end
|
end
|
||||||
auriskins.save()
|
auriskins.save()
|
||||||
end
|
end
|
||||||
|
|
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 194 B |
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 161 B |
After Width: | Height: | Size: 159 B |
After Width: | Height: | Size: 337 B |
After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 931 B |
Before Width: | Height: | Size: 939 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.0 KiB |