7#include <entityhandle.h>
8#include <networksystem/networkvar.h>
33static_assert(
sizeof(Pawn) <= 160,
"Pawn is a frame-local value; keep the field list tight.");
37 return Origin() + ViewOffset();
47 SetFlags(on ? (Flags() | FL_GODMODE) : (Flags() & ~FL_GODMODE));
53 SetAbsVelocity(velocity);
55 SetFlags(Flags() & ~FL_ONGROUND);
60 const int health = Health();
61 const int healed = std::min(health + amount, MaxHealth());
62 if (!
IsAlive() || healed <= health)
73 if (!
_sys || !services || item.empty())
77 const auto& give =
_sys->Bindings().GiveNamedItem;
83 const std::string className(item);
84 if (
void* given = give(services.
Base(), className.c_str()))
86 return {*
_sys,
static_cast<CEntityInstance*
>(given)};
97 void* given = give(services.
Base(), className.c_str());
102 Log::Warn(
"The engine refused '{}' for both teams.", item);
104 return {*
_sys,
static_cast<CEntityInstance*
>(given)};
115 if (!
_sys || !services || !
_sys->Bindings().RemoveAllItems)
119 _sys->Bindings().RemoveAllItems(services.
Base(), removeSuit);
125 std::vector<Entity> weapons;
127 const auto* handles =
128 services ?
static_cast<const CNetworkUtlVectorBase<CEntityHandle>*
>(services.
MyWeapons()) :
nullptr;
129 if (!
_sys || !handles)
133 for (
int i = 0; i < handles->Count(); ++i)
135 if (
const Entity weapon =
_sys->Get(
EntityRef{static_cast<uint32_t>(handles->Element(i).ToInt())}))
137 weapons.push_back(weapon);
146 const bool bound =
_sys && services &&
_sys->Bindings().SelectItem;
147 if (!weapon || !bound)
151 const bool carried = std::ranges::any_of(
Weapons(), [&](
const Entity& held) {
return held.
Ref() == weapon.
Ref(); });
207 const bool crouched =
217 SetFlags(Flags() | FL_DUCKING);
237 if (
_e &&
_sys &&
_sys->Bindings().CommitSuicide)
239 _sys->Bindings().CommitSuicide(
_e,
false,
true);
259 return std::unexpected(
Error::NotReady(
"observer services unavailable"));
275 return path ? std::string(path) : std::string{};
287 const int slot = controller.
Index() - 1;
288 return controller &&
IsValidSlot(slot) ? slot : -1;
The engine's simulation clock, read straight from IVEngineServer2::GetServerGlobals().
A player's identity behind a slot: name, money, team, scoreboard row. It survives death and respawn; ...
void RemoveAfter(float seconds) const
std::string_view ClassName() const
CEntityInstance * Raw() const noexcept
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
void HoldCrouch(float amount=1.0f) const
std::string ModelName() const
void SetGodmode(bool on) const
Vector EyePosition() const
Vector EyeForward() const
void ReleaseCrouch() const
bool StripWeapons(bool removeSuit=true) const
void SelectWeapon(const Entity &weapon) const
std::vector< Entity > Weapons() const
Entity GiveItem(std::string_view item) const
VoltMod::ObserverMode ObserverMode() const
void RemoveWeapon(const Entity &weapon) const
Entity ActiveWeapon() const
Status SetObserverMode(VoltMod::ObserverMode mode) const
bool Heal(int amount) const
void HoldFire(int tick) const
VoltMod::Controller Controller() const
void SetVelocity(Vector velocity) const
void SetNextPrimaryAttackTick(int32_t value) const
void SetNextSecondaryAttackTick(int32_t value) const
int32_t NextSecondaryAttackTick() const
int32_t NextPrimaryAttackTick() const
void SetDucked(bool value) const
void SetDuckOverride(bool value) const
void SetDuckAmount(float value) const
bool DuckOverride() const
const char * ModelName() const
void SetObserverMode(uint8_t value) const
uint8_t ObserverMode() const
EntityRef LastWeapon() const
EntityRef ActiveWeapon() const
CModelState ModelState() const
void * Base() const noexcept
void Warn(std::format_string< Args... > fmt, Args &&... args)
std::expected< void, Error > Status
Vector AngleToForward(const QAngle &angles)
constexpr bool IsValidSlot(int slot)
static constexpr int HoldFireStep
constexpr Team Opposite(Team team)
int HoldFireTick(const Clock &clock)
static constexpr int HoldFireTicks
static Error NotReady(std::string detail)