VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
PlayerRef.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace VoltMod
6{
7
8/**
9 * @brief A storable reference to a player: the slot plus the SteamID that occupied it.
10 *
11 * @ref Controller and @ref Pawn are frame-local, and a bare slot number is not enough on its own -
12 * a slot changes hands, so work scheduled against one can land on whoever sits there next. Keep a
13 * PlayerRef instead and check both halves when it is resolved: the slot says where to look and the
14 * SteamID says whether it is still the same player.
15 *
16 * `SteamId == 0` means a bot, which no reference can pin down across a reconnect.
17 */
19{
20 int Slot = -1;
22
23 explicit operator bool() const noexcept { return Slot >= 0; }
24 bool operator==(const PlayerRef&) const noexcept = default;
25};
26
27} // namespace VoltMod
Static utilities for converting between SteamID formats (64-bit, SteamID2, SteamID3).
Definition SteamId.hpp:12
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
A storable reference to a player: the slot plus the SteamID that occupied it.
Definition PlayerRef.hpp:19
bool operator==(const PlayerRef &) const noexcept=default