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, Unsafe.Bindings, Slots}
 
VoltMod::ChatInput ChatInput {Scheduler, Slots}
 
VoltMod::Teleport Teleport {Entities, Unsafe.Bindings}
 
VoltMod::TextMessages TextMessages {Unsafe.Interfaces}
 
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 56 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 VoltMod::ListenForCommands(), and VoltMod::ReadFile().

◆ ~Runtime()

VoltMod::Runtime::~Runtime ( )

Definition at line 68 of file Runtime.cpp.

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

◆ Runtime() [2/2]

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

Member Function Documentation

◆ OnGameFrame()

void VoltMod::Runtime::OnGameFrame ( )

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

Definition at line 136 of file Runtime.cpp.

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

◆ operator=()

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

◆ 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(), PluginName, and VoltMod::ReadFile().

◆ UsePanorama()

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

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, VoltMod::MenuRouter::Prefer(), VoltMod::ReadFile(), VoltMod::PanoramaMenu::Services::Scheduler, Scheduler, Screens, Slots, and Translations.

Member Data Documentation

◆ AddonManager

MultiAddonManager VoltMod::Runtime::AddonManager

Definition at line 160 of file Runtime.hpp.

Referenced by UsePanorama().

◆ CenterHtml

CenterHtmlMenu VoltMod::Runtime::CenterHtml
Initial value:
{CenterHtmlMenu::Services{.Scheduler = Scheduler,
.Slots = Slots,
.Entities = Entities,
.Freeze = Freeze,
.ChatInput = ChatInput,
.Translations = Translations,
.Policy = Policy,
.Messages = Messages}}
SlotEvents Slots
Definition Runtime.hpp:87
VoltMod::Translations Translations
Definition Runtime.hpp:95
VoltMod::Messages Messages
Definition Runtime.hpp:118
VoltMod::Policy Policy
Definition Runtime.hpp:108
VoltMod::MenuFreeze Freeze
Definition Runtime.hpp:165
VoltMod::Scheduler Scheduler
Definition Runtime.hpp:93
EntitySystem Entities
Definition Runtime.hpp:101
VoltMod::ChatInput ChatInput
Definition Runtime.hpp:141

Definition at line 167 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 141 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 149 of file Runtime.hpp.

◆ Clock

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

Definition at line 120 of file Runtime.hpp.

◆ Commands

VoltMod::CommandManager VoltMod::Runtime::Commands

Definition at line 179 of file Runtime.hpp.

◆ ConVars

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

Definition at line 110 of file Runtime.hpp.

◆ Damage

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

Definition at line 154 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 101 of file Runtime.hpp.

◆ Exchange

ServiceExchange VoltMod::Runtime::Exchange

Definition at line 162 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 165 of file Runtime.hpp.

Referenced by UsePanorama().

◆ GameEvents

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

Definition at line 116 of file Runtime.hpp.

◆ Http

HttpClient VoltMod::Runtime::Http {Scheduler}

HTTP client. Completions are replayed on the game thread.

Definition at line 182 of file Runtime.hpp.

Referenced by ~Runtime().

◆ LoadReport

VoltMod::LoadReport VoltMod::Runtime::LoadReport

Definition at line 83 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 114 of file Runtime.hpp.

◆ Menus

MenuRouter VoltMod::Runtime::Menus {CenterHtml}

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

Definition at line 177 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Messages

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

Definition at line 118 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 135 of file Runtime.hpp.

◆ NetChannels

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

Per-client latency and replicated userinfo cvars.

Definition at line 126 of file Runtime.hpp.

◆ Players

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

Definition at line 103 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 69 of file Runtime.hpp.

Referenced by PluginFile().

◆ 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 108 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Precache

VoltMod::Precache VoltMod::Runtime::Precache

Resources for the next map's session manifest.

Definition at line 123 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 132 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 93 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Screens

VoltMod::ScreenManager VoltMod::Runtime::Screens

Definition at line 158 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Slots

SlotEvents VoltMod::Runtime::Slots

Definition at line 87 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Status

StatusService VoltMod::Runtime::Status

Definition at line 85 of file Runtime.hpp.

◆ Teleport

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

Definition at line 143 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 146 of file Runtime.hpp.

◆ Trace

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

Line and box traces for sight and reachability questions.

Definition at line 129 of file Runtime.hpp.

◆ Translations

VoltMod::Translations VoltMod::Runtime::Translations

Definition at line 95 of file Runtime.hpp.

Referenced by UsePanorama().

◆ Unsafe

UnsafeServices& VoltMod::Runtime::Unsafe

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

Definition at line 98 of file Runtime.hpp.

◆ Version

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

The plugin's plugin.json version.

Definition at line 71 of file Runtime.hpp.

◆ Visibility

VoltMod::Visibility VoltMod::Runtime::Visibility {Entities, Unsafe.Bindings, Slots}

Which clients receive which entities.

Definition at line 138 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 152 of file Runtime.hpp.

◆ WeaponDrop

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

Definition at line 156 of file Runtime.hpp.


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