diff --git a/mods/player_api/api.lua b/mods/player_api/api.lua index 4cb3944..f9a0c30 100644 --- a/mods/player_api/api.lua +++ b/mods/player_api/api.lua @@ -6,6 +6,18 @@ player_api = {} -- Player animation blending -- Note: This is currently broken due to a bug in Irrlicht, leave at 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 = { } @@ -47,7 +59,7 @@ function player_api.set_model(player, model_name) 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}, 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") else @@ -57,7 +69,7 @@ function player_api.set_model(player, model_name) visual_size = {x = 1, y = 2}, collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3}, stepheight = 0.6, - eye_height = 1.625, + eye_height = player_api.eyeheithg, }) end player_model[name] = model_name diff --git a/mods/player_api/init.lua b/mods/player_api/init.lua index 19028de..f3e3ccc 100644 --- a/mods/player_api/init.lua +++ b/mods/player_api/init.lua @@ -3,7 +3,7 @@ dofile(minetest.get_modpath("player_api") .. "/api.lua") -- Default player appearance -player_api.register_model("character.b3d", { +player_api.register_model(player_api.modelchar, { animation_speed = 30, textures = {"character.png", }, animations = { @@ -17,13 +17,13 @@ player_api.register_model("character.b3d", { }, collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, stepheight = 0.6, - eye_height = 1.47, + eye_height = player_api.eyeheithg, }) -- Update appearance when the player joins minetest.register_on_joinplayer(function(player) 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( {x = 0, y = 79}, {x = 168, y = 187}, diff --git a/mods/player_api/models/character40.b3d b/mods/player_api/models/character40.b3d new file mode 100644 index 0000000..9ab4543 Binary files /dev/null and b/mods/player_api/models/character40.b3d differ diff --git a/mods/player_api/models/character40.blend b/mods/player_api/models/character40.blend new file mode 100644 index 0000000..fca9f65 Binary files /dev/null and b/mods/player_api/models/character40.blend differ diff --git a/mods/player_api/models/character50.b3d b/mods/player_api/models/character50.b3d new file mode 100644 index 0000000..8edbaf6 Binary files /dev/null and b/mods/player_api/models/character50.b3d differ diff --git a/mods/player_api/models/character50.blend b/mods/player_api/models/character50.blend new file mode 100644 index 0000000..f0ce411 Binary files /dev/null and b/mods/player_api/models/character50.blend differ