|
VoltMod
C++23 framework for CS2 server plugins
|
Send chat, center print, center HTML, and alert messages. More...
#include <Messages.hpp>
Public Member Functions | |
| Messages (Interfaces &interfaces, GameEvents &events, Translations &translations) | |
| Messages (const Messages &)=delete | |
| Messages & | operator= (const Messages &)=delete |
| Status | Available () const |
| void | Send (int slot, std::string_view message, MessageKind kind=MessageKind::Chat) |
| void | Broadcast (std::string_view message, MessageKind kind=MessageKind::Chat) |
| void | SendKey (int slot, std::string_view key, const Tokens &tokens={}, MessageKind kind=MessageKind::Chat) |
| void | BroadcastKey (std::string_view key, const Tokens &tokens={}, MessageKind kind=MessageKind::Chat) |
| void | Shake (int slot, float durationSec, float frequency, float amplitude) |
| void | SendCenterHtml (int slot, const std::string &html) |
| void | ClearCenterHtml (int slot) |
Send chat, center print, center HTML, and alert messages.
Chat sends preserve a leading color escape or prepend the default color. Send and Broadcast send finished text; SendKey and BroadcastKey translate a key into each player's language.
Definition at line 29 of file Messages.hpp.
| VoltMod::Messages::Messages | ( | Interfaces & | interfaces, |
| GameEvents & | events, | ||
| Translations & | translations ) |
interfaces, events, and translations must outlive this service.
Definition at line 56 of file Messages.cpp.
Referenced by Messages(), and operator=().
|
delete |
References Messages().
| Status VoltMod::Messages::Available | ( | ) | const |
NotReady when the engine's event or network message system is missing.
Definition at line 60 of file Messages.cpp.
References VoltMod::Error::NotReady().
| void VoltMod::Messages::Broadcast | ( | std::string_view | message, |
| MessageKind | kind = MessageKind::Chat ) |
Broadcast to connected human players.
Definition at line 114 of file Messages.cpp.
References VoltMod::CenterHtml, VoltMod::HudDestination(), VoltMod::MaxPlayers, VoltMod::Render(), and SendCenterHtml().
| void VoltMod::Messages::BroadcastKey | ( | std::string_view | key, |
| const Tokens & | tokens = {}, | ||
| MessageKind | kind = MessageKind::Chat ) |
SendKey to every connected client, each in their own language.
Definition at line 144 of file Messages.cpp.
References VoltMod::MaxPlayers, and SendKey().
| void VoltMod::Messages::ClearCenterHtml | ( | int | slot | ) |
Definition at line 198 of file Messages.cpp.
References SendCenterHtml().
References VoltMod::Chat, and Messages().
| void VoltMod::Messages::Send | ( | int | slot, |
| std::string_view | message, | ||
| MessageKind | kind = MessageKind::Chat ) |
Definition at line 103 of file Messages.cpp.
References VoltMod::CenterHtml, VoltMod::HudDestination(), VoltMod::Render(), and SendCenterHtml().
Referenced by SendKey().
| void VoltMod::Messages::SendCenterHtml | ( | int | slot, |
| const std::string & | html ) |
Write a raw center-HTML panel. Menus and CenterHtml use this path.
Definition at line 74 of file Messages.cpp.
References VoltMod::ShowSurvivalRespawnStatus::EventName, and VoltMod::IsValidSlot().
Referenced by Broadcast(), ClearCenterHtml(), and Send().
| void VoltMod::Messages::SendKey | ( | int | slot, |
| std::string_view | key, | ||
| const Tokens & | tokens = {}, | ||
| MessageKind | kind = MessageKind::Chat ) |
Translate key into slot's language, substitute tokens, and send it.
Definition at line 139 of file Messages.cpp.
References Send().
Referenced by BroadcastKey().
| void VoltMod::Messages::Shake | ( | int | slot, |
| float | durationSec, | ||
| float | frequency, | ||
| float | amplitude ) |
Shake slot's screen, the engine's own CUserMessageShake.
| slot | Recipient player slot. |
| durationSec | how long the shake lasts. |
| frequency | oscillations per second; higher reads as a rattle, lower as a sway. |
| amplitude | how far the view is thrown. |
Definition at line 181 of file Messages.cpp.
References VoltMod::PostUserMessage().