|
VoltMod
C++23 framework for CS2 server plugins
|
A live entity, valid for this frame only. More...
#include <Entity.hpp>
Inheritance diagram for VoltMod::Entity:Protected Attributes | |
| EntitySystem * | _sys = nullptr |
| CEntityInstance * | _e = nullptr |
A live entity, valid for this frame only.
The engine can free it between frames: store an EntityRef and resolve it again where you use it. if (entity) is the validity check. A falsy entity reads zero and ignores writes and verbs. Copies are cheap; assignment is deleted so a rebind never reads like a field write.
Fields are generated pairs: Health() reads, SetHealth(100) writes and replicates.
Definition at line 28 of file Entity.hpp.
|
inlinenoexcept |
Definition at line 36 of file Entity.hpp.
|
inlinenoexcept |
Prefer runtime.Entities lookups over building one by hand.
Definition at line 39 of file Entity.hpp.
| void VoltMod::Entity::AcceptInput | ( | std::string_view | input, |
| std::string_view | value = {}, |
||
| const Entity & | activator = {} |
||
| ) | const |
Fire an entity input, such as "Explode" or ("FollowEntity", "!activator", pawn).
Definition at line 134 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::FireInput(), and VoltMod::ReadFile().
Referenced by PlayAnimation().
| QAngle VoltMod::Entity::Angles | ( | ) | const |
Definition at line 103 of file Entity.cpp.
References VoltMod::ReadFile(), and VoltMod::SceneNode().
| Pawn VoltMod::Entity::AsPawn | ( | ) | const |
This entity as a player pawn; falsy for anything else, such as a prop or a grenade.
Definition at line 178 of file Pawn.cpp.
References _e, _sys, and ClassName().
Referenced by VoltMod::EntitySystem::Pawn().
| std::string_view VoltMod::Entity::ClassName | ( | ) | const |
Such as "player". Points into engine memory: copy it to keep it.
Definition at line 87 of file Entity.cpp.
References _e.
Referenced by AsPawn().
Play a .vsndevts event from this entity, to everyone or to recipients.
Definition at line 242 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::Bindings::EmitSoundParams, and VoltMod::ReadFile().
| void VoltMod::Entity::EmitSound | ( | std::string_view | soundEvent, |
| IRecipientFilter & | recipients, | ||
| float | volume = 1.0f |
||
| ) | const |
Definition at line 250 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::Bindings::EmitSoundFilter, VoltMod::Address::Ptr(), VoltMod::ReadFile(), and VoltMod::EmitSoundParams::SoundName.
| int VoltMod::Entity::Index | ( | ) | const |
Network index; -1 when falsy.
Definition at line 77 of file Entity.cpp.
References _e.
Referenced by VoltMod::Visibility::OnCheckTransmit(), and VoltMod::Pawn::Slot().
|
inline |
Definition at line 74 of file Entity.hpp.
|
inlineexplicitnoexcept |
Definition at line 44 of file Entity.hpp.
References _e.
| Vector VoltMod::Entity::Origin | ( | ) | const |
World position and rotation, from the scene node.
Definition at line 97 of file Entity.cpp.
References VoltMod::ReadFile(), and VoltMod::SceneNode().
Referenced by VoltMod::Pawn::EyePosition().
| void VoltMod::Entity::PlayAnimation | ( | std::string_view | animation, |
| std::string_view | idle = {} |
||
| ) | const |
Play animation once from its first frame, then loop idle.
Definition at line 233 of file Entity.cpp.
References AcceptInput(), and VoltMod::ReadFile().
|
inlinenoexcept |
The engine entity, for calls the framework does not wrap.
Definition at line 47 of file Entity.hpp.
References _e.
Referenced by VoltMod::Damage::Apply(), VoltMod::CollectHiddenPlayer(), and VoltMod::Controller::InputPawn().
| EntityRef VoltMod::Entity::Ref | ( | ) | const |
The handle to store; unset when falsy.
Definition at line 82 of file Entity.cpp.
References _e, VoltMod::ReadFile(), and VoltMod::EntityRef::Unset.
| void VoltMod::Entity::Remove | ( | ) | const |
Remove now.
Definition at line 165 of file Entity.cpp.
References _e, and VoltMod::ReadFile().
Referenced by VoltMod::ScreenEntity::Remove().
Remove after seconds, through the engine's input queue.
Definition at line 181 of file Entity.cpp.
References _e, _sys, VoltMod::Bindings::AddEntityIOEvent, VoltMod::EntitySystem::Bindings(), VoltMod::EntitySystem::Raw(), and VoltMod::ReadFile().
| void VoltMod::Entity::SetModel | ( | std::string_view | path | ) | const |
Definition at line 198 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::IsModelEntity(), VoltMod::ReadFile(), and VoltMod::Bindings::SetModel.
| void VoltMod::Entity::SetMoveType | ( | Schema::MoveType_t | type | ) | const |
Writes both move-type fields; the engine reverts a lone one next tick.
Definition at line 120 of file Entity.cpp.
| void VoltMod::Entity::SetRender | ( | Schema::RenderMode_t | mode, |
| Color | color | ||
| ) | const |
Write m_nRenderMode and m_clrRender together. kRenderTransAlpha makes the alpha show.
Definition at line 216 of file Entity.cpp.
References _e, VoltMod::IsModelEntity(), VoltMod::ReadFile(), and VoltMod::Schema::CBaseModelEntity::SetRenderMode().
Referenced by SetVisible().
Render and collision scale, clamped to 0.05-3: larger values have crashed the server.
Definition at line 206 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::FireInput(), VoltMod::MaxScale, VoltMod::MinScale, and VoltMod::ReadFile().
Fade to alpha, or restore. A pawn's held weapons and wearables stay visible; hide a player completely with Visibility.
Definition at line 227 of file Entity.cpp.
References VoltMod::Color::A, VoltMod::Schema::kRenderNormal, VoltMod::Schema::kRenderTransAlpha, VoltMod::ReadFile(), and SetRender().
Spawn an entity from EntitySystem::Create; the engine takes the keyvalues.
Definition at line 126 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::Bindings::DispatchSpawn, and VoltMod::ReadFile().
| void VoltMod::Entity::StopSound | ( | std::string_view | soundEvent | ) | const |
Stop every soundEvent this entity is playing, for everyone.
Definition at line 266 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::ReadFile(), and VoltMod::Bindings::StopSound.
| void VoltMod::Entity::Teleport | ( | std::optional< Vector > | origin, |
| std::optional< QAngle > | angles, | ||
| std::optional< Vector > | velocity | ||
| ) | const |
Move the entity; std::nullopt leaves that part unchanged. Does nothing when the Teleport slot did not bind.
Definition at line 109 of file Entity.cpp.
References _e, _sys, VoltMod::EntitySystem::Bindings(), VoltMod::ReadFile(), and VoltMod::Bindings::Teleport.
|
protected |
Definition at line 32 of file Entity.hpp.
Referenced by AcceptInput(), AsPawn(), VoltMod::Controller::ChangeTeam(), ClassName(), EmitSound(), EmitSound(), VoltMod::Controller::ExecuteCommand(), Index(), VoltMod::Pawn::IsAlive(), VoltMod::Controller::Kick(), operator bool(), Raw(), Ref(), Remove(), RemoveAfter(), VoltMod::Controller::Respawn(), SetModel(), SetRender(), SetScale(), VoltMod::Pawn::Slay(), Spawn(), StopSound(), and Teleport().
|
protected |
Definition at line 31 of file Entity.hpp.
Referenced by AcceptInput(), AsPawn(), VoltMod::Controller::ChangeTeam(), VoltMod::Pawn::Controller(), EmitSound(), EmitSound(), VoltMod::Controller::ExecuteCommand(), VoltMod::Pawn::GiveItem(), VoltMod::Pawn::HoldFire(), VoltMod::Controller::InputPawn(), VoltMod::Controller::Kick(), VoltMod::Controller::Pawn(), RemoveAfter(), VoltMod::Pawn::RemoveWeapon(), VoltMod::Controller::Respawn(), VoltMod::Pawn::SelectWeapon(), SetModel(), SetScale(), VoltMod::Pawn::Slay(), VoltMod::Pawn::Slot(), Spawn(), StopSound(), VoltMod::Pawn::StripWeapons(), Teleport(), and VoltMod::Pawn::Weapons().