Merge pull request #2086 from fokkonaut/master

Remove setting ammo for freeze to 0
This commit is contained in:
Dennis Felsing 2020-04-30 12:44:40 +02:00 committed by GitHub
commit 5e213a2619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 30 deletions

View file

@ -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;
}
@ -373,12 +373,8 @@ void CCharacter::FireWeapon()
if(!WillFire)
return;
// check for ammo
if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo)
if (m_FreezeTime)
{
/*// 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
if(m_PainSoundTimer<=0)
{
@ -388,6 +384,15 @@ void CCharacter::FireWeapon()
return;
}
// check for ammo
if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo)
{
/*// 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);*/
return;
}
vec2 ProjStartPos = m_Pos+Direction*m_ProximityRadius*0.75f;
switch(m_Core.m_ActiveWeapon)
@ -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;
@ -2224,13 +2228,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();
@ -2249,11 +2246,6 @@ bool CCharacter::UnFreeze()
if (m_FreezeTime > 0)
{
m_Armor=10;
for(int i=0;i<NUM_WEAPONS;i++)
if(m_aWeapons[i].m_Got)
{
m_aWeapons[i].m_Ammo = -1;
}
if(!m_aWeapons[m_Core.m_ActiveWeapon].m_Got)
m_Core.m_ActiveWeapon = WEAPON_GUN;
m_FreezeTime = 0;
@ -2282,8 +2274,7 @@ void CCharacter::GiveWeapon(int Weapon, bool Remove)
}
else
{
if (!m_FreezeTime)
m_aWeapons[Weapon].m_Ammo = -1;
m_aWeapons[Weapon].m_Ammo = -1;
}
m_aWeapons[Weapon].m_Got = !Remove;

View file

@ -68,12 +68,9 @@ void CPickup::Tick()
{
if(pChr->GetWeaponGot(i))
{
if(!(pChr->m_FreezeTime && 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));
@ -84,13 +81,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);