From 8608f6651d56314405794e9db270567ff71da4db Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Sun, 22 Jan 2023 11:50:14 -0300 Subject: [PATCH] improved model detection method --- automobiles_lib/init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/automobiles_lib/init.lua b/automobiles_lib/init.lua index 49eddeb..70e4651 100755 --- a/automobiles_lib/init.lua +++ b/automobiles_lib/init.lua @@ -51,16 +51,17 @@ end --returns 0 for old, 1 for new function automobiles_lib.detect_player_api(player) local player_proterties = player:get_properties() - local mesh = "character.b3d" - if player_proterties.mesh == mesh or player_proterties.mesh == "max.b3d" then - local models = player_api.registered_models - local character = models[mesh] - if character then - if character.animations.sit.eye_height then + local models = player_api.registered_models + local character = models[player_proterties.mesh] + if character then + if character.animations.sit.eye_height then + if character.animations.sit.eye_height == 0.8 then + --minetest.chat_send_all("new model"); return 1 - else - return 0 end + else + --minetest.chat_send_all("old model"); + return 0 end end