|
VoltMod
C++23 framework for CS2 server plugins
|
A per-key cooldown, such as one notice per player per minute. More...
#include <Cooldown.hpp>
Public Member Functions | |
| Cooldown ()=default | |
| Cooldown (int64_t seconds) | |
| bool | TryStart (const TKey &key, int64_t nowSec, int64_t seconds) |
| bool | TryStart (const TKey &key, int64_t nowSec) |
| int64_t | SecondsLeft (const TKey &key, int64_t nowSec, int64_t seconds) const |
| int64_t | SecondsLeft (const TKey &key, int64_t nowSec) const |
| void | Start (const TKey &key, int64_t nowSec) |
| void | Reset (const TKey &key) |
| void | RemoveExpired (int64_t nowSec, int64_t maxAgeSec) |
A per-key cooldown, such as one notice per player per minute.
A slot key resets when a player rejoins into another slot; a SteamID key does not.
Definition at line 17 of file Cooldown.hpp.
|
default |
|
inlineexplicit |
Definition at line 21 of file Cooldown.hpp.
Removes keys started more than maxAgeSec ago.
Definition at line 64 of file Cooldown.hpp.
References VoltMod::ReadFile().
Definition at line 61 of file Cooldown.hpp.
References VoltMod::ReadFile().
|
inline |
Definition at line 56 of file Cooldown.hpp.
References VoltMod::ReadFile(), and VoltMod::Cooldown< TKey, TMap >::SecondsLeft().
Referenced by VoltMod::Cooldown< TKey, TMap >::SecondsLeft().
|
inline |
0 when key is free, also after the clock jumped back.
Definition at line 37 of file Cooldown.hpp.
References VoltMod::ReadFile().
Referenced by VoltMod::Cooldown< TKey, TMap >::TryStart().
Starts it without checking, for a caller that already checked.
Definition at line 59 of file Cooldown.hpp.
References VoltMod::ReadFile().
Definition at line 34 of file Cooldown.hpp.
References VoltMod::ReadFile(), and VoltMod::Cooldown< TKey, TMap >::TryStart().
Referenced by VoltMod::Cooldown< TKey, TMap >::TryStart().
|
inline |
Starts key's cooldown and returns true, or false while it is still running. 0 seconds never blocks.
Definition at line 24 of file Cooldown.hpp.
References VoltMod::ReadFile(), and VoltMod::Cooldown< TKey, TMap >::SecondsLeft().