4695: Always destroy bullets/lasers on kill when in practice team (fixes #4694) r=heinrich5991 a=def-

to prevent /teleporting back to start line and cheating

Any thoughts on whether to include this for 15.9? I'd say yes.

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2022-02-11 16:04:07 +00:00 committed by GitHub
commit 22a5bb9826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);