|
VoltMod
C++23 framework for CS2 server plugins
|
Per-client network access: latency, userids, usercmd status and the client's replicated userinfo cvars. More...
#include <NetChannel.hpp>
Public Member Functions | |
| NetChannels (Interfaces &interfaces) | |
| INetChannelInfo * | GetNetInfo (int slot) const |
| bool | HasClient (int slot) const |
| float | EngineLatency (int slot) const |
| int | GetUserId (int slot) const |
| std::optional< CommandStatus > | GetCommandStatus (int slot) const |
| std::string_view | GetUserInfoCvar (int slot, std::string_view name) const |
Per-client network access: latency, userids, usercmd status and the client's replicated userinfo cvars.
Stateless wrapper over IVEngineServer2 and ISource2GameClients: every call reads the engine live, so nothing here needs a lifecycle. Bots, empty slots and clients already torn down have no channel, and each accessor degrades to a null/zero result rather than asserting.
Definition at line 32 of file NetChannel.hpp.
|
inlineexplicit |
interfaces supplies IVEngineServer2; it must outlive this service.
Definition at line 36 of file NetChannel.hpp.
| float VoltMod::NetChannels::EngineLatency | ( | int | slot | ) | const |
Round-trip time in seconds, or 0 when the channel is unavailable.
Definition at line 17 of file NetChannel.cpp.
References GetNetInfo().
| std::optional< CommandStatus > VoltMod::NetChannels::GetCommandStatus | ( | int | slot | ) | const |
How the server is keeping up with slot's usercmds, or empty when it has no player. A rising gap between received and executed, or starved and discarded ticks, is how fakelag shows.
Definition at line 35 of file NetChannel.cpp.
References VoltMod::IsValidSlot().
| INetChannelInfo * VoltMod::NetChannels::GetNetInfo | ( | int | slot | ) | const |
The client's channel, or nullptr when slot has none (bot, empty, disconnecting).
Definition at line 11 of file NetChannel.cpp.
References VoltMod::IsValidSlot().
Referenced by EngineLatency(), and HasClient().
| int VoltMod::NetChannels::GetUserId | ( | int | slot | ) | const |
The userid game events name the player by, or -1 when slot is empty. Bots have one too.
Definition at line 23 of file NetChannel.cpp.
References VoltMod::IsValidSlot().
| std::string_view VoltMod::NetChannels::GetUserInfoCvar | ( | int | slot, |
| std::string_view | name ) const |
The client's value for the userinfo convar name, or empty when the slot has no client, the engine is unavailable, or the client never sent one.
The view borrows the engine's own buffer, which the next userinfo update replaces: read it or copy it before returning to the engine, and never store it.
Definition at line 53 of file NetChannel.cpp.
References VoltMod::IsValidSlot().
|
inline |
Whether slot holds a human client: false for a bot, an empty slot or one disconnecting.
Definition at line 42 of file NetChannel.hpp.
References GetNetInfo().