Skip to content

Commit

Permalink
Fix breakable objects reflecting the Gauss Gun shot that breaks them
Browse files Browse the repository at this point in the history
  • Loading branch information
Toodles2You committed Aug 22, 2023
1 parent 38fff99 commit d0be0d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions dlls/func_break.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,14 @@ int CBreakable::DamageDecal(int bitsDamageType)
return CBaseEntity::DamageDecal(bitsDamageType);
}

bool CBreakable::ReflectGauss()
{
if (IsBreakable())
return false;

return CBaseEntity::ReflectGauss();
}


class CPushable : public CBreakable
{
Expand All @@ -813,6 +821,8 @@ class CPushable : public CBreakable
bool Save(CSave& save) override;
bool Restore(CRestore& restore) override;

bool ReflectGauss() override;

inline float MaxSpeed() { return m_maxSpeed; }

// breakables use an overridden takedamage
Expand Down Expand Up @@ -1023,3 +1033,11 @@ bool CPushable::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, floa

return true;
}

bool CPushable::ReflectGauss()
{
if (!FBitSet(pev->spawnflags, SF_PUSH_BREAKABLE))
return true;

return CBreakable::ReflectGauss();
}
2 changes: 2 additions & 0 deletions dlls/func_break.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class CBreakable : public CBaseDelay
bool Save(CSave& save) override;
bool Restore(CRestore& restore) override;

bool ReflectGauss() override;

inline bool Explodable() { return ExplosionMagnitude() > 0; }
inline int ExplosionMagnitude() { return pev->impulse; }
inline void ExplosionSetMagnitude(int magnitude) { pev->impulse = magnitude; }
Expand Down

0 comments on commit d0be0d0

Please sign in to comment.