From 8d60e85dfc25dffbcfb2bf30cd57de0c5f38b97b Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Tue, 31 Jan 2023 15:07:58 +0100 Subject: [PATCH] Fix `player_api.set_model` not updating the animation --- mods/player_api/api.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mods/player_api/api.lua b/mods/player_api/api.lua index e39847db..f8ff598a 100644 --- a/mods/player_api/api.lua +++ b/mods/player_api/api.lua @@ -67,7 +67,11 @@ function player_api.set_model(player, model_name) if player_data.model == model_name then return end + -- Update data player_data.model = model_name + -- Clear animation data as the model has changed + -- (required for setting the `stand` animation not to be a no-op) + player_data.animation, player_data.animation_speed = nil, nil local model = models[model_name] if model then