SourceMod SDK  1.7
ITimerSystem.h
Go to the documentation of this file.
1 
32 #ifndef _INCLUDE_SOURCEMOD_TIMER_SYSTEM_H_
33 #define _INCLUDE_SOURCEMOD_TIMER_SYSTEM_H_
34 
41 #include <IShareSys.h>
42 #include <IForwardSys.h>
43 
44 #define SMINTERFACE_TIMERSYS_NAME "ITimerSys"
45 #define SMINTERFACE_TIMERSYS_VERSION 4
46 
47 namespace SourceMod
48 {
49  class ITimer;
50 
54  class IMapTimer
55  {
56  public:
63  virtual int GetMapTimeLimit() =0;
64 
71  virtual void ExtendMapTimeLimit(int extra_time) =0;
72 
81  virtual void SetMapTimerStatus(bool enabled) =0;
82  };
83 
88  {
89  public:
97  virtual ResultType OnTimer(ITimer *pTimer, void *pData) =0;
98 
105  virtual void OnTimerEnd(ITimer *pTimer, void *pData) =0;
106  };
107 
108  #define TIMER_FLAG_REPEAT (1<<0)
109  #define TIMER_FLAG_NO_MAPCHANGE (1<<1)
111  class ITimerSystem : public SMInterface
112  {
113  public:
114  const char *GetInterfaceName()
115  {
116  return SMINTERFACE_TIMERSYS_NAME;
117  }
118  unsigned int GetInterfaceVersion()
119  {
120  return SMINTERFACE_TIMERSYS_VERSION;
121  }
122  public:
134  virtual ITimer *CreateTimer(ITimedEvent *pCallbacks,
135  float fInterval,
136  void *pData,
137  int flags) =0;
138 
145  virtual void KillTimer(ITimer *pTimer) =0;
146 
157  virtual void FireTimerOnce(ITimer *pTimer, bool delayExec=false) =0;
158 
165  virtual IMapTimer *SetMapTimer(IMapTimer *pTimer) =0;
166 
172  virtual void MapTimeLeftChanged() =0;
173 
187  virtual float GetTickedTime() =0;
188 
195  virtual void NotifyOfGameStart(float offset = 0.0f) =0;
196 
205  virtual bool GetMapTimeLeft(float *pTime) =0;
206 
212  virtual IMapTimer *GetMapTimer() = 0;
213  };
214 }
215 
216 #endif //_INCLUDE_SOURCEMOD_TIMER_SYSTEM_H_
unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: ITimerSystem.h:118
virtual void ExtendMapTimeLimit(int extra_time)=0
const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: ITimerSystem.h:114
Defines the interface for managing collections ("forwards") of plugin calls.
Defines the Share System, responsible for shared resources and dependencies.
virtual void OnTimerEnd(ITimer *pTimer, void *pData)=0
Called when the timer has been killed.
virtual void SetMapTimerStatus(bool enabled)=0
virtual ResultType OnTimer(ITimer *pTimer, void *pData)=0
Called when a timer is executed.
virtual int GetMapTimeLimit()=0
Definition: IAdminSystem.h:63
Interface for map timers.
Definition: ITimerSystem.h:54
Event callbacks for when a timer is executed.
Definition: ITimerSystem.h:87