Hand now changes along with skin
This commit is contained in:
parent
fceab35b7f
commit
f4393dde7c
49
models/skinsc_hand.obj
Normal file
49
models/skinsc_hand.obj
Normal file
@ -0,0 +1,49 @@
|
||||
# Made in Blockbench 4.6.1
|
||||
mtllib skinsc_hand.mtl
|
||||
|
||||
o cube
|
||||
v -0.08687483202078755 0.10947151940737809 0.0625
|
||||
v -0.08687483202078755 0.10947151940737809 -0.0625
|
||||
v 0.02641364135879365 0.05664423668979057 0.0625
|
||||
v 0.02641364135879365 0.05664423668979057 -0.0625
|
||||
v -0.23875326983385137 -0.2162328415589181 -0.0625
|
||||
v -0.23875326983385137 -0.2162328415589181 0.0625
|
||||
v -0.1254647964542701 -0.2690601242765055 -0.0625
|
||||
v -0.1254647964542701 -0.2690601242765055 0.0625
|
||||
vt 0.875 0
|
||||
vt 0.875 0.375
|
||||
vt 0.8125 0.375
|
||||
vt 0.8125 0
|
||||
vt 0.125 0.5
|
||||
vt 0.1875 0.5
|
||||
vt 0.1875 0.375
|
||||
vt 0.125 0.375
|
||||
vt 0.6875 0.375
|
||||
vt 0.6875 0
|
||||
vt 0.75 0
|
||||
vt 0.75 0.375
|
||||
vt 0.75 0.5
|
||||
vt 0.6875 0.5
|
||||
vt 0.6875 0.375
|
||||
vt 0.75 0.375
|
||||
vt 0.6875 0.375
|
||||
vt 0.6875 0
|
||||
vt 0.625 0
|
||||
vt 0.625 0.375
|
||||
vt 0.5625 0.375
|
||||
vt 0.5625 0
|
||||
vt 0.625 0
|
||||
vt 0.625 0.375
|
||||
vn 0 0 -1
|
||||
vn 0.4226182617406993 0.90630778703665 0
|
||||
vn 0 0 1
|
||||
vn -0.4226182617406993 -0.90630778703665 0
|
||||
vn -0.90630778703665 0.4226182617406993 0
|
||||
vn 0.90630778703665 -0.4226182617406993 0
|
||||
usemtl m_fff0573a-83a1-1cff-4a98-5767651ce920
|
||||
f 4/4/1 7/3/1 5/2/1 2/1/1
|
||||
f 3/8/2 4/7/2 2/6/2 1/5/2
|
||||
f 8/12/3 3/11/3 1/10/3 6/9/3
|
||||
f 7/16/4 8/15/4 6/14/4 5/13/4
|
||||
f 6/20/5 1/19/5 2/18/5 5/17/5
|
||||
f 7/24/6 4/23/6 3/22/6 8/21/6
|
29
src/api.lua
Executable file → Normal file
29
src/api.lua
Executable file → Normal file
@ -5,6 +5,31 @@ local loaded_skins = {}
|
||||
local equipped_skin = {} -- KEY: p_name; VALUE: skin ID
|
||||
|
||||
|
||||
local function register_hand_from_texture(skin_ID, texture)
|
||||
local hand_name = "skins_collectible:hand_" .. tostring(skin_ID)
|
||||
local hand_def = {}
|
||||
|
||||
-- costruisco la definizione per una nuova mano prendendo le proprietà
|
||||
-- che non mi interessano e impostandole ai valori di base
|
||||
for key, value in pairs(minetest.registered_items[""]) do
|
||||
if key ~= "mod_origin" and key ~= "type" and key ~= "wield_image" then
|
||||
hand_def[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
hand_def.tiles = {texture}
|
||||
hand_def.visual_scale = 1
|
||||
hand_def.wield_scale = {x=5,y=5,z=5}
|
||||
hand_def.paramtype = "light"
|
||||
hand_def.drawtype = "mesh"
|
||||
|
||||
hand_def.mesh = "skinsc_hand.obj"
|
||||
|
||||
hand_def.use_texture_alpha = ALPHA_CLIP
|
||||
minetest.register_node(hand_name, hand_def)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function load_skins()
|
||||
|
||||
@ -39,7 +64,6 @@ local function load_skins()
|
||||
local skins = yaml.parse(file:read("*all"))
|
||||
|
||||
for ID, skin in pairs(skins) do
|
||||
|
||||
-- il decodificatore aggiunge _N ai doppioni, per diversificarli e salvarli entrambi. Tolgo quindi _ecc
|
||||
-- da eventuali cifre iniziali per vedere se già esiste (se è stringa, è errore a prescindere)
|
||||
if type(ID) == "string" then
|
||||
@ -75,6 +99,8 @@ local function load_skins()
|
||||
tier = skin.tier or 1,
|
||||
author = skin.author or "???",
|
||||
}
|
||||
|
||||
register_hand_from_texture(ID, skin.texture)
|
||||
end
|
||||
|
||||
file:close()
|
||||
@ -253,6 +279,7 @@ function skins_collectible.set_skin(player, skin_ID, is_permanent, at_login)
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
equipped_skin[p_name] = skin_ID
|
||||
player:get_inventory():set_stack("hand", 1, "skins_collectible:hand_" .. tostring(skin_ID))
|
||||
|
||||
if is_permanent then
|
||||
player:get_meta():set_int("skins_collectible:skin_ID", skin_ID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user