From ad9d7ac45d8e87f628721c459be8f37db837f33f Mon Sep 17 00:00:00 2001 From: KaadmY Date: Mon, 15 May 2017 15:17:49 -0700 Subject: [PATCH] Fix constant reloading of the player model in some conditions, fixes #40 --- mods/default/model.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mods/default/model.lua b/mods/default/model.lua index 780b3ab..79793d7 100644 --- a/mods/default/model.lua +++ b/mods/default/model.lua @@ -170,6 +170,10 @@ local function on_globalstep(dtime) end end + if player_sneak[name] ~= controls.sneak then + player_sneak[name] = controls.sneak + end + if model and not player_attached[name] then local walking = false local animation_speed_mod = model.animation_speed or player_animation_speed @@ -191,11 +195,6 @@ local function on_globalstep(dtime) if player:get_hp() == 0 then -- dead player_set_animation(player, "lay") elseif walking then -- walking - if player_sneak[name] ~= controls.sneak then - player_anim[name] = nil - player_sneak[name] = controls.sneak - end - if controls.LMB then -- Walking and mining player_set_animation(player, "walk_mine", animation_speed_mod) else -- Walking