VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Player.cpp
Go to the documentation of this file.
1
#include <
VoltMod/Entities/EntitySystem.hpp
>
2
#include <
VoltMod/Players/Player.hpp
>
3
4
namespace
VoltMod
5
{
6
7
VoltMod::Controller
Player::Controller
()
const
8
{
9
return
_entities ? _entities->
Controller
(_slot) :
VoltMod::Controller
{};
10
}
11
12
VoltMod::Pawn
Player::Pawn
()
const
13
{
14
return
_entities ? _entities->Pawn(_slot) :
VoltMod::Pawn
{};
15
}
16
17
bool
Player::IsSourceTV
()
const
18
{
19
return
IsBot
() &&
Controller
().IsHLTV();
20
}
21
22
std::string
Player::Name
()
const
23
{
24
if
(_entities)
25
{
26
// The controller carries the live scoreboard name. It is empty before the player has a
27
// controller, and the engine also reports an empty name for a moment around connect.
28
if
(
const
VoltMod::Controller
controller = _entities->
Controller
(_slot))
29
{
30
std::string live(controller.PlayerName());
31
if
(!live.empty())
32
{
33
return
live;
34
}
35
}
36
}
37
return
_connectName;
38
}
39
40
}
// namespace VoltMod
EntitySystem.hpp
Player.hpp
VoltMod::Controller
A player's identity behind a slot: name, money, team, scoreboard row. It survives death and respawn; ...
Definition
Controller.hpp:20
VoltMod::Controller::Controller
Controller()=default
VoltMod::Pawn
A player's body: health, armor, movement, aim, weapons. The engine replaces it on every spawn; the Co...
Definition
Pawn.hpp:35
VoltMod::Player::IsSourceTV
bool IsSourceTV() const
Definition
Player.cpp:17
VoltMod::Player::IsBot
bool IsBot() const noexcept
Definition
Player.hpp:45
VoltMod::Player::Pawn
VoltMod::Pawn Pawn() const
Definition
Player.cpp:12
VoltMod::Player::Name
std::string Name() const
Definition
Player.cpp:22
VoltMod::Player::Controller
VoltMod::Controller Controller() const
Definition
Player.cpp:7
VoltMod
Definition
Options.hpp:13
src
Players
Player.cpp
Generated by
1.15.0