update player model remove vertial 1 node offset on newer engines only
* Player model: Remove vertical 1 node offset for new engines, but Required due to the settable player collision box engine feature change for MT/MTG v0.5.0 that breaks compatibility with old client so due that this commit will added backguard compatibility * Autodetec minetest versoin engine and provide right model character, update player code to provide compatibility with player_api
This commit is contained in:
parent
6bcaca9091
commit
13cd243a03
@ -6,6 +6,18 @@ player_api = {}
|
|||||||
-- Player animation blending
|
-- Player animation blending
|
||||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||||
local animation_blend = 0
|
local animation_blend = 0
|
||||||
|
local player_api.modelchar
|
||||||
|
local player_api.eyeheithg
|
||||||
|
|
||||||
|
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||||
|
|
||||||
|
if is_50 then
|
||||||
|
player_api.modelchar = "character50.b3d"
|
||||||
|
player_api.eyeheithg = 1.47
|
||||||
|
else
|
||||||
|
player_api.modelchar = "character40.b3d"
|
||||||
|
player_api.eyeheithg = 1.625
|
||||||
|
end
|
||||||
|
|
||||||
player_api.registered_models = { }
|
player_api.registered_models = { }
|
||||||
|
|
||||||
@ -47,7 +59,7 @@ function player_api.set_model(player, model_name)
|
|||||||
visual_size = model.visual_size or {x = 1, y = 1},
|
visual_size = model.visual_size or {x = 1, y = 1},
|
||||||
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||||
stepheight = model.stepheight or 0.6,
|
stepheight = model.stepheight or 0.6,
|
||||||
eye_height = model.eye_height or 1.47,
|
eye_height = model.eye_height or player_api.eyeheithg,
|
||||||
})
|
})
|
||||||
player_api.set_animation(player, "stand")
|
player_api.set_animation(player, "stand")
|
||||||
else
|
else
|
||||||
@ -57,7 +69,7 @@ function player_api.set_model(player, model_name)
|
|||||||
visual_size = {x = 1, y = 2},
|
visual_size = {x = 1, y = 2},
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||||
stepheight = 0.6,
|
stepheight = 0.6,
|
||||||
eye_height = 1.625,
|
eye_height = player_api.eyeheithg,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
player_model[name] = model_name
|
player_model[name] = model_name
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
dofile(minetest.get_modpath("player_api") .. "/api.lua")
|
dofile(minetest.get_modpath("player_api") .. "/api.lua")
|
||||||
|
|
||||||
-- Default player appearance
|
-- Default player appearance
|
||||||
player_api.register_model("character.b3d", {
|
player_api.register_model(player_api.modelchar, {
|
||||||
animation_speed = 30,
|
animation_speed = 30,
|
||||||
textures = {"character.png", },
|
textures = {"character.png", },
|
||||||
animations = {
|
animations = {
|
||||||
@ -17,13 +17,13 @@ player_api.register_model("character.b3d", {
|
|||||||
},
|
},
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||||
stepheight = 0.6,
|
stepheight = 0.6,
|
||||||
eye_height = 1.47,
|
eye_height = player_api.eyeheithg,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Update appearance when the player joins
|
-- Update appearance when the player joins
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
player_api.player_attached[player:get_player_name()] = false
|
player_api.player_attached[player:get_player_name()] = false
|
||||||
player_api.set_model(player, "character.b3d")
|
player_api.set_model(player, player_api.modelchar)
|
||||||
player:set_local_animation(
|
player:set_local_animation(
|
||||||
{x = 0, y = 79},
|
{x = 0, y = 79},
|
||||||
{x = 168, y = 187},
|
{x = 168, y = 187},
|
||||||
|
BIN
mods/player_api/models/character40.b3d
Normal file
BIN
mods/player_api/models/character40.b3d
Normal file
Binary file not shown.
BIN
mods/player_api/models/character40.blend
Normal file
BIN
mods/player_api/models/character40.blend
Normal file
Binary file not shown.
BIN
mods/player_api/models/character50.b3d
Normal file
BIN
mods/player_api/models/character50.b3d
Normal file
Binary file not shown.
BIN
mods/player_api/models/character50.blend
Normal file
BIN
mods/player_api/models/character50.blend
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user