Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breakable objects reflecting the Gauss Gun shot that breaks them #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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