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

Framework services for one load and unload cycle. More...

#include <Runtime.hpp>

Public Member Functions

 Runtime (IPluginContext &host, UnsafeServices &unsafe, PlayerLanguages &languages)
 ~Runtime ()
 Runtime (const Runtime &)=delete
Runtime & operator= (const Runtime &)=delete
void OnGameFrame ()
std::string PluginFile (std::string_view relative) const
Subscription UsePanorama (PanoramaMenuLayout &layout)

Public Attributes

const std::string PluginName
const std::string Version
VoltMod::LoadReport LoadReport
StatusService Status
SlotEvents Slots
VoltMod::Scheduler Scheduler
VoltMod::Translations Translations
UnsafeServices & Unsafe
EntitySystem Entities {Unsafe.Interfaces, Unsafe.Bindings}
PlayerManager Players {Slots, &Entities}
VoltMod::Policy Policy {Players}
VoltMod::ConVars ConVars {Unsafe.Interfaces}
VoltMod::Map Map {Unsafe.Interfaces, ConVars}
VoltMod::GameEvents GameEvents {Unsafe.Interfaces, Unsafe.Bindings}
VoltMod::Messages Messages {Unsafe.Interfaces, GameEvents, Translations}
VoltMod::Clock Clock {Unsafe.Interfaces}
VoltMod::Precache Precache
VoltMod::NetChannels NetChannels {Unsafe.Interfaces}
VoltMod::Trace Trace {Unsafe.Bindings}
VoltMod::Rounds Rounds {Entities, Unsafe.Bindings, Clock}
VoltMod::Movement Movement
VoltMod::Visibility Visibility {Entities, Slots}
VoltMod::ChatInput ChatInput {Scheduler, Slots}
VoltMod::Teleport Teleport {Entities, Unsafe.Bindings}
VoltMod::TextMessages TextMessages {Unsafe.Interfaces}
VoltMod::Voice Voice {Unsafe.Interfaces, Players}
VoltMod::ClientConVars ClientConVars {Unsafe.Interfaces, Unsafe.Bindings, Slots}
VoltMod::Vote Vote {Unsafe.Interfaces, Entities, Players, GameEvents, Scheduler}
VoltMod::Damage Damage {Entities, Unsafe.Bindings, Unsafe.Interfaces, GameEvents}
VoltMod::WeaponDrop WeaponDrop {Entities, Unsafe.Bindings}
VoltMod::ScreenManager Screens
MultiAddonManager AddonManager
ServiceExchange Exchange
VoltMod::MenuFreeze Freeze {Entities, Scheduler, Slots}
CenterHtmlMenu CenterHtml
MenuRouter Menus {CenterHtml}
VoltMod::CommandManager Commands
HttpClient Http {Scheduler}

Detailed Description

Framework services for one load and unload cycle.

Members are declared in dependency order, and each engine service does its setup when built; a feature that did not bind says why in its Available() and in LoadReport. Screens follow the hook tiers so their hooks are removed first.

Definition at line 57 of file Runtime.hpp.

Constructor & Destructor Documentation

◆ Runtime() [1/2]

VoltMod::Runtime::Runtime ( IPluginContext & host,
UnsafeServices & unsafe,
PlayerLanguages & languages )

host, unsafe and languages outlive the runtime; the plugin module opened unsafe first.

Definition at line 38 of file Runtime.cpp.

References Movement, VoltMod::Name(), PluginName, Translations, Unsafe, Version, and VoltMod::WatchCommands().

Referenced by operator=(), and Runtime().

◆ ~Runtime()

VoltMod::Runtime::~Runtime ( )

Definition at line 68 of file Runtime.cpp.

References VoltMod::Log::DeliverPending(), and Http.

◆ Runtime() [2/2]

VoltMod::Runtime::Runtime ( const Runtime & )
delete

References Runtime().

Member Function Documentation

◆ OnGameFrame()

void VoltMod::Runtime::OnGameFrame ( )

Drive the scheduler. Called once per frame from the GameFrame hook.

Definition at line 135 of file Runtime.cpp.

References VoltMod::Log::DeliverPending(), and Scheduler.

◆ operator=()

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

References Runtime().

◆ PluginFile()

std::string VoltMod::Runtime::PluginFile ( std::string_view relative) const

"addons/voltmod/plugins/<PluginName>/<relative>".

Definition at line 75 of file Runtime.cpp.

References VoltMod::PluginFile(), and PluginName.

◆ UsePanorama()

Subscription VoltMod::Runtime::UsePanorama ( PanoramaMenuLayout & layout)
nodiscard

Draw menus on layout for players who have it, center HTML for the rest, while the returned Subscription lives. Hold it below layout, which the menu refers to. A player still downloading a required addon gets center HTML.

Definition at line 80 of file Runtime.cpp.

References AddonManager, ChatInput, Freeze, Menus, Policy, Scheduler, Screens, Slots, and Translations.

Member Data Documentation

◆ AddonManager

MultiAddonManager VoltMod::Runtime::AddonManager

Definition at line 164 of file Runtime.hpp.

Referenced by UsePanorama().

◆ CenterHtml

CenterHtmlMenu VoltMod::Runtime::CenterHtml
Initial value:
.Slots = Slots,
.Entities = Entities,
.Freeze = Freeze,
.ChatInput = ChatInput,
.Translations = Translations,
.Policy = Policy,
.Messages = Messages}}
SlotEvents Slots
Definition Runtime.hpp:88
VoltMod::Translations Translations
Definition Runtime.hpp:96
VoltMod::Messages Messages
Definition Runtime.hpp:119
VoltMod::Policy Policy
Definition Runtime.hpp:109
VoltMod::MenuFreeze Freeze
Definition Runtime.hpp:169
VoltMod::Scheduler Scheduler
Definition Runtime.hpp:94
EntitySystem Entities
Definition Runtime.hpp:102
VoltMod::ChatInput ChatInput
Definition Runtime.hpp:142

Definition at line 171 of file Runtime.hpp.

◆ ChatInput

VoltMod::ChatInput VoltMod::Runtime::ChatInput {Scheduler, Slots}

The next chat line from a player, for menu prompts.

Definition at line 142 of file Runtime.hpp.

Referenced by UsePanorama().

◆ ClientConVars

VoltMod::ClientConVars VoltMod::Runtime::ClientConVars {Unsafe.Interfaces, Unsafe.Bindings, Slots}

Ask a client for one of its own convars.

Definition at line 153 of file Runtime.hpp.

◆ Clock

VoltMod::Clock VoltMod::Runtime::Clock {Unsafe.Interfaces}

Definition at line 121 of file Runtime.hpp.

◆ Commands

VoltMod::CommandManager VoltMod::Runtime::Commands

Definition at line 183 of file Runtime.hpp.

◆ ConVars

VoltMod::ConVars VoltMod::Runtime::ConVars {Unsafe.Interfaces}

Definition at line 111 of file Runtime.hpp.

◆ Damage

VoltMod::Damage VoltMod::Runtime::Damage {Entities, Unsafe.Bindings, Unsafe.Interfaces, GameEvents}

Definition at line 158 of file Runtime.hpp.

◆ Entities

EntitySystem VoltMod::Runtime::Entities {Unsafe.Interfaces, Unsafe.Bindings}

Schema field offsets resolve themselves, per process rather than per load - see Field.

Definition at line 102 of file Runtime.hpp.

◆ Exchange

ServiceExchange VoltMod::Runtime::Exchange

Definition at line 166 of file Runtime.hpp.

◆ Freeze

VoltMod::MenuFreeze VoltMod::Runtime::Freeze {Entities, Scheduler, Slots}

Holds players still while a menu is open. Disabled by default.

Definition at line 169 of file Runtime.hpp.

Referenced by UsePanorama().

◆ GameEvents

VoltMod::GameEvents VoltMod::Runtime::GameEvents {Unsafe.Interfaces, Unsafe.Bindings}

Definition at line 117 of file Runtime.hpp.

◆ Http

HttpClient VoltMod::Runtime::Http {Scheduler}

HTTP client. Completions are replayed on the game thread.

Definition at line 186 of file Runtime.hpp.

Referenced by ~Runtime().

◆ LoadReport

VoltMod::LoadReport VoltMod::Runtime::LoadReport

Definition at line 84 of file Runtime.hpp.

◆ Map

VoltMod::Map VoltMod::Runtime::Map {Unsafe.Interfaces, ConVars}

Map validation and level changes. The current map is captured from StartupServer, so it is empty after a late load until the next map change.

Definition at line 115 of file Runtime.hpp.

◆ Menus

MenuRouter VoltMod::Runtime::Menus {CenterHtml}

Routes menus to center HTML or a plugin-preferred surface.

Definition at line 181 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Messages

VoltMod::Messages VoltMod::Runtime::Messages {Unsafe.Interfaces, GameEvents, Translations}

Definition at line 119 of file Runtime.hpp.

◆ Movement

VoltMod::Movement VoltMod::Runtime::Movement

Per-player usercmds from the host's RunCommand hook, listened to while subscribed.

Definition at line 136 of file Runtime.hpp.

Referenced by Runtime().

◆ NetChannels

VoltMod::NetChannels VoltMod::Runtime::NetChannels {Unsafe.Interfaces}

Per-client latency and replicated userinfo cvars.

Definition at line 127 of file Runtime.hpp.

◆ Players

PlayerManager VoltMod::Runtime::Players {Slots, &Entities}

Definition at line 104 of file Runtime.hpp.

◆ PluginName

const std::string VoltMod::Runtime::PluginName

The plugin's plugin.json name and directory under addons/voltmod/plugins/.

Definition at line 70 of file Runtime.hpp.

Referenced by PluginFile(), and Runtime().

◆ Policy

VoltMod::Policy VoltMod::Runtime::Policy {Players}

Plugin-supplied permission, targeting and reply rules, and the one gate that applies them (Policy::Authorize). HasPermission asks whichever plugin publishes IPermissions until a plugin sets its own.

Definition at line 109 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Precache

VoltMod::Precache VoltMod::Runtime::Precache

Resources for the next map's session manifest.

Definition at line 124 of file Runtime.hpp.

◆ Rounds

VoltMod::Rounds VoltMod::Runtime::Rounds {Entities, Unsafe.Bindings, Clock}

The round timer, and ending the current round with a winner.

Definition at line 133 of file Runtime.hpp.

◆ Scheduler

VoltMod::Scheduler VoltMod::Runtime::Scheduler

Per-frame delivery, timers, and delayed work. Pending timers are discarded on destruction; their callbacks may capture only members declared above Scheduler.

Definition at line 94 of file Runtime.hpp.

Referenced by OnGameFrame(), and UsePanorama().

◆ Screens

VoltMod::ScreenManager VoltMod::Runtime::Screens

Definition at line 162 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Slots

SlotEvents VoltMod::Runtime::Slots

Definition at line 88 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Status

StatusService VoltMod::Runtime::Status

Definition at line 86 of file Runtime.hpp.

◆ Teleport

VoltMod::Teleport VoltMod::Runtime::Teleport {Entities, Unsafe.Bindings}

Definition at line 144 of file Runtime.hpp.

◆ TextMessages

VoltMod::TextMessages VoltMod::Runtime::TextMessages {Unsafe.Interfaces}

Chat, center and alert lines on their way to the clients.

Definition at line 147 of file Runtime.hpp.

◆ Trace

VoltMod::Trace VoltMod::Runtime::Trace {Unsafe.Bindings}

Line and box traces for sight and reachability questions.

Definition at line 130 of file Runtime.hpp.

◆ Translations

VoltMod::Translations VoltMod::Runtime::Translations

Definition at line 96 of file Runtime.hpp.

Referenced by Runtime(), and UsePanorama().

◆ Unsafe

UnsafeServices& VoltMod::Runtime::Unsafe

The opt-in engine-access tier (Interfaces, Bindings), resolved before any service.

Definition at line 99 of file Runtime.hpp.

Referenced by Runtime().

◆ Version

const std::string VoltMod::Runtime::Version

The plugin's plugin.json version.

Definition at line 72 of file Runtime.hpp.

Referenced by Runtime().

◆ Visibility

VoltMod::Visibility VoltMod::Runtime::Visibility {Entities, Slots}

Which clients receive which entities.

Definition at line 139 of file Runtime.hpp.

◆ Voice

VoltMod::Voice VoltMod::Runtime::Voice {Unsafe.Interfaces, Players}

Who hears whose voice.

Definition at line 150 of file Runtime.hpp.

◆ Vote

VoltMod::Vote VoltMod::Runtime::Vote {Unsafe.Interfaces, Entities, Players, GameEvents, Scheduler}

The game's yes/no vote panel.

Definition at line 156 of file Runtime.hpp.

◆ WeaponDrop

VoltMod::WeaponDrop VoltMod::Runtime::WeaponDrop {Entities, Unsafe.Bindings}

Definition at line 160 of file Runtime.hpp.


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