VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Runtime.hpp
Go to the documentation of this file.
1#pragma once
2
42#include <memory>
43#include <string>
44#include <string_view>
45
46namespace VoltMod
47{
48
49/**
50 * @brief Framework services for one load and unload cycle.
51 *
52 * Members are declared in dependency order, and each engine service does its setup when built;
53 * a feature that did not bind says why in its `Available()` and in @ref LoadReport. Screens follow
54 * the hook tiers so their hooks are removed first.
55 */
57{
58public:
59 /** @p host, @p unsafe and @p languages outlive the runtime; the plugin module opened @p unsafe first. */
61 ~Runtime();
62 Runtime(const Runtime&) = delete;
63 Runtime& operator=(const Runtime&) = delete;
64
65 /** Drive the scheduler. Called once per frame from the GameFrame hook. */
66 void OnGameFrame();
67
68 /** The plugin's `plugin.json` name and directory under `addons/voltmod/plugins/`. */
69 const std::string PluginName;
70 /** The plugin's `plugin.json` version. */
71 const std::string Version;
72
73 /** "addons/voltmod/plugins/<PluginName>/<relative>". */
74 std::string PluginFile(std::string_view relative) const;
75
76 /**
77 * Draw menus on @p layout for players who have it, center HTML for the rest, while the
78 * returned Subscription lives. Hold it below @p layout, which the menu refers to. A player still
79 * downloading a required addon gets center HTML.
80 */
82
84
86
88
89 /**
90 * Per-frame delivery, timers, and delayed work. Pending timers are discarded on destruction;
91 * their callbacks may capture only members declared above Scheduler.
92 */
94
96
97 /** The opt-in engine-access tier (Interfaces, Bindings), resolved before any service. */
99
100 /** Schema field offsets resolve themselves, per process rather than per load - see @ref Field. */
102
104
105 /** Plugin-supplied permission, targeting and reply rules, and the one gate that applies
106 * them (`Policy::Authorize`). `HasPermission` asks whichever plugin publishes
107 * @ref IPermissions until a plugin sets its own. */
109
111
112 /** Map validation and level changes. The current map is captured from StartupServer, so it
113 * is empty after a late load until the next map change. */
115
117
119
121
122 /** Resources for the next map's session manifest. */
124
125 /** Per-client latency and replicated userinfo cvars. */
127
128 /** Line and box traces for sight and reachability questions. */
130
131 /** The round timer, and ending the current round with a winner. */
133
134 /** Per-player usercmds from the host's RunCommand hook, listened to while subscribed. */
136
137 /** Which clients receive which entities. */
139
140 /** The next chat line from a player, for menu prompts. */
142
144
145 /** Chat, center and alert lines on their way to the clients. */
147
148 /** Ask a client for one of its own convars. */
150
151 /** The game's yes/no vote panel. */
153
155
157
159
161
163
164 /** Holds players still while a menu is open. Disabled by default. */
166
168 .Slots = Slots,
169 .Entities = Entities,
170 .Freeze = Freeze,
171 .ChatInput = ChatInput,
172 .Translations = Translations,
173 .Policy = Policy,
174 .Messages = Messages}};
175
176 /** Routes menus to center HTML or a plugin-preferred surface. */
178
180
181 /** HTTP client. Completions are replayed on the game thread. */
183
184private:
185 /** Check every service into @ref LoadReport: Messages required, the rest optional. */
186 void CheckServices();
187 void AddStatusSections();
188
190};
191
192} // namespace VoltMod
Menus drawn as center HTML and driven with W/S/A/D/E/R. It needs no client addon, so runtime....
Re-sends a center-HTML panel until stopped, since CS2 drops center HTML on death, a team switch and H...
Per-player pending-prompt registry for menu free-text input.
Definition ChatInput.hpp:27
Asks a connected client what one of its own convars is set to.
The engine's simulation clock, read straight from IVEngineServer2::GetServerGlobals().
Definition Clock.hpp:19
Typed commands for chat and the server console.
Every entity's damage, from CBaseEntity::TakeDamageOld, and a way to deal it.
Definition Damage.hpp:80
runtime.Entities: finds and creates entities. Everything it returns is valid for this frame only; see...
Creates, fires and listens to game events.
Runs HTTP requests off the game thread and their completions on it.
Holding players still while a menu is open, for every menu surface.
runtime.Menus: the surface menus start on, chosen once per session.
Send chat, center print, center HTML, and alert messages.
Definition Messages.hpp:30
Each player's command from CCSPlayer_MovementServices::RunCommand.
Definition Movement.hpp:23
Per-client network-channel access: latency and the client's replicated userinfo cvars.
The screen built from the menu Panorama block, as PanoramaMenu draws on it.
The roster: every connected player, and the signals for the connection lifecycle.
The one permission and targeting gate, plus the plugin's reply callback.
Definition Policy.hpp:41
runtime.Rounds: the running round's timer, and ending the round with the engine's own win panel and r...
Definition Rounds.hpp:33
Framework services for one load and unload cycle.
Definition Runtime.hpp:57
VoltMod::CommandManager Commands
Definition Runtime.hpp:179
VoltMod::Precache Precache
Definition Runtime.hpp:123
SlotEvents Slots
Definition Runtime.hpp:87
VoltMod::Movement Movement
Definition Runtime.hpp:135
StatusService Status
Definition Runtime.hpp:85
MultiAddonManager AddonManager
Definition Runtime.hpp:160
HttpClient Http
Definition Runtime.hpp:182
VoltMod::GameEvents GameEvents
Definition Runtime.hpp:116
const std::string PluginName
Definition Runtime.hpp:69
VoltMod::Translations Translations
Definition Runtime.hpp:95
VoltMod::LoadReport LoadReport
Definition Runtime.hpp:83
VoltMod::ClientConVars ClientConVars
Definition Runtime.hpp:149
Runtime & operator=(const Runtime &)=delete
ServiceExchange Exchange
Definition Runtime.hpp:162
VoltMod::Policy Policy
Definition Runtime.hpp:108
VoltMod::MenuFreeze Freeze
Definition Runtime.hpp:165
VoltMod::Scheduler Scheduler
Definition Runtime.hpp:93
std::string PluginFile(std::string_view relative) const
Definition Runtime.cpp:75
EntitySystem Entities
Definition Runtime.hpp:101
MenuRouter Menus
Definition Runtime.hpp:177
PlayerManager Players
Definition Runtime.hpp:103
const std::string Version
Definition Runtime.hpp:71
VoltMod::ScreenManager Screens
Definition Runtime.hpp:158
UnsafeServices & Unsafe
Definition Runtime.hpp:98
Runtime(const Runtime &)=delete
Subscription UsePanorama(PanoramaMenuLayout &layout)
Definition Runtime.cpp:80
VoltMod::ChatInput ChatInput
Definition Runtime.hpp:141
One-shot delays and repeating timers, run on the game thread.
Definition Scheduler.hpp:18
Create Screen objects and report their button presses.
Typed view of the host's table of interfaces plugins publish to each other.
"The occupant of this slot changed" - raised by PlayerManager, consumed below it.
Build text and JSON diagnostics from named providers.
Owns one registration and releases it on destruction.
Report player pawn moves through CBaseEntity::Teleport.
Definition Teleport.hpp:29
Outgoing TextMsg user messages, the game's own lines included.
runtime.Trace: line and box traces against the physics world. Game-thread only.
Definition Trace.hpp:50
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
Which clients receive which entities, filtered after CheckTransmit.
The game's yes/no vote panel (F1/F2), with the ballots counted here.
Definition Vote.hpp:69
A player's own weapon drops, from CCSPlayer_WeaponServices::DropWeapon.
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
Opt-in access to raw engine interfaces and typed gamedata bindings.
VoltMod::Bindings Bindings
VoltMod::Interfaces Interfaces