|
VoltMod
C++23 framework for CS2 server plugins
|
#include <ConVar.hpp>
Public Member Functions | |
| ConVars (Interfaces &interfaces) | |
| ~ConVars () | |
| ConVars (const ConVars &)=delete | |
| ConVars & | operator= (const ConVars &)=delete |
| Status | Available () const |
| template<ConVarValue T> | |
| Result< ConVar< T > > | Find (std::string_view name) |
| void | ExecuteServerCommand (std::string_view command) |
| Status | ExecuteFile (std::string_view path) |
| void | SetByConsole (std::string_view name, std::string_view value) |
| Assign a convar over the console, quoting the value. | |
Public Attributes | |
| Event< const ConVarChange & > | Changed |
Friends | |
| template<class U > | |
| class | ConVar |
Convar lookup, console commands, client overrides, and global change events.
Definition at line 113 of file ConVar.hpp.
|
explicit |
interfaces must outlive this service.
Definition at line 42 of file ConVars.cpp.
| VoltMod::ConVars::~ConVars | ( | ) |
Definition at line 47 of file ConVars.cpp.
| Status VoltMod::ConVars::Available | ( | ) | const |
NotReady when ICvar is unavailable.
Definition at line 53 of file ConVars.cpp.
References VoltMod::Interfaces::CVar, and VoltMod::Error::NotReady().
| Status VoltMod::ConVars::ExecuteFile | ( | std::string_view | path | ) |
Queue each line of a cfg file, skipping blanks and // comments; exec reads only csgo/cfg.
Definition at line 88 of file ConVars.cpp.
References ExecuteServerCommand(), VoltMod::ReadAllText(), VoltMod::ReadFile(), and VoltMod::Strings::Trim().
| void VoltMod::ConVars::ExecuteServerCommand | ( | std::string_view | command | ) |
Queue a server console line. A line with an embedded newline is refused and logged.
Definition at line 62 of file ConVars.cpp.
References VoltMod::Interfaces::Engine, VoltMod::ReadFile(), and VoltMod::Log::Warn().
Referenced by VoltMod::Map::ChangeToWorkshop(), ExecuteFile(), and SetByConsole().
| template Result< ConVar< float > > VoltMod::ConVars::Find< float > | ( | std::string_view | name | ) |
Resolve by name. Returns NotFound when absent and Invalid on a type mismatch.
Definition at line 33 of file ConVar.cpp.
References VoltMod::Error::Engine(), VoltMod::Error::Invalid(), VoltMod::Error::NotFound(), and VoltMod::ReadFile().
| void VoltMod::ConVars::SetByConsole | ( | std::string_view | name, |
| std::string_view | value | ||
| ) |
Assign a convar over the console, quoting the value.
The one place the name value console line is built, so the quoting rule is not rediscovered per call site: a space would truncate the value and a ; would start a second command. A replicated payload sent straight to a client stays unquoted.
Definition at line 112 of file ConVars.cpp.
References ExecuteServerCommand(), and VoltMod::Strings::QuoteConsoleArg().
| Event<const ConVarChange&> VoltMod::ConVars::Changed |
All engine convar changes. The global callback exists only while this event has subscribers.
Definition at line 145 of file ConVar.hpp.
Referenced by GlobalConVarChangeCallback().