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

Holding players still while a menu is open, for every menu surface. More...

#include <MenuFreeze.hpp>

Public Member Functions

 MenuFreeze (EntitySystem &entities, Scheduler &scheduler, SlotEvents &slots)
 
void Enable (bool enabled)
 
bool Enabled () const noexcept
 
void Open (int slot, bool requested)
 
void Close (int slot)
 

Detailed Description

Holding players still while a menu is open, for every menu surface.

One per server, on the Runtime: the setting is server-wide, so a player is treated the same way whichever surface drew their menu. A surface says only when a session opens and closes; honouring the setting and re-applying the hold across a respawn happen here.

Costs nothing per frame while nobody is held.

Definition at line 22 of file MenuFreeze.hpp.

Constructor & Destructor Documentation

◆ MenuFreeze()

VoltMod::MenuFreeze::MenuFreeze ( EntitySystem &  entities,
Scheduler &  scheduler,
SlotEvents &  slots 
)

All three must outlive this instance. slots drops a hold when a slot changes hands.

Definition at line 7 of file MenuFreeze.cpp.

Member Function Documentation

◆ Close()

void VoltMod::MenuFreeze::Close ( int  slot)

The session closed: give the pawn its movement back.

Definition at line 45 of file MenuFreeze.cpp.

References VoltMod::IsValidSlot(), VoltMod::EntitySystem::Pawn(), and VoltMod::ReadFile().

Referenced by VoltMod::CenterHtmlMenu::Close(), and VoltMod::CenterHtmlMenu::CloseAll().

◆ Enable()

void VoltMod::MenuFreeze::Enable ( bool  enabled)

Freeze movement for the duration of a session, so navigating does not also walk the player around. The original move type is restored when the session closes. Off by default; turning it off also releases whoever the previous setting had already frozen.

Definition at line 11 of file MenuFreeze.cpp.

References VoltMod::MaxPlayers, VoltMod::EntitySystem::Pawn(), and VoltMod::ReadFile().

◆ Enabled()

bool VoltMod::MenuFreeze::Enabled ( ) const
inlinenoexcept

Definition at line 35 of file MenuFreeze.hpp.

◆ Open()

void VoltMod::MenuFreeze::Open ( int  slot,
bool  requested 
)

A session opened for slot. requested is that session's MenuOptions::FreezeMovement, so a menu players reach mid-round can opt out while the setting stays on.

Definition at line 29 of file MenuFreeze.cpp.

References VoltMod::IsValidSlot(), VoltMod::EntitySystem::Pawn(), and VoltMod::ReadFile().

Referenced by VoltMod::CenterHtmlMenu::OpenSession(), and VoltMod::PanoramaMenu::OpenSession().


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