Always destroy bullets/lasers on kill when in practice team (fixes #4694)

to prevent /teleporting back to start line and cheating
This commit is contained in:
Dennis Felsing 2022-02-11 10:56:34 +01:00
parent 80df1aefea
commit 3650281cf0
4 changed files with 11 additions and 3 deletions

View file

@ -25,7 +25,10 @@ CLaser::CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEner
m_TeleportCancelled = false;
m_IsBlueTeleport = false;
m_TuneZone = GameServer()->Collision()->IsTune(GameServer()->Collision()->GetMapIndex(m_Pos));
m_TeamMask = GameServer()->GetPlayerChar(Owner) ? GameServer()->GetPlayerChar(Owner)->Teams()->TeamMask(GameServer()->GetPlayerChar(Owner)->Team(), -1, m_Owner) : 0;
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
m_TeamMask = pOwnerChar ? pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner) : 0;
m_BelongsToPracticeTeam = pOwnerChar && pOwnerChar->Teams()->IsPractice(pOwnerChar->Team());
GameWorld()->InsertEntity(this);
DoBounce();
}
@ -230,7 +233,7 @@ void CLaser::Reset()
void CLaser::Tick()
{
if(g_Config.m_SvDestroyLasersOnDeath && m_Owner >= 0)
if((g_Config.m_SvDestroyLasersOnDeath || m_BelongsToPracticeTeam) && m_Owner >= 0)
{
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
if(!(pOwnerChar && pOwnerChar->IsAlive()))

View file

@ -38,6 +38,7 @@ private:
int m_TuneZone;
bool m_TeleportCancelled;
bool m_IsBlueTeleport;
bool m_BelongsToPracticeTeam;
};
#endif

View file

@ -44,6 +44,9 @@ CProjectile::CProjectile(
m_TuneZone = GameServer()->Collision()->IsTune(GameServer()->Collision()->GetMapIndex(m_Pos));
CCharacter *pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
m_BelongsToPracticeTeam = pOwnerChar && pOwnerChar->Teams()->IsPractice(pOwnerChar->Team());
GameWorld()->InsertEntity(this);
}
@ -142,7 +145,7 @@ void CProjectile::Tick()
{
TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner);
}
else if(m_Owner >= 0 && (m_Type != WEAPON_GRENADE || g_Config.m_SvDestroyBulletsOnDeath))
else if(m_Owner >= 0 && (m_Type != WEAPON_GRENADE || g_Config.m_SvDestroyBulletsOnDeath || m_BelongsToPracticeTeam))
{
m_MarkedForDestroy = true;
return;

View file

@ -47,6 +47,7 @@ private:
int m_Bouncing;
bool m_Freeze;
int m_TuneZone;
bool m_BelongsToPracticeTeam;
public:
void SetBouncing(int Value);