From 9dab03f544cd97e022423df605695e48326bb660 Mon Sep 17 00:00:00 2001 From: bell07 Date: Fri, 25 Sep 2020 19:38:44 +0200 Subject: [PATCH] Clear up all animations of all registered models (#1) Disable animations for all registered models, not only for "character.b3d". Increases compatibility to other mods --- init.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 09ce1d6..785b3bb 100644 --- a/init.lua +++ b/init.lua @@ -22,10 +22,17 @@ end -- stop player_api from messing stuff up (since 5.3) if minetest.global_exists("player_api") then - for _, v in pairs(player_api.registered_models["character.b3d"].animations) do - v.x = 0 - v.y = 0 - end + minetest.register_on_mods_loaded(function() + for _, model in pairs(player_api.registered_models) do + if model.animations then + for _, animation in pairs(model.animations) do + animation.x = 0 + animation.y = 0 + end + end + end + end) + minetest.register_on_joinplayer(function(player) player:set_local_animation(nil, nil, nil, nil, 0) end)