diff --git a/extensions/tf2/extension.cpp b/extensions/tf2/extension.cpp index 2c89f0b4..0eaeaac7 100644 --- a/extensions/tf2/extension.cpp +++ b/extensions/tf2/extension.cpp @@ -120,6 +120,9 @@ bool TF2Tools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool GET_V_IFACE_CURRENT(GetServerFactory, gameents, IServerGameEnts, INTERFACEVERSION_SERVERGAMEENTS); + GET_V_IFACE_CURRENT(GetEngineFactory, m_GameEventManager, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2); + m_GameEventManager->AddListener(this, "teamplay_restart_round", true); + return true; } @@ -144,6 +147,11 @@ bool TF2Tools::RegisterConCommandBase(ConCommandBase *pVar) return g_SMAPI->RegisterConCommandBase(g_PLAPI, pVar); } +void TF2Tools::FireGameEvent( IGameEvent *event ) +{ + timersys->NotifyOfGameStart(); + timersys->MapTimeLeftChanged(); +} bool TF2Tools::QueryRunning(char *error, size_t maxlength) { diff --git a/extensions/tf2/extension.h b/extensions/tf2/extension.h index 2f31e003..be9482d2 100644 --- a/extensions/tf2/extension.h +++ b/extensions/tf2/extension.h @@ -40,6 +40,7 @@ #include "smsdk_ext.h" #include #include +#include /** * @brief Sample implementation of the SDK Extension. @@ -48,7 +49,8 @@ class TF2Tools : public SDKExtension, public ICommandTargetProcessor, - public IConCommandBaseAccessor + public IConCommandBaseAccessor, + public IGameEventListener2 { public: /** @@ -91,6 +93,9 @@ public: public: bool ProcessCommandTarget(cmd_target_info_t *info); bool RegisterConCommandBase(ConCommandBase *pVar); + + IGameEventManager2 *m_GameEventManager; + void FireGameEvent( IGameEvent *event ); public: #if defined SMEXT_CONF_METAMOD /** diff --git a/extensions/tf2/sdk/smsdk_config.h b/extensions/tf2/sdk/smsdk_config.h index 48e7cb61..990d9b05 100644 --- a/extensions/tf2/sdk/smsdk_config.h +++ b/extensions/tf2/sdk/smsdk_config.h @@ -68,7 +68,7 @@ #define SMEXT_ENABLE_GAMECONF //#define SMEXT_ENABLE_MEMUTILS #define SMEXT_ENABLE_GAMEHELPERS -//#define SMEXT_ENABLE_TIMERSYS +#define SMEXT_ENABLE_TIMERSYS //#define SMEXT_ENABLE_THREADER //#define SMEXT_ENABLE_LIBSYS //#define SMEXT_ENABLE_USERMSGS