3#include <igameevents.h>
40 template <
class TEvent>
48 const TEvent event = TEvent::From(*
e);
49 if constexpr (
requires {
event.Slot; })
84 bool Attached =
false;
87 using GetLegacyGameEventListenerFn = IGameEventListener2* (*)(
CPlayerSlot slot);
89 Interfaces& _interfaces;
90 const Bindings& _bindings;
92 std::map<std::string, EventHandlers, std::less<>> _events;
93 GetLegacyGameEventListenerFn _getLegacyListener =
nullptr;
Creates, fires and listens to game events.
void RemoveAllListeners()
GameEvents(const GameEvents &)=delete
Subscription On(std::function< void(const TEvent &)> handler)
void FreeEvent(IGameEvent *event)
bool FireEvent(IGameEvent *event, bool broadcast=true)
IGameEvent * CreateEvent(std::string_view name)
GameEvents & operator=(const GameEvents &)=delete
IGameEventListener2 * GetClientLegacyListener(int slot) const
bool ClientListensTo(int slot, std::string_view eventName) const
void FireGameEvent(IGameEvent *event) override
Owns one registration and releases it on destruction.
static std::string ReadFile(const std::filesystem::path &path)
constexpr bool IsValidSlot(int slot)
std::expected< void, Error > Status
Centralized holder for all HL2SDK interface pointers.