1 void onslaught_generator_updatesprite(entity e);
2 void onslaught_controlpoint_updatesprite(entity e);
8 .float isgenneighbor_red;
9 .float isgenneighbor_blue;
10 .float iscpneighbor_red;
11 .float iscpneighbor_blue;
17 .string model1, model2, model3;
19 void onslaught_updatelinks()
21 local entity l, links;
22 local float stop, t1, t2, t3, t4;
23 // first check if the game has ended
24 dprint("--- updatelinks ---\n");
25 links = findchain(classname, "onslaught_link");
26 // mark generators as being shielded and networked
27 l = findchain(classname, "onslaught_generator");
31 dprint(etos(l), " (generator) belongs to team ", ftos(l.team), "\n");
33 dprint(etos(l), " (generator) is destroyed\n");
34 l.islinked = l.iscaptured;
35 l.isshielded = l.iscaptured;
38 // mark points as shielded and not networked
39 l = findchain(classname, "onslaught_controlpoint");
44 l.isgenneighbor_red = FALSE;
45 l.isgenneighbor_blue = FALSE;
46 l.iscpneighbor_red = FALSE;
47 l.iscpneighbor_blue = FALSE;
48 dprint(etos(l), " (point) belongs to team ", ftos(l.team), "\n");
51 // flow power outward from the generators through the network
55 dprint(etos(l), " (link) connects ", etos(l.goalentity), " with ", etos(l.enemy), "\n");
65 // if both points are captured by the same team, and only one of
66 // them is powered, mark the other one as powered as well
67 if (l.enemy.iscaptured && l.goalentity.iscaptured)
68 if (l.enemy.islinked != l.goalentity.islinked)
69 if (l.enemy.team == l.goalentity.team)
71 if (!l.goalentity.islinked)
74 l.goalentity.islinked = TRUE;
75 dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n");
77 else if (!l.enemy.islinked)
80 l.enemy.islinked = TRUE;
81 dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n");
87 // now that we know which points are powered we can mark their neighbors
88 // as unshielded if team differs
92 if (l.goalentity.team != l.enemy.team)
94 if (l.goalentity.islinked)
96 dprint(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n");
97 l.enemy.isshielded = FALSE;
98 if(l.goalentity.classname == "onslaught_generator")
100 if(l.goalentity.team == COLOR_TEAM1)
101 l.enemy.isgenneighbor_red = TRUE;
102 else if(l.goalentity.team == COLOR_TEAM2)
103 l.enemy.isgenneighbor_blue = TRUE;
107 if(l.goalentity.team == COLOR_TEAM1)
108 l.enemy.iscpneighbor_red = TRUE;
109 else if(l.goalentity.team == COLOR_TEAM2)
110 l.enemy.iscpneighbor_blue = TRUE;
113 if (l.enemy.islinked)
115 dprint(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n");
116 l.goalentity.isshielded = FALSE;
117 if(l.enemy.classname == "onslaught_generator")
119 if(l.enemy.team == COLOR_TEAM1)
120 l.goalentity.isgenneighbor_red = TRUE;
121 else if(l.enemy.team == COLOR_TEAM2)
122 l.goalentity.isgenneighbor_blue = TRUE;
126 if(l.enemy.team == COLOR_TEAM1)
127 l.goalentity.iscpneighbor_red = TRUE;
128 else if(l.enemy.team == COLOR_TEAM2)
129 l.goalentity.iscpneighbor_blue = TRUE;
135 // now update the takedamage and alpha variables on generator shields
136 l = findchain(classname, "onslaught_generator");
141 dprint(etos(l), " (generator) is shielded\n");
143 l.takedamage = DAMAGE_NO;
144 l.bot_attack = FALSE;
148 dprint(etos(l), " (generator) is not shielded\n");
150 l.takedamage = DAMAGE_AIM;
155 // now update the takedamage and alpha variables on control point icons
156 l = findchain(classname, "onslaught_controlpoint");
161 dprint(etos(l), " (point) is shielded\n");
165 l.goalentity.takedamage = DAMAGE_NO;
166 l.goalentity.bot_attack = FALSE;
171 dprint(etos(l), " (point) is not shielded\n");
175 l.goalentity.takedamage = DAMAGE_AIM;
176 l.goalentity.bot_attack = TRUE;
179 onslaught_controlpoint_updatesprite(l);
182 // count generators owned by each team
183 t1 = t2 = t3 = t4 = 0;
184 l = findchain(classname, "onslaught_generator");
189 if (l.team == COLOR_TEAM1) t1 = 1;
190 if (l.team == COLOR_TEAM2) t2 = 1;
191 if (l.team == COLOR_TEAM3) t3 = 1;
192 if (l.team == COLOR_TEAM4) t4 = 1;
194 onslaught_generator_updatesprite(l);
197 // see if multiple teams remain (if not, it's game over)
198 if (t1 + t2 + t3 + t4 < 2)
199 dprint("--- game over ---\n");
201 dprint("--- done updating links ---\n");
204 float onslaught_controlpoint_can_be_linked(entity cp, float t)
208 if(cp.isgenneighbor_red)
210 if(cp.iscpneighbor_red)
213 else if(t == COLOR_TEAM2)
215 if(cp.isgenneighbor_blue)
217 if(cp.iscpneighbor_blue)
223 // check to see if this player has a legitimate claim to capture this
224 // control point - more specifically that there is a captured path of
225 // points leading back to the team generator
226 e = findchain(classname, "onslaught_link");
229 if (e.goalentity == cp)
231 dprint(etos(e), " (link) connects to ", etos(e.enemy), " (point)");
232 if (e.enemy.islinked)
234 dprint(" which is linked");
235 if (e.enemy.team == t)
237 dprint(" and has the correct team!\n");
241 dprint(" but has the wrong team\n");
246 else if (e.enemy == cp)
248 dprint(etos(e), " (link) connects to ", etos(e.goalentity), " (point)");
249 if (e.goalentity.islinked)
251 dprint(" which is linked");
252 if (e.goalentity.team == t)
254 dprint(" and has a team!\n");
258 dprint(" but has the wrong team\n");
269 float onslaught_controlpoint_attackable(entity cp, float t)
270 // -2: SAME TEAM, attackable by enemy!
275 // 3: attack it (HIGH PRIO)
276 // 4: touch it (HIGH PRIO)
284 else if(cp.goalentity)
286 // if there's already an icon built, nothing happens
289 a = onslaught_controlpoint_can_be_linked(cp, COLOR_TEAM1 + COLOR_TEAM2 - t);
290 if(a) // attackable by enemy?
291 return -2; // EMERGENCY!
294 // we know it can be linked, so no need to check
296 a = onslaught_controlpoint_can_be_linked(cp, t);
297 if(a == 2) // near our generator?
298 return 3; // EMERGENCY!
304 if(onslaught_controlpoint_can_be_linked(cp, t))
306 a = onslaught_controlpoint_can_be_linked(cp, COLOR_TEAM1 + COLOR_TEAM2 - t);
308 return 4; // GET THIS ONE NOW!
310 return 2; // TOUCH ME
316 void onslaught_generator_think()
320 self.nextthink = ceil(time + 1);
321 if (cvar("timelimit"))
322 if (time > cvar("timelimit") * 60 - 60)
324 // self.max_health / 300 gives 5 minutes of overtime.
325 // control points reduce the overtime duration.
326 sound(self, CHAN_TRIGGER, "sound/onslaught/generator_decay.wav", VOL_BASE, ATTN_NORM);
328 e = findchain(classname, "onslaught_controlpoint");
331 if (e.team != self.team)
336 d = d * self.max_health / 300;
337 Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
341 void onslaught_generator_deaththink()
346 self.nextthink = time + 0.1;
347 self.count = self.count - 1;
348 org = randompos(self.origin + self.mins + '8 8 8', self.origin + self.maxs + '-8 -8 -8');
349 pointparticles(particleeffectnum("onslaught_generator_smallexplosion"), org, '0 0 0', 1);
350 sound(self, CHAN_TRIGGER, "sound/weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
355 pointparticles(particleeffectnum("onslaught_generator_finalexplosion"), org, '0 0 0', 1);
356 sound(self, CHAN_TRIGGER, "sound/weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
360 void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
364 if (attacker != self)
368 // this is protected by a shield, so ignore the damage
369 if (time > self.pain_finished)
370 if (attacker.classname == "player")
372 play2(attacker, "sound/onslaught/damageblockedbyshield.wav");
373 self.pain_finished = time + 1;
377 if (time > self.pain_finished)
379 self.pain_finished = time + 5;
380 bprint(ColoredTeamName(self.team), " generator under attack!\n");
381 play2team(self.team, "sound/onslaught/generator_underattack.wav");
384 self.health = self.health - damage;
385 // choose an animation frame based on health
386 self.frame = 10 * bound(0, (1 - self.health / self.max_health), 1);
387 // see if the generator is still functional, or dying
391 lh = ceil(self.lasthealth / 100) * 100;
392 h = ceil(self.health / 100) * 100;
394 bprint(ColoredTeamName(self.team), " generator has less than ", ftos(h), " health remaining\n");
395 self.lasthealth = self.health;
399 if (attacker == self)
400 bprint(ColoredTeamName(self.team), " generator spontaneously exploded due to overtime!\n");
404 t = ColoredTeamName(attacker.team);
405 bprint(ColoredTeamName(self.team), " generator destroyed by ", t, "!\n");
407 self.iscaptured = FALSE;
408 self.islinked = FALSE;
409 self.isshielded = FALSE;
410 self.takedamage = DAMAGE_NO; // can't be hurt anymore
411 self.event_damage = SUB_Null; // won't do anything if hurt
412 self.count = 30; // 30 explosions
413 self.think = onslaught_generator_deaththink; // explosion sequence
414 self.nextthink = time; // start exploding immediately
415 self.think(); // do the first explosion now
416 onslaught_updatelinks();
420 // update links after a delay
421 void onslaught_generator_delayed()
423 onslaught_updatelinks();
424 // now begin normal thinking
425 self.think = onslaught_generator_think;
426 self.nextthink = time;
429 string onslaught_generator_waypointsprite_for_team(entity e, float t)
433 if(e.team == COLOR_TEAM1)
434 return "ons-gen-red";
435 else if(e.team == COLOR_TEAM2)
436 return "ons-gen-blue";
439 return "ons-gen-shielded";
440 if(e.team == COLOR_TEAM1)
441 return "ons-gen-red";
442 else if(e.team == COLOR_TEAM2)
443 return "ons-gen-blue";
447 void onslaught_generator_updatesprite(entity e)
450 s1 = onslaught_generator_waypointsprite_for_team(e, COLOR_TEAM1);
451 s2 = onslaught_generator_waypointsprite_for_team(e, COLOR_TEAM2);
452 s3 = onslaught_generator_waypointsprite_for_team(e, -1);
453 WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
455 if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
457 e.lastteam = e.team + 2;
458 e.lastshielded = e.isshielded;
461 if(e.team == COLOR_TEAM1)
462 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0 0');
463 else if(e.team == COLOR_TEAM2)
464 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0 0 0.5');
466 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
470 if(e.team == COLOR_TEAM1)
471 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '1 0 0');
472 else if(e.team == COLOR_TEAM2)
473 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0 0 1');
475 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
477 WaypointSprite_Ping(e.sprite);
481 string onslaught_controlpoint_waypointsprite_for_team(entity e, float t)
486 a = onslaught_controlpoint_attackable(e, t);
487 if(a == 3 || a == 4) // ATTACK/TOUCH THIS ONE NOW
489 if(e.team == COLOR_TEAM1)
490 return "ons-cp-atck-red";
491 else if(e.team == COLOR_TEAM2)
492 return "ons-cp-atck-blue";
494 return "ons-cp-atck-neut";
496 else if(a == -2) // DEFEND THIS ONE NOW
498 if(e.team == COLOR_TEAM1)
499 return "ons-cp-dfnd-red";
500 else if(e.team == COLOR_TEAM2)
501 return "ons-cp-dfnd-blue";
503 else if(e.team == t || a == -1 || a == 1) // own point, or fire at it
505 if(e.team == COLOR_TEAM1)
507 else if(e.team == COLOR_TEAM2)
508 return "ons-cp-blue";
510 else if(a == 2) // touch it
511 return "ons-cp-neut";
515 if(e.team == COLOR_TEAM1)
517 else if(e.team == COLOR_TEAM2)
518 return "ons-cp-blue";
520 return "ons-cp-neut";
525 void onslaught_controlpoint_updatesprite(entity e)
528 s1 = onslaught_controlpoint_waypointsprite_for_team(e, COLOR_TEAM1);
529 s2 = onslaught_controlpoint_waypointsprite_for_team(e, COLOR_TEAM2);
530 s3 = onslaught_controlpoint_waypointsprite_for_team(e, -1);
531 WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
534 sh = !(onslaught_controlpoint_can_be_linked(e, COLOR_TEAM1) || onslaught_controlpoint_can_be_linked(e, COLOR_TEAM2));
536 if(e.lastteam != e.team + 2 || e.lastshielded != sh)
538 e.lastteam = e.team + 2;
542 if(e.team == COLOR_TEAM1)
543 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0 0');
544 else if(e.team == COLOR_TEAM2)
545 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0 0 0.5');
547 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
551 if(e.team == COLOR_TEAM1)
552 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '1 0 0');
553 else if(e.team == COLOR_TEAM2)
554 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0 0 1');
556 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
558 WaypointSprite_Ping(e.sprite);
562 /*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64)
565 spawnfunc_onslaught_link entities can target this.
568 "team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
569 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
571 void spawnfunc_onslaught_generator()
580 precache_model("models/onslaught/generator.md3");
581 precache_model("models/onslaught/generator_shield.md3");
582 precache_sound("sound/onslaught/generator_decay.wav");
583 precache_sound("sound/weapons/grenade_impact.wav");
584 precache_sound("sound/weapons/rocket_impact.wav");
585 precache_sound("sound/onslaught/generator_underattack.wav");
587 objerror("team must be set");
588 self.team_saved = self.team;
589 self.colormap = 1024 + (self.team - 1) * 17;
590 self.solid = SOLID_BSP;
591 self.movetype = MOVETYPE_NONE;
592 self.lasthealth = self.max_health = self.health = cvar("g_onslaught_gen_health");
593 setmodel(self, "models/onslaught/generator.md3");
594 //setsize(self, '-32 -32 -24', '32 32 64');
595 setorigin(self, self.origin);
596 self.takedamage = DAMAGE_AIM;
597 self.bot_attack = TRUE;
598 self.event_damage = onslaught_generator_damage;
599 self.iscaptured = TRUE;
600 self.islinked = TRUE;
601 self.isshielded = TRUE;
602 // spawn shield model which indicates whether this can be damaged
603 self.enemy = e = spawn();
605 e.movetype = MOVETYPE_NONE;
606 e.effects = EF_ADDITIVE;
607 setmodel(e, "models/onslaught/generator_shield.md3");
608 //setsize(e, '-32 -32 0', '32 32 128');
609 setorigin(e, self.origin);
610 e.colormap = self.colormap;
612 self.think = onslaught_generator_delayed;
613 self.nextthink = time + 0.2;
615 WaypointSprite_SpawnFixed(string_null, e.origin + '0 0 1' * e.maxs_z, self, sprite);
616 WaypointSprite_UpdateRule(self.sprite, COLOR_TEAM2, SPRITERULE_TEAMPLAY);
618 onslaught_updatelinks();
621 void onslaught_generator_reset()
623 self.team = self.team_saved;
624 self.lasthealth = self.max_health = self.health = cvar("g_onslaught_gen_health");
625 self.takedamage = DAMAGE_AIM;
626 self.bot_attack = TRUE;
627 self.iscaptured = TRUE;
628 self.islinked = TRUE;
629 self.isshielded = TRUE;
630 self.enemy.solid = SOLID_NOT;
631 self.think = onslaught_generator_delayed;
632 self.nextthink = time + 0.2;
635 void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
640 if (self.owner.isshielded)
642 // this is protected by a shield, so ignore the damage
643 if (time > self.pain_finished)
644 if (attacker.classname == "player")
646 play2(attacker, "sound/onslaught/damageblockedbyshield.wav");
647 self.pain_finished = time + 1;
651 if (time > self.pain_finished)
652 if (attacker.classname == "player")
654 play2team(self.team, "sound/onslaught/controlpoint_underattack.wav");
655 self.pain_finished = time + 5;
657 self.health = self.health - damage;
658 self.alpha = self.health / self.max_health;
659 self.pain_finished = time + 1;
660 // colormod flash when shot
661 self.colormod = '2 2 2';
664 sound(self, CHAN_TRIGGER, "sound/weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
665 pointparticles(particleeffectnum("onslaught_controlpoint_explosion"), self.origin, '0 0 0', 1);
668 t = ColoredTeamName(attacker.team);
669 bprint(ColoredTeamName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
671 self.owner.goalentity = world;
672 self.owner.islinked = FALSE;
673 self.owner.iscaptured = FALSE;
675 self.owner.colormap = 1024;
676 onslaught_updatelinks();
678 // Use targets now (somebody make sure this is in the right place..)
681 activator = self.owner;
689 void onslaught_controlpoint_icon_think()
691 self.nextthink = time + 0.1;
692 if (time > self.pain_finished + 1)
694 self.health = self.health + self.count;
695 if (self.health >= self.max_health)
696 self.health = self.max_health;
698 self.alpha = self.health / self.max_health;
699 // colormod flash when shot
700 self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
703 void onslaught_controlpoint_icon_buildthink()
707 self.nextthink = time + 0.1;
708 self.health = self.health + self.count;
709 if (self.health >= self.max_health)
711 self.health = self.max_health;
712 self.count = self.count * 0.2; // slow repair rate from now on
713 self.think = onslaught_controlpoint_icon_think;
714 sound(self, CHAN_TRIGGER, "sound/onslaught/controlpoint_built.wav", VOL_BASE, ATTN_NORM);
715 bprint(ColoredTeamName(self.team), " captured ", self.owner.message, " control point\n");
716 self.owner.iscaptured = TRUE;
717 onslaught_updatelinks();
719 // Use targets now (somebody make sure this is in the right place..)
726 self.alpha = self.health / self.max_health;
727 // colormod flash when shot
728 self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
731 void onslaught_controlpoint_touch()
735 if (other.classname != "player")
737 a = onslaught_controlpoint_attackable(self, other.team);
740 // we've verified that this player has a legitimate claim to this point,
741 // so start building the captured point icon (which only captures this
742 // point if it successfully builds without being destroyed first)
743 self.goalentity = e = spawn();
745 e.max_health = cvar("g_onslaught_cp_health");
746 e.health = e.max_health * 0.1;
747 e.alpha = e.health / e.max_health;
748 e.solid = SOLID_BBOX;
749 e.movetype = MOVETYPE_NONE;
750 setmodel(e, "models/onslaught/controlpoint_icon.md3");
751 setsize(e, '-32 -32 -32', '32 32 32');
752 setorigin(e, self.origin + '0 0 96');
753 e.takedamage = DAMAGE_AIM;
755 e.event_damage = onslaught_controlpoint_icon_damage;
757 e.colormap = 1024 + (e.team - 1) * 17;
758 e.think = onslaught_controlpoint_icon_buildthink;
759 e.nextthink = time + 0.1;
760 e.count = e.max_health / 50; // how long it takes to build
761 sound(e, CHAN_TRIGGER, "sound/onslaught/controlpoint_build.wav", VOL_BASE, ATTN_NORM);
763 self.colormap = e.colormap;
766 /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
767 Control point. Be sure to give this enough clearance so that the shootable part has room to exist
769 This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
772 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
773 "target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities.
774 "message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
776 void spawnfunc_onslaught_controlpoint()
784 precache_model("models/onslaught/controlpoint_pad.md3");
785 precache_model("models/onslaught/controlpoint_shield.md3");
786 precache_model("models/onslaught/controlpoint_icon.md3");
787 precache_sound("sound/onslaught/controlpoint_build.wav");
788 precache_sound("sound/onslaught/controlpoint_built.wav");
789 precache_sound("sound/weapons/grenade_impact.wav");
790 precache_sound("sound/onslaught/damageblockedbyshield.wav");
791 precache_sound("sound/onslaught/controlpoint_underattack.wav");
792 self.solid = SOLID_BSP;
793 self.movetype = MOVETYPE_NONE;
794 setmodel(self, "models/onslaught/controlpoint_pad.md3");
795 //setsize(self, '-32 -32 0', '32 32 8');
796 setorigin(self, self.origin);
797 self.touch = onslaught_controlpoint_touch;
799 self.colormap = 1024;
800 self.iscaptured = FALSE;
801 self.islinked = FALSE;
802 self.isshielded = TRUE;
803 // spawn shield model which indicates whether this can be damaged
804 self.enemy = e = spawn();
806 e.movetype = MOVETYPE_NONE;
807 e.effects = EF_ADDITIVE;
808 setmodel(e, "models/onslaught/controlpoint_shield.md3");
809 //setsize(e, '-32 -32 0', '32 32 128');
810 setorigin(e, self.origin);
811 e.colormap = self.colormap;
813 waypoint_spawnforitem(self);
815 WaypointSprite_SpawnFixed(string_null, e.origin + '0 0 1' * e.maxs_z, self, sprite);
816 WaypointSprite_UpdateRule(self.sprite, COLOR_TEAM2, SPRITERULE_TEAMPLAY);
818 onslaught_updatelinks();
821 void onslaught_controlpoint_reset()
823 if(self.goalentity && self.goalentity != world)
824 remove(self.goalentity);
825 self.goalentity = world;
827 self.colormap = 1024;
828 self.iscaptured = FALSE;
829 self.islinked = FALSE;
830 self.isshielded = TRUE;
831 self.enemy.solid = SOLID_NOT;
832 self.enemy.colormap = self.colormap;
833 self.think = self.enemy.think = SUB_Null;
834 self.nextthink = 0; // don't like SUB_Null :P
836 onslaught_updatelinks();
839 SUB_UseTargets(); // to reset the structures, playerspawns etc.
842 void onslaught_link_delayed()
844 self.goalentity = find(world, targetname, self.target);
845 self.enemy = find(world, targetname, self.target2);
846 if (!self.goalentity)
847 objerror("can not find target\n");
849 objerror("can not find target2\n");
850 dprint(etos(self.goalentity), " linked with ", etos(self.enemy), "\n");
853 /*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
854 Link between control points.
856 This entity targets two different spawnfunc_onslaught_controlpoint or spawnfunc_onslaught_generator entities, and suppresses shielding on both if they are owned by different teams.
859 "target" - first control point.
860 "target2" - second control point.
862 void spawnfunc_onslaught_link()
869 if (self.target == "" || self.target2 == "")
870 objerror("target and target2 must be set\n");
871 self.think = onslaught_link_delayed;
872 self.nextthink = time + 0.1;