VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::Clock Class Reference

The engine's simulation clock, read straight from IVEngineServer2::GetServerGlobals(). More...

#include <Clock.hpp>

Public Member Functions

 Clock (Interfaces &interfaces)
 
 Clock (const Clock &)=delete
 
Clock & operator= (const Clock &)=delete
 
CGlobalVars * Globals () const
 
int Tick () const
 
float Time () const
 

Detailed Description

The engine's simulation clock, read straight from IVEngineServer2::GetServerGlobals().

Holds no state of its own - every call reads the engine live. It is the timestamp source for anything that must line up with the tick the engine is simulating. Both readings reset when a map starts, so never persist a value across a map change.

Exposed as runtime.Clock.

Definition at line 18 of file Clock.hpp.

Constructor & Destructor Documentation

◆ Clock() [1/2]

VoltMod::Clock::Clock ( Interfaces &  interfaces)
explicit

interfaces supplies IVEngineServer2; it must outlive this service.

Definition at line 8 of file Clock.cpp.

◆ Clock() [2/2]

VoltMod::Clock::Clock ( const Clock &  )
delete

Member Function Documentation

◆ Globals()

CGlobalVars * VoltMod::Clock::Globals ( ) const

The engine's CGlobalVars, or nullptr before load / after shutdown.

Definition at line 10 of file Clock.cpp.

References VoltMod::Interfaces::Engine.

Referenced by Tick(), and Time().

◆ operator=()

Clock & VoltMod::Clock::operator= ( const Clock &  )
delete

◆ Tick()

int VoltMod::Clock::Tick ( ) const

Current simulation tick (tickcount), or 0 when the globals are unavailable.

Definition at line 15 of file Clock.cpp.

References Globals().

◆ Time()

float VoltMod::Clock::Time ( ) const

Current simulation time in seconds (curtime), or 0 when the globals are unavailable.

Definition at line 21 of file Clock.cpp.

References Globals().

Referenced by VoltMod::Rounds::TimeLeft().


The documentation for this class was generated from the following files: