|
VoltMod
C++23 framework for CS2 server plugins
|
One connected player, owned by PlayerManager for the length of the connection. More...
#include <Player.hpp>
Public Member Functions | |
| Player (int slot, int64_t steamId, std::string connectName, std::string ip, EntitySystem *entities) | |
| Player (const Player &)=delete | |
| Player & | operator= (const Player &)=delete |
| int | Slot () const noexcept |
| int64_t | SteamId () const noexcept |
| bool | IsBot () const noexcept |
| PlayerRef | Ref () const noexcept |
| std::string | Name () const |
| std::string_view | Ip () const noexcept |
| std::chrono::seconds | Playtime () const |
| VoltMod::Controller | Controller () const |
| VoltMod::Pawn | Pawn () const |
One connected player, owned by PlayerManager for the length of the connection.
A Player& stays valid while the player is connected. Store a PlayerRef across anything that can outlive that, and resolve it with runtime.Players.Get(ref). Identity only: keep plugin state in your own managers, keyed by SteamID.
Definition at line 22 of file Player.hpp.
|
inline |
Definition at line 27 of file Player.hpp.
| VoltMod::Controller VoltMod::Player::Controller | ( | ) | const |
This player's entities, valid for this frame; falsy when there are none. Include <VoltMod/Entities/EntitySystem.hpp> or <VoltMod/Api.hpp> to use them.
Definition at line 7 of file Player.cpp.
References VoltMod::EntitySystem::Controller().
|
inlinenoexcept |
The IP the player connected from, captured at connect because the engine offers it only there. Empty for bots.
Definition at line 55 of file Player.hpp.
|
inlinenoexcept |
True for engine bots, which connect without a real SteamID.
Definition at line 44 of file Player.hpp.
| std::string VoltMod::Player::Name | ( | ) | const |
The scoreboard name, read from the controller. Falls back to the connect-time name while there is no controller yet - between ClientConnected and the first spawn.
Definition at line 17 of file Player.cpp.
References VoltMod::EntitySystem::Controller(), and VoltMod::ReadFile().
| VoltMod::Pawn VoltMod::Player::Pawn | ( | ) | const |
Definition at line 12 of file Player.cpp.
References VoltMod::EntitySystem::Pawn().
|
inline |
How long this connection has lasted.
Definition at line 58 of file Player.hpp.
References VoltMod::Time::Now().
|
inlinenoexcept |
This player as a storable reference.
Definition at line 47 of file Player.hpp.
References VoltMod::PlayerRef::Slot.
|
inlinenoexcept |
Definition at line 40 of file Player.hpp.
Referenced by VoltMod::CommandRouter::Dispatch().
|
inlinenoexcept |
Definition at line 41 of file Player.hpp.
Referenced by VoltMod::BindPlayerOrSteamId().