2288: Fix snapping for ninja on 0.7 r=heinrich5991 a=Learath2

0.7 seems to assume players with negative armor are dead, rather than clamping.

Co-authored-by: Learath <learath2@gmail.com>
This commit is contained in:
bors[bot] 2020-06-20 11:29:39 +00:00 committed by GitHub
commit c464e3ef80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,7 +198,7 @@ void CCharacter::HandleNinja()
GameServer()->CreateDamageInd(m_Pos, 0, NinjaTime / Server()->TickSpeed(), Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID()));
}
m_Armor = 10 - (NinjaTime / 15);
m_Armor = clamp(10 - (NinjaTime / 15), 0, 10);
// force ninja Weapon
SetWeapon(WEAPON_NINJA);
@ -1179,6 +1179,12 @@ void CCharacter::SnapCharacter(int SnappingClient)
pCharacter->m_Direction = m_Input.m_Direction;
pCharacter->m_Weapon = Weapon;
pCharacter->m_AmmoCount = AmmoCount;
if (m_FreezeTime > 0 || m_FreezeTime == -1 || m_DeepFreeze)
pCharacter->m_AmmoCount = m_FreezeTick + g_Config.m_SvFreezeDelay * Server()->TickSpeed();
else if(Weapon == WEAPON_NINJA)
pCharacter->m_AmmoCount = m_Ninja.m_ActivationTick + g_pData->m_Weapons.m_Ninja.m_Duration * Server()->TickSpeed() / 1000;
pCharacter->m_Health = Health;
pCharacter->m_Armor = Armor;
pCharacter->m_TriggeredEvents = 0;