2 // attacker spawn point
3 void info_player_attacker() {
4 self.team = COLOR_TEAM1; // red, gets swapped every round
5 info_player_deathmatch();
8 // defender spawn point
9 void info_player_defender() {
10 self.team = COLOR_TEAM2; // blue, gets swapped every round
11 info_player_deathmatch();
14 // reset this objective. Used when spawning an objective
15 // and when a new round starts
16 void assault_objective_reset() {
17 if(self.spawnflags) { // first objective
19 self.nextthink = time + 0.1;
21 self.health = ASSAULT_VALUE_INACTIVE;
25 void assault_objective_use() {
28 self.nextthink = time + 0.1;
31 void assault_objective_think() {
36 ent = find(world, targetname, self.target);
42 ent = find(ent, targetname, self.target);
46 self.effects = EF_STARDUST;
47 self.nextthink = time + 0.1;
52 void target_objective() {
53 self.classname = "target_objective";
54 self.think = assault_objective_think;
55 self.use = assault_objective_use;
56 assault_objective_reset();
59 // decrease the health of targeted objectives
60 void assault_objective_decrease() {
63 ent = find(world, targetname, self.target);
65 if(ent.health > 0 && ent.health < ASSAULT_VALUE_INACTIVE)
66 ent.health = ent.health - self.dmg;
67 ent = find(ent, targetname, self.target);
73 // this entity should target an objective and be targeted by triggers
74 void target_objective_decrease() {
76 self.classname = "target_objective_decrease";
81 self.use = assault_objective_decrease;
85 void assault_destructible_reset() {
86 self.health = self.max_health;
87 self.model = self.mdl;
88 self.solid = SOLID_BSP;
89 self.cnt = 0; // not active
94 void assault_destructible_use() {
95 self.cnt = 1; // mark active
96 self.takedamage = DAMAGE_YES;
97 self.nextthink = time + 0.1;
100 void assault_destructible_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) {
101 // TODO: check for teams
104 self.health = self.health - damage;
109 void assault_destructible_think() {
110 local entity oldself;
112 if(self.cnt > 0 && self.health < 0) {
114 self.takedamage = DAMAGE_NO;
115 self.solid = SOLID_NOT;
117 ent = find(world, targetname, self.target);
123 ent = find(ent, targetname, self.target);
126 self.nextthink = time + 0.1;
130 // destructible walls that can be used to trigger target_objective_decrease
131 void func_assault_destructible() {
135 self.max_health = self.health;
137 self.cnt = 0; // not yet activated
139 self.classname = "func_assault_destructible";
140 self.mdl = self.model;
141 setmodel(self, self.mdl);
143 self.solid = SOLID_BSP;
144 self.think = assault_destructible_think;
145 self.use = assault_destructible_use;
146 self.event_damage = assault_destructible_damage;
148 if(self.spawnflags) // active from start
154 // reset objectives, toggle spawnpoints, reset triggers, ...
155 void assault_new_round() {
157 // this assumes self.classname == "func_assault_roundend"!
158 self.cnt = self.cnt + 1;
160 // swap spawn point teams
162 local entity oldself;
164 ent = find(world, classname, "info_player_deathmatch");
169 if(self.team == COLOR_TEAM1) {
170 self.team = COLOR_TEAM2;
172 self.team = COLOR_TEAM1;
176 ent = find(ent, classname, "info_player_deathmatch");
179 // reset all objectives
180 ent = find(world, classname, "target_objective");
185 assault_objective_reset();
188 ent = find(ent, classname, "target_objective");
191 // reset all func_assault_destructible
192 ent = find(world, classname, "func_assault_destructible");
197 assault_destructible_reset();
199 ent = find(ent, classname, "func_assault_destructible");
202 // actually restart round... how to do that?
205 void target_assault_roundend() {
206 self.cnt = 0; // round counter
207 self.classname = "target_assault_roundend";
208 self.use = assault_new_round;