|
VoltMod
C++23 framework for CS2 server plugins
|
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Controller is the identity that stays. More...
#include <Pawn.hpp>
Inheritance diagram for VoltMod::Pawn:Additional Inherited Members | |
Protected Attributes inherited from VoltMod::Entity | |
| EntitySystem * | _sys = nullptr |
| CEntityInstance * | _e = nullptr |
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Controller is the identity that stays.
| VoltMod::Controller VoltMod::Pawn::Controller | ( | ) | const |
The owning player's controller.
Definition at line 213 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Controller(), and Slot().
Referenced by VoltMod::ObserverTarget().
|
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.
| Vector VoltMod::Pawn::EyePosition | ( | ) | const |
Where shots start: the origin plus the view offset.
Definition at line 24 of file Pawn.cpp.
References VoltMod::Entity::Origin().
| Entity VoltMod::Pawn::GiveItem | ( | std::string_view | item | ) | const |
Give an item by class name, such as "weapon_ak47". A weapon the pawn's team cannot buy is given through a same-frame team swap. The given item; falsy when the engine refused it.
Definition at line 54 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Bindings(), VoltMod::Bindings::GiveNamedItem, VoltMod::None, VoltMod::Opposite(), VoltMod::ReadFile(), and VoltMod::Log::Warn().
|
inline |
The FL_GODMODE flag, which is what makes a CS2 pawn take no damage.
Definition at line 40 of file Pawn.hpp.
References VoltMod::ReadFile().
Add amount health, up to MaxHealth. False when nothing changed, such as a dead pawn.
Definition at line 42 of file Pawn.cpp.
References IsAlive(), and VoltMod::ReadFile().
Keep the weapon in hand from either attack before engine tick tick. A weapon switched to later is not covered, so call it every frame to hold fire for a while.
Definition at line 151 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Get(), VoltMod::ReadFile(), and VoltMod::Schema::CBasePlayerWeapon::SetNextPrimaryAttackTick().
|
inline |
Definition at line 29 of file Pawn.hpp.
References VoltMod::Entity::_e, and VoltMod::ReadFile().
Referenced by Heal(), and RemoveWeapon().
|
inline |
Definition at line 31 of file Pawn.hpp.
References VoltMod::ReadFile().
| std::string VoltMod::Pawn::ModelName | ( | ) | const |
Current model path; empty when unavailable.
Definition at line 201 of file Pawn.cpp.
References VoltMod::Schema::View::Base(), and VoltMod::ReadFile().
| VoltMod::ObserverMode VoltMod::Pawn::ObserverMode | ( | ) | const |
Definition at line 183 of file Pawn.cpp.
References VoltMod::None, and VoltMod::ReadFile().
Remove weapon through the engine's input queue, so it is safe inside a death event. A weapon in a live pawn's hand is first swapped for the one held before it.
Definition at line 139 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Get(), IsAlive(), VoltMod::ReadFile(), and SelectWeapon().
Draw weapon. Does nothing for a weapon the pawn does not carry, or when the SelectItem index did not bind.
Definition at line 122 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Bindings(), VoltMod::ReadFile(), VoltMod::Bindings::SelectItem, and Weapons().
Referenced by RemoveWeapon().
Definition at line 29 of file Pawn.cpp.
References VoltMod::ReadFile().
| Status VoltMod::Pawn::SetObserverMode | ( | VoltMod::ObserverMode | mode | ) | const |
Definition at line 189 of file Pawn.cpp.
References VoltMod::Error::NotReady(), and VoltMod::ReadFile().
Set the pawn's velocity and lift it off the ground this tick, so the engine keeps the velocity. SetAbsVelocity alone leaves a grounded pawn grounded.
Definition at line 34 of file Pawn.cpp.
References VoltMod::ReadFile().
| void VoltMod::Pawn::Slay | ( | ) | const |
Does nothing when the CommitSuicide index did not bind.
Definition at line 170 of file Pawn.cpp.
References VoltMod::Entity::_e, VoltMod::Entity::_sys, VoltMod::EntitySystem::Bindings(), and VoltMod::Bindings::CommitSuicide.
| int VoltMod::Pawn::Slot | ( | ) | const |
The owning player's slot, or -1. Constant time.
Definition at line 218 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Get(), VoltMod::Entity::Index(), VoltMod::IsValidSlot(), and VoltMod::ReadFile().
Referenced by Controller(), VoltMod::HookTeleport(), and VoltMod::EngineArgBinder::Resolve().
Remove every weapon, and with removeSuit the armor and defuse kit too.
Definition at line 91 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Bindings(), VoltMod::ReadFile(), and VoltMod::Bindings::RemoveAllItems.
| std::vector< Entity > VoltMod::Pawn::Weapons | ( | ) | const |
The carried weapons, knife and grenades included.
Definition at line 102 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::EntitySystem::Get(), and VoltMod::ReadFile().
Referenced by SelectWeapon().