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

The custom_hud_layout entity behind a Screen: spawning, removal, and every write. More...

#include <ScreenEntity.hpp>

Public Member Functions

 ScreenEntity (EntitySystem &entities, SlotEvents &slots, Visibility &visibility, const NetChannels &clients, std::vector< const ScreenEntity * > &live, LayoutPath layout, int owner)
 ~ScreenEntity ()
 ScreenEntity (const ScreenEntity &)=delete
ScreenEntity & operator= (const ScreenEntity &)=delete
bool Exists () const
int Owner () const noexcept
bool HasCursor () const
bool EnsureSpawned (int slot)
void Remove ()
void WriteText (int slot, std::string_view variable, std::string_view value)
void WriteClass (int slot, std::string_view elementId, std::string_view className, bool on)
void WriteModifier (int slot, std::string_view elementId, std::string_view block, std::span< const std::string_view > names, std::string_view name)
void WriteCursor (int slot, bool shown)

Detailed Description

The custom_hud_layout entity behind a Screen: spawning, removal, and every write.

The entity is networked to its owner alone. Text and classes go to its global state, which a client shows whatever pawn it is watching, and the cursor to the owner's own per-player state, so a screen keeps working while its owner is dead or spectating.

Writes never spawn; EnsureSpawned does. Unchanged values are skipped through WriteCache.

Definition at line 31 of file ScreenEntity.hpp.

Constructor & Destructor Documentation

◆ ScreenEntity() [1/2]

VoltMod::ScreenEntity::ScreenEntity ( EntitySystem & entities,
SlotEvents & slots,
Visibility & visibility,
const NetChannels & clients,
std::vector< const ScreenEntity * > & live,
LayoutPath layout,
int owner )

Every reference must outlive this. owner is the player slot the screen belongs to. It is in live for as long as it exists.

Definition at line 20 of file ScreenEntity.cpp.

References VoltMod::SlotEvents::Changed, VoltMod::SlotEvents::FullyConnected, and Remove().

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

◆ ~ScreenEntity()

VoltMod::ScreenEntity::~ScreenEntity ( )

Definition at line 48 of file ScreenEntity.cpp.

References Remove().

◆ ScreenEntity() [2/2]

VoltMod::ScreenEntity::ScreenEntity ( const ScreenEntity & )
delete

References ScreenEntity().

Member Function Documentation

◆ EnsureSpawned()

bool VoltMod::ScreenEntity::EnsureSpawned ( int slot)

Spawn, or respawn after the player list changed, until the entity covers its owner.

Definition at line 64 of file ScreenEntity.cpp.

References Exists().

◆ Exists()

bool VoltMod::ScreenEntity::Exists ( ) const

Definition at line 54 of file ScreenEntity.cpp.

Referenced by EnsureSpawned(), and HasCursor().

◆ HasCursor()

bool VoltMod::ScreenEntity::HasCursor ( ) const

Whether the cursor was last shown and the entity is still there.

Definition at line 59 of file ScreenEntity.cpp.

References Exists().

Referenced by VoltMod::ScreenManager::HasCursor().

◆ operator=()

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

References ScreenEntity().

◆ Owner()

int VoltMod::ScreenEntity::Owner ( ) const
inlinenoexcept

Definition at line 45 of file ScreenEntity.hpp.

Referenced by VoltMod::ScreenManager::HasCursor().

◆ Remove()

void VoltMod::ScreenEntity::Remove ( )

Remove the entity and forget everything written to it. Safe to call again.

Definition at line 91 of file ScreenEntity.cpp.

Referenced by ScreenEntity(), and ~ScreenEntity().

◆ WriteClass()

void VoltMod::ScreenEntity::WriteClass ( int slot,
std::string_view elementId,
std::string_view className,
bool on )

Definition at line 112 of file ScreenEntity.cpp.

Referenced by WriteModifier().

◆ WriteCursor()

void VoltMod::ScreenEntity::WriteCursor ( int slot,
bool shown )

Definition at line 147 of file ScreenEntity.cpp.

◆ WriteModifier()

void VoltMod::ScreenEntity::WriteModifier ( int slot,
std::string_view elementId,
std::string_view block,
std::span< const std::string_view > names,
std::string_view name )

Turns <block>--<name> on, and off only the other names the cache holds on: a new entity has none.

Definition at line 122 of file ScreenEntity.cpp.

References VoltMod::ModifierClass(), and WriteClass().

◆ WriteText()

void VoltMod::ScreenEntity::WriteText ( int slot,
std::string_view variable,
std::string_view value )

Definition at line 101 of file ScreenEntity.cpp.

References VoltMod::Text.


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