|
VoltMod
C++23 framework for CS2 server plugins
|
Every entity's damage, from CBaseEntity::TakeDamageOld, and a way to deal it. More...
#include <Damage.hpp>
Public Member Functions | |
| Damage (EntitySystem &entities, const Bindings &bindings, Interfaces &interfaces, GameEvents &events) | |
| Damage (const Damage &)=delete | |
| Damage & | operator= (const Damage &)=delete |
| Status | Available () const |
| void | Apply (const Entity &victim, const DamageInfo &info) |
Public Attributes | |
| Event< DamageHit & > | Before |
Every entity's damage, from CBaseEntity::TakeDamageOld, and a way to deal it.
The hook sits where the function starts, so it sees players, props and anything else that takes damage, including hits from Apply. It installs on the first Before subscription.
Game-thread only.
Definition at line 79 of file Damage.hpp.
| VoltMod::Damage::Damage | ( | EntitySystem & | entities, |
| const Bindings & | bindings, | ||
| Interfaces & | interfaces, | ||
| GameEvents & | events ) |
entities resolves the refs, bindings supplies the two damage functions, interfaces the event manager and events each client's listener. All must outlive this service; the Runtime declares them above.
Definition at line 37 of file Damage.cpp.
Referenced by Damage(), and operator=().
|
delete |
References Damage().
| void VoltMod::Damage::Apply | ( | const Entity & | victim, |
| const DamageInfo & | info ) |
Deal info to victim through the engine, so death, the kill feed and player_death credit info's attacker as if its own weapon had hit. Does nothing for a falsy victim or while Available fails.
Definition at line 92 of file Damage.cpp.
References VoltMod::DamageInfo::Amount, VoltMod::DamageInfo::Attacker, Available(), VoltMod::EngineDamageResult::DamageDealt, VoltMod::EngineDamageResult::HealthLost, VoltMod::DamageInfo::Inflictor, VoltMod::Entity::Origin(), VoltMod::EngineDamageResult::OriginatingInfo, VoltMod::EngineDamageResult::PreModifiedDamage, VoltMod::Entity::Raw(), VoltMod::EngineDamageResult::TotalledDamageDealt, VoltMod::EngineDamageResult::TotalledHealthLost, VoltMod::DamageInfo::Type, and VoltMod::DamageInfo::Weapon.
| Status VoltMod::Damage::Available | ( | ) | const |
Why damage cannot be hooked or dealt: a damage signature did not bind.
Definition at line 79 of file Damage.cpp.
References VoltMod::Error::Unsupported().
Referenced by Apply().
Raised before the engine applies a hit.
Definition at line 94 of file Damage.hpp.