diff --git a/src/api/weapons.lua b/src/api/weapons.lua index 40e3ef1..4e0c0d6 100644 --- a/src/api/weapons.lua +++ b/src/api/weapons.lua @@ -506,6 +506,7 @@ function set_attack_stance(player, weapon, action) player:set_attach(dummy, "", {x=0,y=-5,z=0}, {x=0, y=-math.deg(p_y), z=0}) else data[p_name].last_physics = player:get_physics_override() + data[p_name].last_physics._slowed_down = p_meta:get_int("wl_slowed_down") player:set_physics_override(action.physics_override) end @@ -763,13 +764,22 @@ function recovery_end(player, weapon, action) player:get_attach():remove() else - player:set_physics_override(data[p_name].last_physics) + local last_physics = data[p_name].last_physics + + player:set_physics_override(last_physics) + wl_debug(p_name, "Terminate physics override | (" .. weapon.description .. ")") - if weapon.slow_down_user - and (not weapon.can_alter_speed or weapon.can_alter_speed(player)) - and (p_meta:get_int("wl_weapon_state") ~= 0 or p_meta:get_int("wl_zooming") == 1) then + if last_physics._slowed_down ~= p_meta:get_int("wl_slowed_down") then + wl_debug(p_name, "Physics is different! Slowed down was " .. last_physics._slowed_down .. " | (" .. weapon.description .. ")") + if last_physics._slowed_down == 1 then + speed_up(player, weapon.mod) + else + slow_down(player, weapon.mod) + end + end + if p_meta:get_int("wl_weapon_state") == 4 or p_meta:get_int("wl_zooming") == 1 then slow_down(player, weapon.mod) end end @@ -878,7 +888,8 @@ function reload_end(player, weapon) wl_debug(p_name, "Terminate reloading | (" .. weapon.description .. ")") if weapon.slow_down_user - and (not weapon.can_alter_speed or weapon.can_alter_speed(player)) then + and (not weapon.can_alter_speed or weapon.can_alter_speed(player)) + and p_meta:get_int("wl_is_speed_locked") == 0 then speed_up(player, weapon.mod) end