added model based skin preview

This commit is contained in:
Sokomine 2022-07-22 21:41:44 +02:00
parent 54b20b1196
commit 11617d422d

View File

@ -1,8 +1,22 @@
-- this file contains the preview images for the skins of the NPC;
-- it does depend on the model used
-- this makes use of the "model" option of formspecs
yl_speak_up.skin_preview_3d = function(mesh, textures)
local tstr = ""
for i, t in ipairs(textures) do
tstr = tstr..minetest.formspec_escape(t)..","
end
return "container[0.5,0.5]"..
"model[2,1;6,12;skin_animation_front;"..mesh..";"..tstr..";0,180;false;true;;]"..
"model[8,1;6,12;skin_animation_back;"..mesh..";"..tstr..";0,0;false;true;;]"..
"container_end[]"
end
-- this is a suitable version for most models/meshes that use normal player skins
-- (i.e. mobs_redo)
-- (i.e. mobs_redo) with skins in either 64 x 32 or 64 x 64 MC skin format
yl_speak_up.skin_preview_normal = function(skin)
return "image[3,0.7;2,2;[combine:8x8:-8,-8="..skin.."]"..
"image[2.85,0.55;2.3,2.3;[combine:8x8:-40,-8="..skin.."]".. -- head, beard
@ -21,7 +35,7 @@ yl_speak_up.skin_preview_normal = function(skin)
"image[8,5.75;1,3;[combine:4x12:-28,-52="..skin..":-12,-52="..skin.."]".. -- r. leg back ov
"image[9,5.75;1,3;[combine:4x12:-12,-20="..skin.."^[transformFX]".. -- right leg back
"image[9,5.75;1,3;[combine:4x12:-12,-36="..skin.."]".. -- right leg back ov
"image[7,2.75;1,3;[combine:4x12:-40,-52="..skin..":-60,-52="..skin.."]".. -- l. hand back ov
"image[7,2.75;1,3;[combine:4x12:-52,-20="..skin..":-40,-52="..skin..":-60,-52="..skin.."]".. -- l. hand back ov
"image[10,2.75;1,3;[combine:4x12:-52,-20="..skin.."^[transformFX]".. -- right hand back
"image[10,2.75;1,3;[combine:4x12:-52,-20="..skin..":-52,-36="..skin.."]".. -- left hand back