From d22a1a8f060b98e40d315faca2faaf282abab487 Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Mon, 16 Mar 2020 11:52:53 +0100 Subject: [PATCH 1/4] Remove setting ammo for freeze to 0 --- src/game/server/entities/character.cpp | 33 ++++++++++---------------- src/game/server/entities/pickup.cpp | 6 ++--- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 20971ccf0..179e98ffe 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -373,6 +373,16 @@ void CCharacter::FireWeapon() if(!WillFire) return; + if (m_FreezeTime) + { + if(m_PainSoundTimer<=0) + { + m_PainSoundTimer = 1 * Server()->TickSpeed(); + GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_LONG, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID())); + } + return; + } + // check for ammo if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo) { @@ -380,11 +390,6 @@ void CCharacter::FireWeapon() m_ReloadTimer = 125 * Server()->TickSpeed() / 1000; GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);*/ // Timer stuff to avoid shrieking orchestra caused by unfreeze-plasma - if(m_PainSoundTimer<=0) - { - m_PainSoundTimer = 1 * Server()->TickSpeed(); - GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_LONG, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID())); - } return; } @@ -663,8 +668,7 @@ void CCharacter::GiveNinja() { m_Ninja.m_ActivationTick = Server()->Tick(); m_aWeapons[WEAPON_NINJA].m_Got = true; - if (!m_FreezeTime) - m_aWeapons[WEAPON_NINJA].m_Ammo = -1; + m_aWeapons[WEAPON_NINJA].m_Ammo = -1; if (m_Core.m_ActiveWeapon != WEAPON_NINJA) m_LastWeapon = m_Core.m_ActiveWeapon; m_Core.m_ActiveWeapon = WEAPON_NINJA; @@ -2223,13 +2227,6 @@ bool CCharacter::Freeze(int Seconds) return false; if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed() || Seconds == -1) { - for(int i = 0; i < NUM_WEAPONS; i++) - { - if(m_aWeapons[i].m_Got) - { - m_aWeapons[i].m_Ammo = 0; - } - } m_Armor = 0; m_FreezeTime = Seconds == -1 ? Seconds : Seconds * Server()->TickSpeed(); m_FreezeTick = Server()->Tick(); @@ -2248,11 +2245,6 @@ bool CCharacter::UnFreeze() if (m_FreezeTime > 0) { m_Armor=10; - for(int i=0;iGetWeaponGot(i)) { - if(!(pChr->m_FreezeTime && i == WEAPON_NINJA)) + if(i != WEAPON_NINJA)) { pChr->SetWeaponGot(i, false); pChr->SetWeaponAmmo(i, 0); @@ -84,13 +84,13 @@ void CPickup::Tick() pChr->SetLastWeapon(WEAPON_GUN); GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR, pChr->Teams()->TeamMask(pChr->Team())); } - if(!pChr->m_FreezeTime && pChr->GetActiveWeapon() >= WEAPON_SHOTGUN) + if(pChr->GetActiveWeapon() >= WEAPON_SHOTGUN) pChr->SetActiveWeapon(WEAPON_HAMMER); break; case POWERUP_WEAPON: - if (m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->GetWeaponGot(m_Subtype) || (pChr->GetWeaponAmmo(m_Subtype) != -1 && !pChr->m_FreezeTime))) + if (m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->GetWeaponGot(m_Subtype) || pChr->GetWeaponAmmo(m_Subtype) != -1)) { pChr->GiveWeapon(m_Subtype); From 69a6e94833a22ba0c6977d92fd83ab1ca093d843 Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Tue, 17 Mar 2020 13:55:30 +0100 Subject: [PATCH 2/4] Fix two bugs --- src/game/server/entities/character.cpp | 2 +- src/game/server/entities/pickup.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 179e98ffe..1385bf97e 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -157,7 +157,7 @@ void CCharacter::HandleJetpack() return; // check for ammo - if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo) + if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo || m_FreezeTime) { return; } diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index 98c308437..33e2d3dbf 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -68,7 +68,7 @@ void CPickup::Tick() { if(pChr->GetWeaponGot(i)) { - if(i != WEAPON_NINJA)) + if(i != WEAPON_NINJA) { pChr->SetWeaponGot(i, false); pChr->SetWeaponAmmo(i, 0); From da72907b794a11e44f3ba88820a562515ec81170 Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Tue, 24 Mar 2020 21:43:26 +0100 Subject: [PATCH 3/4] Fix ninja not getting removed --- src/game/server/entities/pickup.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index 33e2d3dbf..2a91d832e 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -68,12 +68,9 @@ void CPickup::Tick() { if(pChr->GetWeaponGot(i)) { - if(i != WEAPON_NINJA) - { - pChr->SetWeaponGot(i, false); - pChr->SetWeaponAmmo(i, 0); - Sound = true; - } + pChr->SetWeaponGot(i, false); + pChr->SetWeaponAmmo(i, 0); + Sound = true; } } pChr->SetNinjaActivationDir(vec2(0,0)); From d4604702652316bc44a15cc4935f12c261383539 Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Thu, 30 Apr 2020 11:49:04 +0200 Subject: [PATCH 4/4] Move comment aswell --- src/game/server/entities/character.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 1385bf97e..ebeb4a7e2 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -375,6 +375,7 @@ void CCharacter::FireWeapon() if (m_FreezeTime) { + // Timer stuff to avoid shrieking orchestra caused by unfreeze-plasma if(m_PainSoundTimer<=0) { m_PainSoundTimer = 1 * Server()->TickSpeed(); @@ -389,7 +390,6 @@ void CCharacter::FireWeapon() /*// 125ms is a magical limit of how fast a human can click m_ReloadTimer = 125 * Server()->TickSpeed() / 1000; GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);*/ - // Timer stuff to avoid shrieking orchestra caused by unfreeze-plasma return; }