1 | (def_char START_RED
|
---|
2 | (funs (ai_fun do_nothing)
|
---|
3 | (get_cache_list_fun start_cache)
|
---|
4 | (draw_fun dev_draw))
|
---|
5 | (range 0 0)
|
---|
6 | (states "addon/team/team.spe" (stopped "start_red"))
|
---|
7 | )
|
---|
8 |
|
---|
9 | ;----------------------------------------------------------------------
|
---|
10 | (def_char START_GREEN
|
---|
11 | (funs (ai_fun do_nothing)
|
---|
12 | (get_cache_list_fun start_cache)
|
---|
13 | (draw_fun dev_draw))
|
---|
14 | (range 0 0)
|
---|
15 | (states "addon/team/team.spe" (stopped "start_green")))
|
---|
16 |
|
---|
17 | ;----------------------------------------------------------------------
|
---|
18 | (def_char START_YELLOW
|
---|
19 | (funs (ai_fun do_nothing)
|
---|
20 | (get_cache_list_fun start_cache)
|
---|
21 | (draw_fun dev_draw))
|
---|
22 | (range 0 0)
|
---|
23 | (states "addon/team/team.spe" (stopped "start_yellow")))
|
---|
24 |
|
---|
25 | ;----------------------------------------------------------------------
|
---|
26 | (def_char START_BLUE
|
---|
27 | (funs (ai_fun do_nothing)
|
---|
28 | (get_cache_list_fun start_cache)
|
---|
29 | (draw_fun dev_draw))
|
---|
30 | (range 0 0)
|
---|
31 | (states "addon/team/team.spe" (stopped "start_blue")))
|
---|
32 |
|
---|
33 | ;----------------------------------------------------------------------
|
---|
34 | (def_char START_TEAM
|
---|
35 | (vars
|
---|
36 | start.team
|
---|
37 | )
|
---|
38 | (funs
|
---|
39 | (ai_fun do_nothing)
|
---|
40 | (get_cache_list_fun start_cache)
|
---|
41 | (draw_fun dev_draw)
|
---|
42 | )
|
---|
43 | (range 0 0)
|
---|
44 | (states "addon/team/team.spe" (stopped "start_blue"))
|
---|
45 | )
|
---|
46 |
|
---|
47 |
|
---|
48 | ;----------------------------------------------------------------------
|
---|
49 | ;-=-=-=- CTF Flags -=-=-=-;
|
---|
50 | ;----------------------------------------------------------------------
|
---|
51 |
|
---|
52 | (defun base_draw ()
|
---|
53 | (draw_tint (aref player_tints base.team))
|
---|
54 | (if (edit_mode)
|
---|
55 | (progn
|
---|
56 | (let (
|
---|
57 | (x1 (- (x) (xvel)))
|
---|
58 | (y1 (- (y) (yvel)))
|
---|
59 | (x2 (+ (x) (xvel)))
|
---|
60 | (y2 (+ (y) (yvel)))
|
---|
61 | (c (find_rgb 0 255 0))
|
---|
62 | )
|
---|
63 | (draw_line x1 y1 x2 y1 c)
|
---|
64 | (draw_line x2 y1 x2 y2 c)
|
---|
65 | (draw_line x2 y2 x1 y2 c)
|
---|
66 | (draw_line x1 y2 x1 y1 c)
|
---|
67 | )
|
---|
68 | (let (
|
---|
69 | (x1 (- (x) (xacel)))
|
---|
70 | (y1 (- (y) (yacel)))
|
---|
71 | (x2 (+ (x) (xacel)))
|
---|
72 | (y2 (+ (y) (yacel)))
|
---|
73 | (c (find_rgb 255 0 0))
|
---|
74 | )
|
---|
75 | (draw_line x1 y1 x2 y1 c)
|
---|
76 | (draw_line x2 y1 x2 y2 c)
|
---|
77 | (draw_line x2 y2 x1 y2 c)
|
---|
78 | (draw_line x1 y2 x1 y1 c)
|
---|
79 | )
|
---|
80 | )
|
---|
81 | )
|
---|
82 | )
|
---|
83 |
|
---|
84 | ;----------------------------------------------------------------------
|
---|
85 | (defun base_flag_check (i)
|
---|
86 | (if (>= i 0)
|
---|
87 | (progn
|
---|
88 | (let (
|
---|
89 | (dx (- (x) (with_object (get_object i) (x))))
|
---|
90 | (dy (- (y) (with_object (get_object i) (y))))
|
---|
91 | )
|
---|
92 | (let (
|
---|
93 | (dx (if (< dx 0) (- 0 dx) dx))
|
---|
94 | (dy (if (< dy 0) (- 0 dy) dy))
|
---|
95 | )
|
---|
96 | (if (and (< dx (xvel)) (< dy (yvel)))
|
---|
97 | (with_object (get_object i) ; The flag
|
---|
98 | (progn
|
---|
99 | (with_object (get_object 1) ; The flag's owner
|
---|
100 | (progn
|
---|
101 | (remove_object (me))
|
---|
102 | )
|
---|
103 | )
|
---|
104 | (remove_object (get_object 1))
|
---|
105 | (set_x (with_object (get_object 0) (x)))
|
---|
106 | (set_y (- (with_object (get_object 0) (y)) (picture_height)))
|
---|
107 | )
|
---|
108 | )
|
---|
109 | )
|
---|
110 | )
|
---|
111 | )
|
---|
112 | (base_flag_check (- i 1))
|
---|
113 | )
|
---|
114 | )
|
---|
115 | )
|
---|
116 |
|
---|
117 | ;----------------------------------------------------------------------
|
---|
118 | (defun base_ai ()
|
---|
119 | (base_flag_check (- (total_objects) 1))
|
---|
120 | T
|
---|
121 | )
|
---|
122 |
|
---|
123 | ;----------------------------------------------------------------------
|
---|
124 | (defun flag_draw ()
|
---|
125 | (draw_tint (aref player_tints flag.team))
|
---|
126 | )
|
---|
127 |
|
---|
128 | ;----------------------------------------------------------------------
|
---|
129 | (defun flag_ai ()
|
---|
130 | (if (and (touching_bg) (eq (total_objects) 1) (not (eq flag.team (with_object (bg) (get_object_team)))))
|
---|
131 | (progn
|
---|
132 | (link_object (bg))
|
---|
133 | (with_object (bg) (link_object (me)))
|
---|
134 | )
|
---|
135 | )
|
---|
136 | (if (> (total_objects) 1)
|
---|
137 | (progn
|
---|
138 | (if (>= 0 (with_object (get_object 1) (hp)))
|
---|
139 | (progn
|
---|
140 | (setq flag.delay 0)
|
---|
141 | (remove_object (get_object 1))
|
---|
142 | )
|
---|
143 | (progn
|
---|
144 | (set_x (with_object (get_object 1) (x)))
|
---|
145 | (set_y (with_object (get_object 1) (- (y) (/ (picture_height) 2))))
|
---|
146 | )
|
---|
147 | )
|
---|
148 | )
|
---|
149 | (progn
|
---|
150 | (setq flag.delay (+ flag.delay 1))
|
---|
151 | (if (eq flag.delay 75) ; 5 second delay
|
---|
152 | (progn
|
---|
153 | (set_x (with_object (get_object 0) (x)))
|
---|
154 | (set_y (with_object (get_object 0) (y)))
|
---|
155 | )
|
---|
156 | )
|
---|
157 | )
|
---|
158 | )
|
---|
159 | (if (eq (total_objects) 0)
|
---|
160 | (progn
|
---|
161 | (print "Flag: I have no return point! Committing suicide...")
|
---|
162 | nil
|
---|
163 | )
|
---|
164 | T
|
---|
165 | )
|
---|
166 | )
|
---|
167 |
|
---|
168 | ;----------------------------------------------------------------------
|
---|
169 | (def_char CTF_FLAG
|
---|
170 | (vars
|
---|
171 | flag.team
|
---|
172 | flag.delay
|
---|
173 | flag.tint
|
---|
174 | )
|
---|
175 | (funs (ai_fun flag_ai)
|
---|
176 | (get_cache_list_fun start_cache)
|
---|
177 | (draw_fun flag_draw))
|
---|
178 | (fields
|
---|
179 | ("flag.team" "red/blue (0/1)")
|
---|
180 | )
|
---|
181 | (range 0 0)
|
---|
182 | (states "addon/team/team.spe" (stopped "flag0001"))
|
---|
183 | )
|
---|
184 |
|
---|
185 | ;----------------------------------------------------------------------
|
---|
186 | (def_char CTF_BASE
|
---|
187 | (vars
|
---|
188 | base.team
|
---|
189 | base.tint
|
---|
190 | )
|
---|
191 | (funs (ai_fun base_ai)
|
---|
192 | ;; (get_cache_list_fun start_cache)
|
---|
193 | (draw_fun base_draw))
|
---|
194 |
|
---|
195 | (fields
|
---|
196 | ("base.team" "red/blue (0/1)")
|
---|
197 | ("xvel" "X Range")
|
---|
198 | ("yvel" "Y Range")
|
---|
199 | )
|
---|
200 | (range 0 0)
|
---|
201 | (states "addon/team/team.spe" (stopped "flag0002"))
|
---|
202 | ) |
---|