|
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 |
| bool | IsSourceTV () const |
| 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.
Referenced by operator=(), and Player().
|
delete |
References Player().
| 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::Controller::Controller().
Referenced by IsSourceTV().
|
inlinenoexcept |
The IP the player connected from, captured at connect because the engine offers it only there. Empty for bots.
Definition at line 60 of file Player.hpp.
|
inlinenoexcept |
True for engine bots and the SourceTV relay, which connect without a real SteamID; IsSourceTV tells them apart.
Definition at line 45 of file Player.hpp.
Referenced by IsSourceTV().
| bool VoltMod::Player::IsSourceTV | ( | ) | const |
True for the SourceTV relay: it takes a player slot, but nobody plays it. Read from the controller, so false until the relay has one.
Definition at line 17 of file Player.cpp.
References Controller(), and IsBot().
| 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 22 of file Player.cpp.
References VoltMod::Controller::Controller().
| VoltMod::Pawn VoltMod::Player::Pawn | ( | ) | const |
Definition at line 12 of file Player.cpp.
|
inline |
How long this connection has lasted.
Definition at line 63 of file Player.hpp.
References VoltMod::Time::Now().
|
inlinenoexcept |
This player as a storable reference.
Definition at line 52 of file Player.hpp.
Referenced by VoltMod::CommandRouter::Dispatch(), VoltMod::PlayerManager::GetRef(), and VoltMod::EngineArgBinder::Resolve().
|
inlinenoexcept |
Definition at line 40 of file Player.hpp.
Referenced by VoltMod::CommandRouter::Dispatch(), VoltMod::CommandManager::HandleChatMessage(), and VoltMod::EngineArgBinder::Resolve().
|
inlinenoexcept |
Definition at line 41 of file Player.hpp.
Referenced by VoltMod::Policy::Authorize(), VoltMod::BindPlayerOrSteamId(), and VoltMod::PlayerManager::Get().