|
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>
Public Member Functions | |
| bool | IsAlive () const |
| bool | IsOnGround () const |
| Vector | EyePosition () const |
| Vector | EyeForward () const |
| void | Slay () const |
| bool | Godmode () const |
| void | SetGodmode (bool on) const |
| void | SetVelocity (Vector velocity) const |
| bool | Heal (int amount) const |
| Entity | GiveItem (std::string_view item) const |
| Entity | GiveKnife () const |
| bool | StripWeapons (bool removeSuit=true) const |
| std::vector< Entity > | Weapons () const |
| void | SelectWeapon (const Entity &weapon) const |
| void | RemoveWeapon (const Entity &weapon) const |
| Entity | ActiveWeapon () const |
| void | HoldFire (int tick) const |
| void | HoldFire (const Clock &clock) const |
| void | HoldCrouch (float amount=1.0f) const |
| void | ReleaseCrouch () const |
| VoltMod::ObserverMode | ObserverMode () const |
| Status | SetObserverMode (VoltMod::ObserverMode mode) const |
| std::string | ModelName () const |
| VoltMod::Controller | Controller () const |
| int | Slot () const |
| Entity () noexcept | |
| Entity (EntitySystem &entities, CEntityInstance *raw) noexcept | |
| Entity (const Entity &)=default | |
| Public Member Functions inherited from VoltMod::Entity | |
| Entity () noexcept | |
| Entity (EntitySystem &entities, CEntityInstance *raw) noexcept | |
| Entity (const Entity &)=default | |
| Entity & | operator= (const Entity &)=delete |
| operator bool () const noexcept | |
| CEntityInstance * | Raw () const noexcept |
| int | Index () const |
| EntityRef | Ref () const |
| std::string_view | ClassName () const |
| Pawn | AsPawn () const |
| std::optional< WeaponData > | FindWeaponData () const |
| Vector | Origin () const |
| QAngle | Angles () const |
| void | Teleport (std::optional< Vector > origin, std::optional< QAngle > angles, std::optional< Vector > velocity) const |
| Schema::MoveType_t | MoveType () const |
| void | SetMoveType (Schema::MoveType_t type) const |
| void | Spawn (KeyValues &values) const |
| void | AcceptInput (std::string_view input, std::string_view value={}, const Entity &activator={}) const |
| void | Remove () const |
| void | RemoveAfter (float seconds) const |
| void | SetParent (const Entity &parent, std::string_view attachment={}) const |
| void | ClearParent () const |
| void | StopEffect (bool immediately) const |
| void | EmitSound (std::string_view soundEvent, float volume=1.0f) const |
| void | EmitSound (std::string_view soundEvent, IRecipientFilter &recipients, float volume=1.0f) const |
| void | EmitSoundTo (std::string_view soundEvent, int slot, float volume=1.0f) const |
| void | StopSound (std::string_view soundEvent) const |
| void | SetModel (std::string_view path) const |
| void | Follow (const Entity &parent, bool copyBones) const |
| void | SetScale (float scale) const |
| void | SetRender (Schema::RenderMode_t mode, Color color) const |
| void | SetVisible (bool visible, uint8_t alpha=0) const |
| void | PlayAnimation (std::string_view animation, std::string_view idle={}) const |
| void | LoopAnimation (std::string_view animation) const |
| void | SetPlaybackRate (float rate) const |
| void | SetSkin (int skin) const |
| void | SetBodygroup (std::string_view group, int value) const |
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.
| Entity VoltMod::Pawn::ActiveWeapon | ( | ) | const |
The weapon in hand; falsy when there is none.
Definition at line 171 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::Schema::CPlayer_WeaponServices::ActiveWeapon(), and Entity().
Referenced by VoltMod::FireHold::Hold(), HoldFire(), and VoltMod::FireHold::Release().
| VoltMod::Controller VoltMod::Pawn::Controller | ( | ) | const |
The owning player's controller.
Definition at line 278 of file Pawn.cpp.
References VoltMod::Entity::_sys, and Slot().
|
inlinenoexcept |
Definition at line 47 of file Entity.hpp.
Referenced by ActiveWeapon(), GiveItem(), GiveKnife(), RemoveWeapon(), SelectWeapon(), Slot(), and Weapons().
|
default |
|
inlinenoexcept |
Prefer runtime.Entities lookups over building one by hand.
Definition at line 50 of file Entity.hpp.
| Vector VoltMod::Pawn::EyeForward | ( | ) | const |
The unit vector the player aims along.
Definition at line 40 of file Pawn.cpp.
References VoltMod::AngleToForward().
Referenced by VoltMod::Trace::FromEyes().
| Vector VoltMod::Pawn::EyePosition | ( | ) | const |
Where shots start: the origin plus the view offset.
Definition at line 35 of file Pawn.cpp.
References VoltMod::Entity::Origin().
Referenced by VoltMod::Trace::FromEyes().
| 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 70 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::Schema::View::Base(), Entity(), VoltMod::None, VoltMod::Opposite(), and VoltMod::Log::Warn().
Referenced by GiveKnife().
| Entity VoltMod::Pawn::GiveKnife | ( | ) | const |
Give the default knife of the pawn's team: "weapon_knife" is the CT one.
Definition at line 107 of file Pawn.cpp.
References Entity(), GiveItem(), and VoltMod::T.
|
inline |
| bool VoltMod::Pawn::Heal | ( | int | amount | ) | const |
| void VoltMod::Pawn::HoldCrouch | ( | float | amount = 1.0f | ) | const |
Keep the pawn crouched whatever its player holds; call it every frame to hold it. Each step of amount past 1 lowers the eye 18 units more.
Definition at line 199 of file Pawn.cpp.
References VoltMod::Schema::CCSPlayer_MovementServices::DuckAmount(), VoltMod::Schema::CCSPlayer_MovementServices::Ducked(), VoltMod::Schema::CCSPlayer_MovementServices::DuckOverride(), VoltMod::Schema::CCSPlayer_MovementServices::SetDuckAmount(), VoltMod::Schema::CCSPlayer_MovementServices::SetDucked(), and VoltMod::Schema::CCSPlayer_MovementServices::SetDuckOverride().
| void VoltMod::Pawn::HoldFire | ( | const Clock & | clock | ) | const |
HoldFire until HoldFireTick; call it every frame to hold fire.
Definition at line 194 of file Pawn.cpp.
References HoldFire(), and VoltMod::HoldFireTick().
| void VoltMod::Pawn::HoldFire | ( | int | tick | ) | const |
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 177 of file Pawn.cpp.
References ActiveWeapon(), VoltMod::Schema::CBasePlayerWeapon::NextPrimaryAttackTick(), VoltMod::Schema::CBasePlayerWeapon::NextSecondaryAttackTick(), VoltMod::Entity::Raw(), VoltMod::Schema::CBasePlayerWeapon::SetNextPrimaryAttackTick(), and VoltMod::Schema::CBasePlayerWeapon::SetNextSecondaryAttackTick().
Referenced by HoldFire().
|
inline |
Definition at line 45 of file Pawn.hpp.
References VoltMod::Entity::_e.
Referenced by Heal(), VoltMod::MovementFreeze::Hold(), VoltMod::GlowVision::Refresh(), RemoveWeapon(), VoltMod::EngineArgBinder::Resolve(), and VoltMod::MovementFreeze::Sync().
| std::string VoltMod::Pawn::ModelName | ( | ) | const |
Current model path; empty when unavailable.
Definition at line 266 of file Pawn.cpp.
References VoltMod::Schema::CModelState::ModelName(), and VoltMod::Schema::CSkeletonInstance::ModelState().
Referenced by VoltMod::GlowVision::Refresh().
| VoltMod::ObserverMode VoltMod::Pawn::ObserverMode | ( | ) | const |
Definition at line 248 of file Pawn.cpp.
References VoltMod::None, and VoltMod::Schema::CPlayer_ObserverServices::ObserverMode().
| void VoltMod::Pawn::ReleaseCrouch | ( | ) | const |
Let the pawn stand up again once its player lets go of crouch.
Definition at line 220 of file Pawn.cpp.
References VoltMod::Schema::CCSPlayer_MovementServices::DuckAmount(), VoltMod::Schema::CCSPlayer_MovementServices::SetDuckAmount(), and VoltMod::Schema::CCSPlayer_MovementServices::SetDuckOverride().
| void VoltMod::Pawn::RemoveWeapon | ( | const Entity & | weapon | ) | const |
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 159 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::Schema::CPlayer_WeaponServices::ActiveWeapon(), Entity(), IsAlive(), VoltMod::Schema::CPlayer_WeaponServices::LastWeapon(), VoltMod::Entity::Ref(), VoltMod::Entity::RemoveAfter(), and SelectWeapon().
| void VoltMod::Pawn::SelectWeapon | ( | const Entity & | weapon | ) | const |
Draw weapon. Does nothing for a weapon the pawn does not carry, or when the SelectItem index did not bind.
Definition at line 143 of file Pawn.cpp.
References VoltMod::Entity::_sys, VoltMod::Schema::View::Base(), Entity(), VoltMod::Entity::Raw(), VoltMod::Entity::Ref(), and Weapons().
Referenced by RemoveWeapon().
| Status VoltMod::Pawn::SetObserverMode | ( | VoltMod::ObserverMode | mode | ) | const |
Definition at line 254 of file Pawn.cpp.
References VoltMod::Error::NotReady(), and VoltMod::Schema::CPlayer_ObserverServices::SetObserverMode().
| void VoltMod::Pawn::SetVelocity | ( | Vector | velocity | ) | const |
| void VoltMod::Pawn::Slay | ( | ) | const |
Does nothing when the CommitSuicide index did not bind.
Definition at line 235 of file Pawn.cpp.
References VoltMod::Entity::_e, and VoltMod::Entity::_sys.
| int VoltMod::Pawn::Slot | ( | ) | const |
The owning player's slot, or -1. Constant time.
Definition at line 283 of file Pawn.cpp.
References VoltMod::Entity::_sys, Entity(), VoltMod::Entity::Index(), and VoltMod::IsValidSlot().
Referenced by Controller(), and VoltMod::HookTeleport().
| bool VoltMod::Pawn::StripWeapons | ( | bool | removeSuit = true | ) | const |
Remove every weapon, and with removeSuit the armor and defuse kit too.
Definition at line 112 of file Pawn.cpp.
References VoltMod::Entity::_sys, and VoltMod::Schema::View::Base().
| std::vector< Entity > VoltMod::Pawn::Weapons | ( | ) | const |
The carried weapons, knife and grenades included.
Definition at line 123 of file Pawn.cpp.
References VoltMod::Entity::_sys, Entity(), and VoltMod::Schema::CPlayer_WeaponServices::MyWeapons().
Referenced by SelectWeapon().