2 // attacker spawn point
3 void info_player_attacker() {
4 info_player_deathmatch();
5 self.team = COLOR_TEAM1; // red, gets swapped every round
8 // defender spawn point
9 void info_player_defender() {
10 info_player_deathmatch();
11 self.team = COLOR_TEAM2; // blue, gets swapped every round
14 // reset this objective. Used when spawning an objective
15 // and when a new round starts
16 void assault_objective_reset() {
17 self.health = ASSAULT_VALUE_INACTIVE;
20 void assault_objective_use() {
23 self.nextthink = time + 0.1;
26 void assault_objective_think() {
31 ent = find(world, targetname, self.target);
37 ent = find(ent, targetname, self.target);
41 //self.effects = EF_STARDUST;
42 self.nextthink = time + 0.1;
47 void target_objective() {
48 self.classname = "target_objective";
49 self.think = assault_objective_think;
50 self.use = assault_objective_use;
51 assault_objective_reset();
55 void assault_objective_decrease_think() {
57 local entity objective;
60 objective = find(world, targetname, self.target);
61 while(objective && found == 0) {
62 if(objective.classname == "target_objective") {
64 if(objective.health < ASSAULT_VALUE_INACTIVE) { // targeted objective is active
65 if(self.cnt == 1 && self.max_health >= ASSAULT_VALUE_INACTIVE) {
66 // decrease was fired already, but objective did recover (round reset)
69 } else { // objective isn't active
72 self.max_health = objective.health; // save current objective status for next think
77 if(self.model != self.mdl)
78 setmodel(self, self.mdl);
83 self.nextthink = time + 0.2;
87 // decrease the health of targeted objectives
88 void assault_objective_decrease() {
90 if(activator.team != self.team)
94 ent = find(world, targetname, self.target);
96 if(ent.health > 0 && ent.health < ASSAULT_VALUE_INACTIVE)
97 ent.health = ent.health - self.dmg;
98 ent = find(ent, targetname, self.target);
104 // this entity should target an objective and be targeted by triggers
105 void target_objective_decrease() {
107 self.classname = "target_objective_decrease";
112 self.cnt = 0; // not used yet
113 self.use = assault_objective_decrease;
114 self.mdl = "models/sprites/here.sp2";
115 self.effects = EF_NODEPTHTEST;
116 self.team = COLOR_TEAM1; // red team, swaps every round
117 self.health = ASSAULT_VALUE_INACTIVE;
118 self.max_health = ASSAULT_VALUE_INACTIVE;
119 self.think = assault_objective_decrease_think;
120 self.nextthink = time;
124 void assault_destructible_reset() {
125 self.health = self.max_health;
126 self.model = self.mdl;
127 self.solid = SOLID_BSP;
128 self.cnt = 0; // not active
133 void assault_destructible_use() {
134 self.cnt = 1; // mark active
135 self.takedamage = DAMAGE_YES;
136 self.nextthink = time + 0.1;
139 void assault_destructible_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) {
141 if(self.cnt > 0 && self.team == attacker.team)
142 self.health = self.health - damage;
147 void assault_destructible_think() {
148 local entity oldself;
150 if(self.cnt > 0 && self.health < 0) {
152 self.takedamage = DAMAGE_NO;
153 self.solid = SOLID_NOT;
155 ent = find(world, targetname, self.target);
161 ent = find(ent, targetname, self.target);
164 self.nextthink = time + 0.1;
168 // destructible walls that can be used to trigger target_objective_decrease
169 void func_assault_destructible() {
173 self.max_health = self.health;
175 self.cnt = 0; // not yet activated
177 self.classname = "func_assault_destructible";
178 self.team = COLOR_TEAM1; // red team, gets swapped every round
179 self.mdl = self.model;
180 setmodel(self, self.mdl);
182 self.solid = SOLID_BSP;
183 self.think = assault_destructible_think;
184 self.use = assault_destructible_use;
185 self.event_damage = assault_destructible_damage;
191 // reset objectives, toggle spawnpoints, reset triggers, ...
192 void assault_new_round() {
194 // this assumes self.classname == "func_assault_roundend"!
195 self.cnt = self.cnt + 1;
197 // swap spawn point teams
199 local entity oldself;
201 ent = find(world, classname, "info_player_deathmatch");
206 if(self.team == COLOR_TEAM1) {
207 self.team = COLOR_TEAM2;
209 self.team = COLOR_TEAM1;
213 ent = find(ent, classname, "info_player_deathmatch");
216 // reset all objectives
217 ent = find(world, classname, "target_objective");
222 assault_objective_reset();
225 ent = find(ent, classname, "target_objective");
228 // reset all target_object_decrease
229 ent = find(world, classname, "target_objective_decrease");
232 if(ent.team == COLOR_TEAM1) {
233 ent.team = COLOR_TEAM2;
235 ent.team = COLOR_TEAM1;
238 ent = find(ent, classname, "target_objective_decrease");
241 // reset all func_assault_destructible
242 ent = find(world, classname, "func_assault_destructible");
247 assault_destructible_reset();
248 if(self.team == COLOR_TEAM1) {
249 self.team = COLOR_TEAM2;
251 self.team = COLOR_TEAM1;
254 ent = find(ent, classname, "func_assault_destructible");
257 ent = find(world, classname, "target_assault_roundstart");
264 ent = find(ent, classname, "target_assault_roundstart");
267 // actually restart round... how to do that?
270 void target_assault_roundend() {
271 self.cnt = 0; // round counter
272 self.classname = "target_assault_roundend";
273 self.use = assault_new_round;
276 void assault_roundstart_use() {
278 local entity oldself;
279 ent = find(world, targetname, self.target);
285 ent = find(ent, targetname, self.target);
289 void target_assault_roundstart() {
290 self.classname = "target_assault_roundstart";
291 self.use = assault_roundstart_use;
292 self.think = assault_roundstart_use;
293 self.nextthink = time + 0.1;