|
VoltMod
C++23 framework for CS2 server plugins
|
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, LayoutPath layout, int owner) | |
| ~ScreenEntity () | |
| ScreenEntity (const ScreenEntity &)=delete | |
| ScreenEntity & | operator= (const ScreenEntity &)=delete |
| bool | Exists () 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 | WriteCursor (int slot, bool shown) |
The custom_hud_layout entity behind a Screen: spawning, removal, and every write.
A shared screen writes the layout's global state (EveryoneSlot) or one player's state. The client shows per-player state for the pawn it is watching, so a player screen instead writes text and classes to the global state of an entity only its owner receives, and writes the cursor to the owner's own slot. That is what keeps a menu working while its owner is dead or spectating.
Writes never spawn; EnsureSpawned does. Unchanged values are skipped through WriteCache.
Definition at line 29 of file ScreenEntity.hpp.
| VoltMod::ScreenEntity::ScreenEntity | ( | EntitySystem & | entities, |
| SlotEvents & | slots, | ||
| Visibility & | visibility, | ||
| LayoutPath | layout, | ||
| int | owner | ||
| ) |
Every reference must outlive this. owner is a player slot, or EveryoneSlot for a shared screen.
Definition at line 32 of file ScreenEntity.cpp.
References VoltMod::ReadFile(), Remove(), and VoltMod::WriteCache::RemoveSlot().
| VoltMod::ScreenEntity::~ScreenEntity | ( | ) |
Definition at line 54 of file ScreenEntity.cpp.
References Remove().
|
delete |
Spawn, or respawn after the player list changed, until the entity covers slot.
Definition at line 64 of file ScreenEntity.cpp.
References VoltMod::EveryoneSlot, Exists(), VoltMod::IsValidSlot(), and VoltMod::ReadFile().
| bool VoltMod::ScreenEntity::Exists | ( | ) | const |
Definition at line 59 of file ScreenEntity.cpp.
References VoltMod::EntitySystem::Get().
Referenced by EnsureSpawned().
|
delete |
| void VoltMod::ScreenEntity::Remove | ( | ) |
Remove the entity and forget everything written to it. Safe to call again.
Definition at line 96 of file ScreenEntity.cpp.
References VoltMod::WriteCache::Clear(), VoltMod::EntitySystem::Get(), VoltMod::Entity::Remove(), and VoltMod::Visibility::ShowToEveryone().
Referenced by ScreenEntity(), and ~ScreenEntity().
| void VoltMod::ScreenEntity::WriteClass | ( | int | slot, |
| std::string_view | elementId, | ||
| std::string_view | className, | ||
| bool | on | ||
| ) |
Definition at line 120 of file ScreenEntity.cpp.
References VoltMod::WriteCache::Changed(), VoltMod::Class, and VoltMod::ReadFile().
Definition at line 131 of file ScreenEntity.cpp.
References VoltMod::WriteCache::CursorChanged(), and VoltMod::ReadFile().
| void VoltMod::ScreenEntity::WriteText | ( | int | slot, |
| std::string_view | variable, | ||
| std::string_view | value | ||
| ) |
Definition at line 108 of file ScreenEntity.cpp.
References VoltMod::WriteCache::Changed(), VoltMod::ReadFile(), and VoltMod::Text.