|
VoltMod
C++23 framework for CS2 server plugins
|
#include <PluginContext.hpp>
Public Member Functions | |
| PluginContext (SharedState &state, std::string name, std::string logTag, std::string version, uint64_t order) | |
| PluginContext (const PluginContext &)=delete | |
| PluginContext & | operator= (const PluginContext &)=delete |
| void | SetMinLogLevel (LogLevel level) |
| LeakReport | RemoveAll () |
| std::string_view | Name () const override |
| std::string_view | Version () const override |
| void * | EngineInterface (const char *version) const override |
| void * | ServerInterface (const char *version) const override |
| std::string_view | BaseDir () const override |
| KHook::IKHook * | HookDispatcher () const override |
| IPluginEvents & | Events () override |
| IPluginServices & | Services () override |
| IPluginLanguages & | Languages () override |
| IPluginAddons & | Addons () override |
| IPluginGameData * | GameData () const override |
| bool | RegisterCommand (std::string_view name) override |
| bool | IsCommandRegistered (std::string_view name) const override |
| void | WriteLog (uint8_t level, std::string_view text) override |
| uint8_t | MinLogLevel () const override |
| Schema::LiveField | FindSchemaField (std::string_view className, std::string_view field) const override |
| uint64_t | OnFrame (FrameFn callback, void *context) override |
| uint64_t | OnServerStartup (ServerStartupFn callback, void *context) override |
| uint64_t | OnClientConnecting (ClientConnectingFn callback, void *context) override |
| uint64_t | OnClientConnected (ClientConnectedFn callback, void *context) override |
| uint64_t | OnClientDisconnected (ClientDisconnectedFn callback, void *context) override |
| uint64_t | OnClientFullyConnected (ClientFullyConnectedFn callback, void *context) override |
| uint64_t | OnClientSettingsChanged (ClientSettingsChangedFn callback, void *context) override |
| uint64_t | OnConsoleCommand (ConsoleCommandFn callback, void *context) override |
| uint64_t | OnCheckTransmit (CheckTransmitFn callback, void *context) override |
| uint64_t | OnBuildGameSessionManifest (BuildGameSessionManifestFn callback, void *context) override |
| uint64_t | OnPlayerCommand (PlayerCommandFn callback, void *context) override |
| uint64_t | OnPlayerCommandDone (PlayerCommandFn callback, void *context) override |
| uint64_t | OnButtonPress (ButtonPressFn callback, void *context) override |
| void | Publish (std::string_view name, void *implementation) override |
| void | Unpublish (std::string_view name) override |
| void * | Find (std::string_view name) override |
| bool | Add (uint64_t addonId) override |
| void | Remove (uint64_t addonId) override |
| bool | IsReady (int slot) override |
| void | ReplayMissedEvents () |
| void | DisconnectClients () |
| void | Unsubscribe (uint64_t token) override |
Additional Inherited Members | |
| Public Types inherited from VoltMod::IPluginEvents | |
| using | FrameFn = void (*)(void* context) |
| using | ServerStartupFn = void (*)(void* context, std::string_view mapName) |
| using | ClientConnectingFn |
| using | ClientConnectedFn |
| using | ClientDisconnectedFn = void (*)(void* context, int slot) |
| using | ClientFullyConnectedFn = void (*)(void* context, int slot) |
| using | ClientSettingsChangedFn = void (*)(void* context, int slot) |
| using | ConsoleCommandFn = bool (*)(void* context, std::string_view name, std::string_view arguments, int slot) |
| using | CheckTransmitFn = void (*)(void* context, CCheckTransmitInfo** infoList, int infoCount) |
| using | BuildGameSessionManifestFn = void (*)(void* context, IEntityResourceManifest* manifest) |
| using | PlayerCommandFn = void (*)(void* context, int slot, const PlayerInput& input) |
| using | ButtonPressFn = void (*)(void* context, int slot, std::string_view buttonId) |
| Protected Member Functions inherited from VoltMod::IPluginContext | |
| ~IPluginContext ()=default | |
| Protected Member Functions inherited from VoltMod::IPluginEvents | |
| ~IPluginEvents ()=default | |
| Protected Member Functions inherited from VoltMod::IPluginServices | |
| ~IPluginServices ()=default | |
| Protected Member Functions inherited from VoltMod::IPluginAddons | |
| ~IPluginAddons ()=default | |
One plugin's view of the host and the record of what it took, so every call has a known owner. Owned by PluginRegistry; valid from AddPlugin until RemovePlugin.
Definition at line 82 of file PluginContext.hpp.
| VoltMod::PluginContext::PluginContext | ( | SharedState & | state, |
| std::string | name, | ||
| std::string | logTag, | ||
| std::string | version, | ||
| uint64_t | order ) |
Definition at line 10 of file PluginContext.cpp.
Referenced by operator=(), and PluginContext().
|
delete |
References PluginContext().
|
overridevirtual |
Require addonId until a matching Remove; false when nothing was added, as for id 0 or a listen server.
Implements VoltMod::IPluginAddons.
Definition at line 87 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginContext.
Definition at line 82 of file PluginContext.cpp.
|
overridevirtual |
The absolute csgo directory that relative paths resolve against.
Implements VoltMod::IPluginContext.
Definition at line 35 of file PluginContext.cpp.
| void VoltMod::PluginContext::DisconnectClients | ( | ) |
Raise OnClientDisconnected on this plugin alone for each player still in, before a mid-map unload.
Definition at line 257 of file PluginContext.cpp.
References VoltMod::MaxPlayers.
|
overridevirtual |
An engine interface by its exact version name, or null.
Implements VoltMod::IPluginContext.
Definition at line 25 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginContext.
Definition at line 45 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginServices.
Definition at line 223 of file PluginContext.cpp.
|
overridevirtual |
Where the running server lays out field of className; Offset -1 when it is gone.
Implements VoltMod::IPluginContext.
Definition at line 129 of file PluginContext.cpp.
|
overridevirtual |
Null when the host resolved no gamedata.
Implements VoltMod::IPluginContext.
Definition at line 55 of file PluginContext.cpp.
|
overridevirtual |
Each module has its own KHook::__exported__khook; a plugin seeds it from this before hooking.
Implements VoltMod::IPluginContext.
Definition at line 40 of file PluginContext.cpp.
|
overridevirtual |
True while any plugin, this one included, or the host holds name.
Implements VoltMod::IPluginContext.
Definition at line 72 of file PluginContext.cpp.
|
overridevirtual |
Whether slot has every required addon.
Implements VoltMod::IPluginAddons.
Definition at line 107 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginContext.
Definition at line 77 of file PluginContext.cpp.
|
overridevirtual |
Lines below this are dropped; volt log <name> <level> changes it.
Implements VoltMod::IPluginContext.
Definition at line 124 of file PluginContext.cpp.
|
overridevirtual |
The plugin's name: its manifest name and directory under addons/voltmod/plugins/.
Implements VoltMod::IPluginContext.
Definition at line 15 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 193 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 208 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 188 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 163 of file PluginContext.cpp.
|
overridevirtual |
Before the engine admits a player, and before OnClientConnected.
Implements VoltMod::IPluginEvents.
Definition at line 158 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 168 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 173 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 178 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 183 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 148 of file PluginContext.cpp.
|
overridevirtual |
Before the engine runs a player's command. Commands are decoded only while one is subscribed.
Implements VoltMod::IPluginEvents.
Definition at line 198 of file PluginContext.cpp.
|
overridevirtual |
After the engine ran it.
Implements VoltMod::IPluginEvents.
Definition at line 203 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginEvents.
Definition at line 153 of file PluginContext.cpp.
|
delete |
References PluginContext().
|
overridevirtual |
Implements VoltMod::IPluginServices.
Definition at line 213 of file PluginContext.cpp.
|
overridevirtual |
False when another plugin holds name, which the host logs naming both. Released with the plugin.
Implements VoltMod::IPluginContext.
Definition at line 60 of file PluginContext.cpp.
References VoltMod::Log::Error().
|
overridevirtual |
Implements VoltMod::IPluginAddons.
Definition at line 97 of file PluginContext.cpp.
| LeakReport VoltMod::PluginContext::RemoveAll | ( | ) |
Remove what the plugin still holds. Command names are the host's to remove, so they are not reported.
Definition at line 281 of file PluginContext.cpp.
References VoltMod::LeakReport::Addons, VoltMod::LeakReport::Services, and VoltMod::LeakReport::Subscriptions.
| void VoltMod::PluginContext::ReplayMissedEvents | ( | ) |
Raise on this plugin alone what it missed by loading mid-map: OnServerStartup for the running map, then OnClientConnected and OnClientFullyConnected for each player already in.
Definition at line 228 of file PluginContext.cpp.
References VoltMod::ConnectedClient::Address, VoltMod::MaxPlayers, VoltMod::ConnectedClient::Name, and VoltMod::ConnectedClient::SteamId.
|
overridevirtual |
A game server interface by its exact version name, or null.
Implements VoltMod::IPluginContext.
Definition at line 30 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginContext.
Definition at line 50 of file PluginContext.cpp.
|
inline |
Definition at line 90 of file PluginContext.hpp.
|
overridevirtual |
Implements VoltMod::IPluginServices.
Definition at line 218 of file PluginContext.cpp.
|
overridevirtual |
A token this plugin never took is ignored.
Implements VoltMod::IPluginEvents.
Definition at line 269 of file PluginContext.cpp.
|
overridevirtual |
Implements VoltMod::IPluginContext.
Definition at line 20 of file PluginContext.cpp.
|
overridevirtual |
Print one line under this plugin's logTag. level is a LogLevel.
Implements VoltMod::IPluginContext.
Definition at line 112 of file PluginContext.cpp.
References VoltMod::Log::Emit().