|
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 36 of file Damage.cpp.
| 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 91 of file Damage.cpp.
References Available(), VoltMod::Bindings::BuildDamageInfo, VoltMod::EntitySystem::Get(), VoltMod::EngineDamageResult::OriginatingInfo, VoltMod::Entity::Raw(), VoltMod::ReadFile(), and VoltMod::Bindings::TakeDamage.
| Status VoltMod::Damage::Available | ( | ) | const |
Why damage cannot be hooked or dealt: a damage signature did not bind.
Definition at line 78 of file Damage.cpp.
References VoltMod::Bindings::BuildDamageInfo, VoltMod::Bindings::TakeDamage, and VoltMod::Error::Unsupported().
Referenced by Apply().
Raised before the engine applies a hit.
Definition at line 94 of file Damage.hpp.