mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
ReWorked the Freeze System
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
f6f7699ef1
commit
f7aa9c4c2b
|
@ -497,7 +497,7 @@ bool CCharacter::GiveWeapon(int Weapon, int Ammo)
|
|||
if(m_aWeapons[Weapon].m_Ammo < g_pData->m_Weapons.m_aId[Weapon].m_Maxammo || !m_aWeapons[Weapon].m_Got)
|
||||
{
|
||||
m_aWeapons[Weapon].m_Got = true;
|
||||
m_aWeapons[Weapon].m_Ammo = min(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
|
||||
if(!m_FreezeTime) m_aWeapons[Weapon].m_Ammo = min(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -509,7 +509,7 @@ void CCharacter::GiveNinja()
|
|||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_NINJA);
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = -1;
|
||||
if (!m_FreezeTime) m_aWeapons[WEAPON_NINJA].m_Ammo = -1;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
}
|
||||
|
@ -573,14 +573,14 @@ void CCharacter::Tick()
|
|||
{
|
||||
GameServer()->CreateDamageInd(m_Pos, 0, m_FreezeTime / Server()->TickSpeed());
|
||||
}
|
||||
(m_FreezeTime != -1)?m_FreezeTime--:0;
|
||||
if(m_FreezeTime != -1)
|
||||
m_FreezeTime--;
|
||||
else
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_Input.m_Direction = 0;
|
||||
m_Input.m_Jump = 0;
|
||||
m_Input.m_Hook = 0;
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got=true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo =0;
|
||||
m_ActiveWeapon=WEAPON_NINJA;
|
||||
|
||||
//m_Input.m_Fire = 0;
|
||||
if (m_FreezeTime == 1) {
|
||||
UnFreeze();
|
||||
|
@ -1052,14 +1052,14 @@ bool CCharacter::Freeze(int Time)
|
|||
return false;
|
||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||
{
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = 0;
|
||||
}
|
||||
m_Armor=0;
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = 0;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
m_FreezeTime=Time;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1072,14 +1072,15 @@ bool CCharacter::Freeze()
|
|||
return false;
|
||||
if (m_FreezeTick < Server()->Tick() - Server()->TickSpeed())
|
||||
{
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = 0;
|
||||
}
|
||||
m_Armor=0;
|
||||
m_Ninja.m_ActivationTick = Server()->Tick();
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = true;
|
||||
m_aWeapons[WEAPON_NINJA].m_Ammo = 0;
|
||||
m_LastWeapon = m_ActiveWeapon;
|
||||
m_ActiveWeapon = WEAPON_NINJA;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
m_FreezeTime=Time;
|
||||
m_FreezeTick=Server()->Tick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1090,23 +1091,12 @@ bool CCharacter::UnFreeze()
|
|||
if (m_FreezeTime>0)
|
||||
{
|
||||
m_Armor=10;
|
||||
m_FreezeTick=0;
|
||||
m_FreezeTime=0;
|
||||
m_aWeapons[WEAPON_NINJA].m_Got = false;
|
||||
m_ActiveWeapon = m_LastWeapon;
|
||||
if(m_ActiveWeapon == WEAPON_NINJA)
|
||||
m_ActiveWeapon = WEAPON_GUN;
|
||||
SetWeapon(m_ActiveWeapon);
|
||||
m_Ninja.m_ActivationDir=vec2(0,0);
|
||||
m_Ninja.m_ActivationTick=0;
|
||||
m_Ninja.m_CurrentMoveTime=0;
|
||||
for(int i=0;i<WEAPON_NINJA;i++)
|
||||
{
|
||||
for(int i=0;i<NUM_WEAPONS;i++)
|
||||
if(m_aWeapons[i].m_Got)
|
||||
{
|
||||
m_aWeapons[i].m_Ammo = -1;
|
||||
}
|
||||
}
|
||||
m_FreezeTime=0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1117,7 +1107,7 @@ void CCharacter::GiveAllWeapons()
|
|||
for(int i=1;i<NUM_WEAPONS-1;i++)
|
||||
{
|
||||
m_aWeapons[i].m_Got = true;
|
||||
m_aWeapons[i].m_Ammo = -1;
|
||||
if(!m_FreezeTime) m_aWeapons[i].m_Ammo = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1296,10 +1286,11 @@ void CCharacter::Snap(int SnappingClient)
|
|||
Character->m_Health = 0;
|
||||
Character->m_Armor = 0;
|
||||
|
||||
if (m_FreezeTime > 0)
|
||||
if (m_FreezeTime > 0 || m_FreezeTime == -1)
|
||||
{
|
||||
Character->m_Emote = EMOTE_PAIN;
|
||||
Character->m_Weapon = WEAPON_NINJA;
|
||||
Character->m_AmmoCount = 0;
|
||||
}
|
||||
else
|
||||
Character->m_Weapon = m_ActiveWeapon;
|
||||
|
@ -1312,7 +1303,7 @@ void CCharacter::Snap(int SnappingClient)
|
|||
Character->m_Health = m_Health;
|
||||
Character->m_Armor = m_Armor;
|
||||
if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0)
|
||||
Character->m_AmmoCount = m_aWeapons[m_ActiveWeapon].m_Ammo;
|
||||
Character->m_AmmoCount = (!m_FreezeTime)?m_aWeapons[m_ActiveWeapon].m_Ammo:0;
|
||||
}
|
||||
|
||||
if (Character->m_Emote == EMOTE_NORMAL)
|
||||
|
|
|
@ -79,14 +79,6 @@ void CPickup::Tick()
|
|||
sound = true;
|
||||
}
|
||||
}
|
||||
if(pChr->m_FreezeTime)
|
||||
{
|
||||
pChr->m_aWeapons[WEAPON_GUN].m_Ammo = 0;
|
||||
pChr->m_aWeapons[WEAPON_HAMMER].m_Ammo =0;
|
||||
}
|
||||
pChr->m_Ninja.m_ActivationDir=vec2(0,0);
|
||||
pChr->m_Ninja.m_ActivationTick=0;
|
||||
pChr->m_Ninja.m_CurrentMoveTime=0;
|
||||
}
|
||||
if (sound)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue