diff --git a/src/game/client/components/hud.h b/src/game/client/components/hud.h index 6752539f3..d28ba3a19 100644 --- a/src/game/client/components/hud.h +++ b/src/game/client/components/hud.h @@ -66,6 +66,7 @@ class CHud : public CComponent void RenderLocalTime(float x); static constexpr float MOVEMENT_INFORMATION_LINE_HEIGHT = 8.0f; + public: CHud(); virtual int Sizeof() const override { return sizeof(*this); } diff --git a/src/game/server/entities/plasma.cpp b/src/game/server/entities/plasma.cpp index 8eb06466d..33f56a312 100644 --- a/src/game/server/entities/plasma.cpp +++ b/src/game/server/entities/plasma.cpp @@ -44,21 +44,9 @@ void CPlasma::Tick() } m_LifeTime--; Move(); - if(!HitCharacter(pTarget)) - { - // Check if the plasma bullet is stopped by a solid block or a laser stopper - int HasIntersection = GameServer()->Collision()->IntersectNoLaser(m_Pos, m_Pos + m_Core, 0, 0); - if(HasIntersection) - { - if(m_Explosive) - { - // Even in the case of an explosion due to a collision with obstacles, only one player is affected - GameServer()->CreateExplosion( - m_Pos, m_ForClientID, WEAPON_GRENADE, true, pTarget->Team(), pTarget->TeamMask()); - } - Reset(); - } - } + HitCharacter(pTarget); + // Plasma bullets may explode twice if they would hit both a player and an obstacle in the next move step + HitObstacle(pTarget); } void CPlasma::Move() @@ -95,6 +83,24 @@ bool CPlasma::HitCharacter(CCharacter *pTarget) return true; } +bool CPlasma::HitObstacle(CCharacter *pTarget) +{ + // Check if the plasma bullet is stopped by a solid block or a laser stopper + int HasIntersection = GameServer()->Collision()->IntersectNoLaser(m_Pos, m_Pos + m_Core, 0, 0); + if(HasIntersection) + { + if(m_Explosive) + { + // Even in the case of an explosion due to a collision with obstacles, only one player is affected + GameServer()->CreateExplosion( + m_Pos, m_ForClientID, WEAPON_GRENADE, true, pTarget->Team(), pTarget->TeamMask()); + } + Reset(); + return true; + } + return false; +} + void CPlasma::Reset() { m_MarkedForDestroy = true; diff --git a/src/game/server/entities/plasma.h b/src/game/server/entities/plasma.h index 35c8ce6e2..f4ca948de 100644 --- a/src/game/server/entities/plasma.h +++ b/src/game/server/entities/plasma.h @@ -14,6 +14,7 @@ * impact but at the last position of the plasma bullet. The same applies if a plasma bullet explodes due to a collision * with a laser stopper or a solid block * Plasma bullets move every tick in the assigned direction and then accelerate by the factor PLASMA_ACCEL + * Plasma bullets can explode twice if they would hit both a player and an obstacle in the next movement step * Plasma bullets will stop existing as soon as: * - The player they were created for do no longer exist * - They have had a collision with a player, a solid block or a laser stopper @@ -28,8 +29,9 @@ class CPlasma : public CEntity int m_EvalTick; int m_LifeTime; - bool HitCharacter(CCharacter *pTarget); void Move(); + bool HitCharacter(CCharacter *pTarget); + bool HitObstacle(CCharacter *pTarget); public: CPlasma(CGameWorld *pGameWorld, vec2 Pos, vec2 Dir, bool Freeze,