Init

Scripts

14 years
edited 8 years
Code (jass) Select
1
library Init /* v1.0.0.0
2
************************************************************************************
3
*
4
*	module Init
5
*
6
*		interface private static method init takes nothing returns nothing
7
*			-	Runs at map init
8
*
9
*************************************************************************************
10
*
11
*	module InitTimer
12
*
13
*		interface private static method init takes nothing returns nothing
14
*			-	Runs after a one-shot timer with a period of 0
15
*
16
************************************************************************************/
17
	module Init
18
		static if thistype.init.exists then
19
			private static method onInit takes nothing returns nothing
20
				call init()
21
			endmethod
22
		endif
23
	endmodule
24
	
25
	module InitTimer
26
		static if thistype.init.exists then
27
			private static method initex takes nothing returns nothing
28
				call DestroyTimer(GetExpiredTimer())
29
				call init()
30
			endmethod
31
			private static method onInit takes nothing returns nothing
32
				call TimerStart(CreateTimer(), 0, false, function thistype.initex)
33
			endmethod
34
		endif
35
	endmodule
36
endlibrary