4#include <igameevents.h>
15#include <engine/igameeventsystem.h>
16#include <networksystem/inetworkmessages.h>
17#include <networksystem/netmessage.h>
18#include <shareddefs.h>
19#include <usermessages.pb.h>
28 (!
message.empty() &&
static_cast<unsigned char>(
message.front()) <= 0x10)
65 return std::unexpected(
Error::NotReady(
"IGameEventSystem not available"));
70 return std::unexpected(
Error::NotReady(
"INetworkMessages not available"));
91 pEvent->SetInt(
"duration", 5);
196 shake->set_command(0);
Creates, fires and listens to game events.
IGameEvent * CreateEvent(std::string_view name)
IGameEventListener2 * GetClientLegacyListener(int slot) const
void BroadcastKey(std::string_view key, const Tokens &tokens={}, MessageKind kind=MessageKind::Chat)
void ClearCenterHtml(int slot)
void SendCenterHtml(int slot, const std::string &html)
void Send(int slot, std::string_view message, MessageKind kind=MessageKind::Chat)
void Broadcast(std::string_view message, MessageKind kind=MessageKind::Chat)
Messages(Interfaces &interfaces, GameEvents &events, Translations &translations)
void SendKey(int slot, std::string_view key, const Tokens &tokens={}, MessageKind kind=MessageKind::Chat)
void Shake(int slot, float durationSec, float frequency, float amplitude)
Routes a user message or filtered sound to a chosen set of player slots. Starts empty; callers add ea...
void AddRecipient(int slot)
Routes a user message to a single player slot.
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
std::string Get(std::string_view key) const
constexpr std::string_view Default
@ Center
Plain center-screen print.
@ Chat
Chat box line (color escapes honored).
@ CenterHtml
Center HTML panel (same channel the menu system renders into).
@ Alert
Top-center alert bar.
static std::string EnsureColorPrefix(std::string_view message)
static std::string ReadFile(const std::filesystem::path &path)
constexpr bool IsValidSlot(int slot)
static std::string Render(std::string_view message, MessageKind kind)
std::expected< void, Error > Status
static int HudDestination(MessageKind kind)
std::map< std::string, std::string > Tokens
bool PostUserMessage(Interfaces &interfaces, INetworkMessageInternal *&cached, std::string_view partialName, IRecipientFilter &filter, const std::function< bool(CNetMessage *)> &fill)
@ Send
point the client at AddonDecision::Id and wait for its reconnect
static Error NotReady(std::string detail)
Centralized holder for all HL2SDK interface pointers.
IGameEventSystem * GameEventSystem
INetworkMessages * NetworkMessages
IGameEventManager2 * GameEventManager
static constexpr std::string_view EventName