Compare commits
2 Commits
8be7726147
...
0445c9f90d
Author | SHA1 | Date |
---|---|---|
mckaygerhard | 0445c9f90d | |
mckaygerhard | d47102d5bf |
|
@ -306,13 +306,11 @@ end
|
|||
|
||||
-- Armor Player Model
|
||||
local modelchar
|
||||
local eyeheithg
|
||||
local eyeheithg = 1.5 -- must be autodetected at client connection due different protocols
|
||||
if armor.is_50 then
|
||||
modelchar = "3d_armor_character50.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
modelchar = "3d_armor_character40.b3d"
|
||||
eyeheithg = 1.625
|
||||
end
|
||||
armor.player_register_model(modelchar, {
|
||||
animation_speed = 30,
|
||||
|
@ -353,8 +351,54 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
armor.player_set_model(player, modelchar)
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
local engineold = armor.is_50
|
||||
|
||||
if player_name then
|
||||
local info = minetest.get_player_information(player_name)
|
||||
-- ugly hack due mixed protocols:
|
||||
if info then
|
||||
local test = info.version_string or "5.0"
|
||||
if test:find("0.4") or test:find("4.0") or test:find("4.1") then
|
||||
engineold = true
|
||||
modelchar = "3d_armor_character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
engineold = false
|
||||
modelchar = "3d_armor_character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
end
|
||||
-- only refix register model when protocols are mixed, will slow down server
|
||||
if engineold == true and armor.is_50 == true then
|
||||
minetest.log("warning", "[3d_armor] performance impact: mixed protocols DETECTED on player .. "..player_name.." doin re-register model hack")
|
||||
armor.player_register_model(modelchar, {
|
||||
animation_speed = 30,
|
||||
textures = {
|
||||
armor.default_skin..".png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png",
|
||||
},
|
||||
animations = {
|
||||
stand = {x=0, y=79},
|
||||
lay = {x=162, y=166},
|
||||
walk = {x=168, y=187},
|
||||
mine = {x=189, y=198},
|
||||
walk_mine = {x=200, y=219},
|
||||
sit = {x=81, y=160},
|
||||
-- compatibility w/ the emote mod
|
||||
wave = {x = 192, y = 196, override_local = true},
|
||||
point = {x = 196, y = 196, override_local = true},
|
||||
freeze = {x = 205, y = 205, override_local = true},
|
||||
},
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
armor.player_set_model(player, modelchar)
|
||||
player:set_properties({eye_height = eyeheithg})
|
||||
minetest.after(0.1, function(player)
|
||||
local pplayer = minetest.get_player_by_name(player_name)
|
||||
if pplayer and init_player_armor(player) == false then
|
||||
|
|
|
@ -4,20 +4,72 @@
|
|||
-- Player animation blending
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
local hp_player_maximun = tonumber(minetest.settings:get('default_hp_player_maximun')) or 40
|
||||
local modelchar
|
||||
local eyeheithg = 1.5 -- must be autodetected at client connection due different protocols
|
||||
local collsibox = {-0.3, 0.5, -0.3, 0.3, 1.7, 0.3}
|
||||
|
||||
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||
|
||||
if is_50 then
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.625
|
||||
function dynamicmodel(player_name)
|
||||
|
||||
if not player_name then
|
||||
if is_50 then
|
||||
core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
collsibox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}
|
||||
else
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
core.PLAYER_MAX_HP = hp_player_maximun
|
||||
collsibox = {-0.3, -1, -0.3, 0.3, 0.75, 0.3}
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local engineold = is_50
|
||||
local info = minetest.get_player_information(player_name)
|
||||
-- ugly hack due mixed protocols:
|
||||
if info then
|
||||
local test = info.version_string or "5.0"
|
||||
if test:find("0.4") or test:find("4.0") or test:find("4.1") then
|
||||
engineold = true
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
collsibox = {-0.3, -1, -0.3, 0.3, 0.75, 0.3}
|
||||
else
|
||||
engineold = false
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
collsibox = {-0.3, 0.0, -0.3, 0.3, 1.5, 0.3}
|
||||
end
|
||||
-- only refix register model when protocols are mixed, will slow down server
|
||||
if engineold == true and is_50 == true then
|
||||
minetest.log("warning", "[default/player_api] performance impact: mixed protocols DETECTED on player .. "..player_name.." doin re-register model hack")
|
||||
default.player_register_model( modelchar, {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
-- Standard animations.
|
||||
stand = {x = 0, y = 79},
|
||||
lay = {x = 162, y = 166},
|
||||
walk = {x = 168, y = 187},
|
||||
mine = {x = 189, y = 198},
|
||||
walk_mine = {x = 200, y = 219},
|
||||
sit = {x = 81, y = 160},
|
||||
},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
default.registered_player_models = { }
|
||||
|
||||
dynamicmodel(nil)
|
||||
-- Local for speed.
|
||||
local models = default.registered_player_models
|
||||
|
||||
|
@ -64,7 +116,7 @@ function default.player_set_model(player, model_name)
|
|||
textures = {"player.png", "player_back.png"},
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x = 1, y = 2},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
|
@ -78,6 +130,7 @@ function default.player_set_textures(player, textures)
|
|||
local model_textures = model and model.textures or nil
|
||||
player_textures[name] = textures or model_textures
|
||||
player:set_properties({textures = textures or model_textures,})
|
||||
player:set_properties({hp_max = hp_player_maximun})
|
||||
end
|
||||
|
||||
function default.player_set_animation(player, anim_name, speed)
|
||||
|
@ -94,7 +147,6 @@ function default.player_set_animation(player, anim_name, speed)
|
|||
player:set_animation(anim, speed or model.animation_speed, animation_blend)
|
||||
end
|
||||
|
||||
|
||||
-- Default player appearance
|
||||
default.player_register_model( modelchar, {
|
||||
animation_speed = 30,
|
||||
|
@ -108,14 +160,16 @@ default.player_register_model( modelchar, {
|
|||
walk_mine = {x = 200, y = 219},
|
||||
sit = {x = 81, y = 160},
|
||||
},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
local player_name = player:get_player_name()
|
||||
dynamicmodel(player_name)
|
||||
default.player_attached[player_name] = false
|
||||
default.player_set_model(player, modelchar)
|
||||
player:set_local_animation(
|
||||
{x = 0, y = 79},
|
||||
|
@ -124,6 +178,7 @@ minetest.register_on_joinplayer(function(player)
|
|||
{x = 200, y = 219},
|
||||
30
|
||||
)
|
||||
player:set_properties({hp_max = hp_player_maximun, eye_height = eyeheithg, collisionbox = collsibox})
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
|
|
@ -13,7 +13,6 @@ local S
|
|||
|
||||
if minetest.get_translator ~= nil then
|
||||
S = minetest.get_translator("skins")
|
||||
is_50 = true
|
||||
else
|
||||
if minetest.get_modpath("intllib") then
|
||||
dofile(minetest.get_modpath("intllib").."/init.lua")
|
||||
|
@ -166,8 +165,13 @@ skins.formspec.main = function(name)
|
|||
|
||||
-- if preview enabled then add player model to formspec (5.4dev only)
|
||||
if skins.preview == true then
|
||||
info = minetest.get_player_information(name)
|
||||
if info then
|
||||
local test = info.version_string or "5"
|
||||
if test:find("0.4.") or test:find("4.0.") or test:find("5.0.") or test:find("5.1.") or test:find("5.2.") or test:find("5.3.") then is_54 = false else is_54 = true end
|
||||
end
|
||||
if is_54 then
|
||||
formspec = formspec .. "model[6,-0.2;1.5,3;player;character.b3d;"
|
||||
formspec = formspec .. "model[6,-0.2;1.5,3;player;character50.b3d;"
|
||||
.. skins.skins[name] .. ".png;0,180;false;true]"
|
||||
else
|
||||
local head = "[combine:8x8:-8,-8="..skins.skins[name]..".png"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = skins
|
||||
depends = default, player_api
|
||||
optional_depends = sfinv, inventory_plus, intllib, unified_inventory
|
||||
depends = default
|
||||
optional_depends = sfinv, inventory_plus, intllib, unified_inventory, player_api
|
||||
description = SKIN manager mod, Simple_Skin modified mod that allow players to set their individual skins.
|
||||
|
|
Loading…
Reference in New Issue