Nuclide
Software Development Kit for id Technology (BETA)
Timer.h
1/*
2 * Copyright (c) 2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17.void(void) _m_ncTimerFunc;
18
24class
26{
27public:
28 void ncTimer(void);
29
31 static ncTimer ScheduleTimer(entity, void(), float, bool);
32
34 static ncTimer TemporaryTimer(entity, void(), float, bool);
35
37 virtual void RunTimer(void);
38
39 nonvirtual bool IsRunning(void);
40
42 nonvirtual void SetupTimer(entity receiver, void() call, float interval, bool repeats);
43
45 nonvirtual void StopTimer(void);
46
47 nonvirtual void WipeEntityTimers(entity targetEntity);
48
49 virtual void OnRemoveEntity(void);
50
51#ifdef SERVER
52 virtual void Save(float);
53 virtual void Restore(string, string);
54#endif
55
56private:
57 float m_flTime;
58 bool m_bRepeats;
59
60 virtual void _TimerThink(void);
61 virtual void _TempTimerThink(void);
62};
ncEntity is the lowest of the user-accessible entity class.
Definition: Entity.h:75
This class provides a way to trigger a function in the future.
Definition: Timer.h:26