1 float autocvar_g_onslaught_spawn_at_controlpoints;
2 float autocvar_g_onslaught_spawn_at_generator;
3 float autocvar_g_onslaught_cp_proxydecap;
4 var float autocvar_g_onslaught_cp_proxydecap_distance = 512;
5 var float autocvar_g_onslaught_cp_proxydecap_dps = 100;
7 void onslaught_generator_updatesprite(entity e);
8 void onslaught_controlpoint_updatesprite(entity e);
9 void onslaught_link_checkupdate();
15 .float isgenneighbor_red;
16 .float isgenneighbor_blue;
17 .float iscpneighbor_red;
18 .float iscpneighbor_blue;
25 entity ons_red_generator;
26 entity ons_blue_generator;
28 void ons_gib_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
30 self.velocity = self.velocity + vforce;
34 void ons_throwgib_think()
38 self.nextthink = time + 0.05;
40 d = self.giblifetime - time;
44 self.think = SUB_Remove;
52 pointparticles(particleeffectnum("onslaught_generator_gib_flame"), self.origin, '0 0 0', 1);
55 void ons_throwgib(vector v_from, vector v_to, string smodel, float f_lifetime, float b_burn)
61 setmodel(gib, smodel);
62 setorigin(gib, v_from);
63 gib.solid = SOLID_BBOX;
64 gib.movetype = MOVETYPE_BOUNCE;
65 gib.takedamage = DAMAGE_YES;
66 gib.event_damage = ons_gib_damage;
68 gib.effects = EF_LOWPRECISION;
69 gib.flags = FL_NOTARGET;
71 gib.giblifetime = time + f_lifetime;
75 gib.think = ons_throwgib_think;
76 gib.nextthink = time + 0.05;
79 SUB_SetFade(gib, gib.giblifetime, 2);
82 void onslaught_updatelinks()
85 float stop, t1, t2, t3, t4;
86 // first check if the game has ended
87 dprint("--- updatelinks ---\n");
88 links = findchain(classname, "onslaught_link");
89 // mark generators as being shielded and networked
90 l = findchain(classname, "onslaught_generator");
94 dprint(etos(l), " (generator) belongs to team ", ftos(l.team), "\n");
96 dprint(etos(l), " (generator) is destroyed\n");
97 l.islinked = l.iscaptured;
98 l.isshielded = l.iscaptured;
101 // mark points as shielded and not networked
102 l = findchain(classname, "onslaught_controlpoint");
107 l.isgenneighbor_red = FALSE;
108 l.isgenneighbor_blue = FALSE;
109 l.iscpneighbor_red = FALSE;
110 l.iscpneighbor_blue = FALSE;
111 dprint(etos(l), " (point) belongs to team ", ftos(l.team), "\n");
114 // flow power outward from the generators through the network
118 dprint(etos(l), " (link) connects ", etos(l.goalentity), " with ", etos(l.enemy), "\n");
128 // if both points are captured by the same team, and only one of
129 // them is powered, mark the other one as powered as well
130 if (l.enemy.iscaptured && l.goalentity.iscaptured)
131 if (l.enemy.islinked != l.goalentity.islinked)
132 if (l.enemy.team == l.goalentity.team)
134 if (!l.goalentity.islinked)
137 l.goalentity.islinked = TRUE;
138 dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n");
140 else if (!l.enemy.islinked)
143 l.enemy.islinked = TRUE;
144 dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n");
150 // now that we know which points are powered we can mark their neighbors
151 // as unshielded if team differs
155 if (l.goalentity.islinked)
157 if (l.goalentity.team != l.enemy.team)
159 dprint(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n");
160 l.enemy.isshielded = FALSE;
162 if(l.goalentity.classname == "onslaught_generator")
164 if(l.goalentity.team == NUM_TEAM_1)
165 l.enemy.isgenneighbor_red = TRUE;
166 else if(l.goalentity.team == NUM_TEAM_2)
167 l.enemy.isgenneighbor_blue = TRUE;
171 if(l.goalentity.team == NUM_TEAM_1)
172 l.enemy.iscpneighbor_red = TRUE;
173 else if(l.goalentity.team == NUM_TEAM_2)
174 l.enemy.iscpneighbor_blue = TRUE;
177 if (l.enemy.islinked)
179 if (l.goalentity.team != l.enemy.team)
181 dprint(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n");
182 l.goalentity.isshielded = FALSE;
184 if(l.enemy.classname == "onslaught_generator")
186 if(l.enemy.team == NUM_TEAM_1)
187 l.goalentity.isgenneighbor_red = TRUE;
188 else if(l.enemy.team == NUM_TEAM_2)
189 l.goalentity.isgenneighbor_blue = TRUE;
193 if(l.enemy.team == NUM_TEAM_1)
194 l.goalentity.iscpneighbor_red = TRUE;
195 else if(l.enemy.team == NUM_TEAM_2)
196 l.goalentity.iscpneighbor_blue = TRUE;
201 // now update the takedamage and alpha variables on generator shields
202 l = findchain(classname, "onslaught_generator");
207 dprint(etos(l), " (generator) is shielded\n");
209 l.takedamage = DAMAGE_NO;
210 l.bot_attack = FALSE;
214 dprint(etos(l), " (generator) is not shielded\n");
216 l.takedamage = DAMAGE_AIM;
221 // now update the takedamage and alpha variables on control point icons
222 l = findchain(classname, "onslaught_controlpoint");
227 dprint(etos(l), " (point) is shielded\n");
231 l.goalentity.takedamage = DAMAGE_NO;
232 l.goalentity.bot_attack = FALSE;
237 dprint(etos(l), " (point) is not shielded\n");
241 l.goalentity.takedamage = DAMAGE_AIM;
242 l.goalentity.bot_attack = TRUE;
245 onslaught_controlpoint_updatesprite(l);
248 // count generators owned by each team
249 t1 = t2 = t3 = t4 = 0;
250 l = findchain(classname, "onslaught_generator");
255 if (l.team == NUM_TEAM_1) t1 = 1;
256 if (l.team == NUM_TEAM_2) t2 = 1;
257 if (l.team == NUM_TEAM_3) t3 = 1;
258 if (l.team == NUM_TEAM_4) t4 = 1;
260 onslaught_generator_updatesprite(l);
263 // see if multiple teams remain (if not, it's game over)
264 if (t1 + t2 + t3 + t4 < 2)
265 dprint("--- game over ---\n");
267 dprint("--- done updating links ---\n");
270 float onslaught_controlpoint_can_be_linked(entity cp, float t)
274 if(cp.isgenneighbor_red)
276 if(cp.iscpneighbor_red)
279 else if(t == NUM_TEAM_2)
281 if(cp.isgenneighbor_blue)
283 if(cp.iscpneighbor_blue)
289 // check to see if this player has a legitimate claim to capture this
290 // control point - more specifically that there is a captured path of
291 // points leading back to the team generator
292 e = findchain(classname, "onslaught_link");
295 if (e.goalentity == cp)
297 dprint(etos(e), " (link) connects to ", etos(e.enemy), " (point)");
298 if (e.enemy.islinked)
300 dprint(" which is linked");
301 if (e.enemy.team == t)
303 dprint(" and has the correct team!\n");
307 dprint(" but has the wrong team\n");
312 else if (e.enemy == cp)
314 dprint(etos(e), " (link) connects to ", etos(e.goalentity), " (point)");
315 if (e.goalentity.islinked)
317 dprint(" which is linked");
318 if (e.goalentity.team == t)
320 dprint(" and has a team!\n");
324 dprint(" but has the wrong team\n");
335 float onslaught_controlpoint_attackable(entity cp, float t)
336 // -2: SAME TEAM, attackable by enemy!
341 // 3: attack it (HIGH PRIO)
342 // 4: touch it (HIGH PRIO)
350 else if(cp.goalentity)
352 // if there's already an icon built, nothing happens
355 a = onslaught_controlpoint_can_be_linked(cp, NUM_TEAM_1 + NUM_TEAM_2 - t);
356 if(a) // attackable by enemy?
357 return -2; // EMERGENCY!
360 // we know it can be linked, so no need to check
362 a = onslaught_controlpoint_can_be_linked(cp, t);
363 if(a == 2) // near our generator?
364 return 3; // EMERGENCY!
370 if(onslaught_controlpoint_can_be_linked(cp, t))
372 a = onslaught_controlpoint_can_be_linked(cp, NUM_TEAM_1 + NUM_TEAM_2 - t);
374 return 4; // GET THIS ONE NOW!
376 return 2; // TOUCH ME
382 float overtime_msg_time;
383 void onslaught_generator_think()
387 self.nextthink = ceil(time + 1);
390 if (autocvar_timelimit && time > game_starttime + autocvar_timelimit * 60)
392 if (!overtime_msg_time)
395 centerprint(e, "^3Now playing ^1OVERTIME^3!\n^3Generators start now to decay.\n^3The more control points your team holds,\n^3the faster the enemy generator decays.");
396 overtime_msg_time = time;
398 // self.max_health / 300 gives 5 minutes of overtime.
399 // control points reduce the overtime duration.
400 sound(self, CH_TRIGGER, "onslaught/generator_decay.wav", VOL_BASE, ATTEN_NORM);
402 e = findchain(classname, "onslaught_controlpoint");
405 if (e.team != self.team)
411 if(autocvar_g_campaign && autocvar__campaign_testrun)
412 d = d * self.max_health;
414 d = d * self.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
416 Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
418 else if (overtime_msg_time)
419 overtime_msg_time = 0;
421 if(!self.isshielded && self.wait < time)
423 self.wait = time + 5;
424 FOR_EACH_REALPLAYER(e)
426 if(e.team == self.team)
428 centerprint(e, "^1Your generator is NOT shielded!\n^7Re-capture controlpoints to shield it!");
429 soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTEN_NONE); // FIXME: Uniqe sound?
436 void onslaught_generator_ring_spawn(vector org)
438 modeleffect_spawn("models/onslaught/shockwavetransring.md3", 0, 0, org, '0 0 0', '0 0 0', '0 0 0', 0, -16, 0.1, 1.25, 0.25);
441 void onslaught_generator_ray_think()
443 self.nextthink = time + 0.05;
446 self.think = SUB_Remove;
459 void onslaught_generator_ray_spawn(vector org)
463 setmodel(e, "models/onslaught/ons_ray.md3");
465 e.angles = randomvec() * 360;
467 e.scale = random() * 5 + 8;
468 e.think = onslaught_generator_ray_think;
469 e.nextthink = time + 0.05;
472 void onslaught_generator_shockwave_spawn(vector org)
474 shockwave_spawn("models/onslaught/shockwave.md3", org, -64, 0.75, 0.5);
477 void onslaught_generator_damage_think()
479 if(self.owner.health < 0)
481 self.think = SUB_Remove;
484 self.nextthink = time+0.1;
486 // damaged fx (less probable the more damaged is the generator)
487 if(random() < 0.9 - self.owner.health / self.owner.max_health)
490 pointparticles(particleeffectnum("electro_ballexplode"), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
491 sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);
494 pointparticles(particleeffectnum("torch_small"), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1);
497 void onslaught_generator_damage_spawn(entity gd_owner)
502 e.health = self.owner.health;
503 setorigin(e, gd_owner.origin);
504 e.think = onslaught_generator_damage_think;
505 e.nextthink = time+1;
508 void onslaught_generator_deaththink()
517 if(self.count==40||self.count==20)
519 onslaught_generator_ring_spawn(self.origin);
520 sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTEN_NORM);
528 ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 6, TRUE);
530 ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 6, TRUE);
532 ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 6, TRUE);
538 org = self.origin + randompos('-30 -30 -30' * i + '0 0 -20', '30 30 30' * i + '0 0 20');
539 pointparticles(particleeffectnum("onslaught_generator_gib_explode"), org, '0 0 0', 1);
542 // Short explosion sound + small explosion
545 te_explosion(self.origin);
546 sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
550 org = self.origin + randompos(self.mins + '8 8 8', self.maxs + '-8 -8 -8');
551 pointparticles(particleeffectnum("onslaught_generator_smallexplosion"), org, '0 0 0', 1);
556 onslaught_generator_ray_spawn(self.origin);
564 onslaught_generator_shockwave_spawn(org);
565 pointparticles(particleeffectnum("onslaught_generator_finalexplosion"), org, '0 0 0', 1);
566 sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
569 self.nextthink = time + 0.05;
571 self.count = self.count - 1;
574 void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
581 if (attacker != self)
585 // this is protected by a shield, so ignore the damage
586 if (time > self.pain_finished)
587 if (IS_PLAYER(attacker))
589 play2(attacker, "onslaught/damageblockedbyshield.wav");
590 self.pain_finished = time + 1;
594 if (time > self.pain_finished)
596 self.pain_finished = time + 10;
597 bprint(Team_ColoredFullName(self.team), " generator under attack!\n");
598 play2team(self.team, "onslaught/generator_underattack.wav");
601 self.health = self.health - damage;
602 WaypointSprite_UpdateHealth(self.sprite, self.health);
603 // choose an animation frame based on health
604 self.frame = 10 * bound(0, (1 - self.health / self.max_health), 1);
605 // see if the generator is still functional, or dying
608 #ifdef ONSLAUGHT_SPAM
610 lh = ceil(self.lasthealth / 100) * 100;
611 h = ceil(self.health / 100) * 100;
613 bprint(Team_ColoredFullName(self.team), " generator has less than ", ftos(h), " health remaining\n");
615 self.lasthealth = self.health;
617 else if not(inWarmupStage)
619 if (attacker == self)
620 bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n");
624 t = Team_ColoredFullName(attacker.team);
625 bprint(Team_ColoredFullName(self.team), " generator destroyed by ", t, "!\n");
627 self.iscaptured = FALSE;
628 self.islinked = FALSE;
629 self.isshielded = FALSE;
630 self.takedamage = DAMAGE_NO; // can't be hurt anymore
631 self.event_damage = func_null; // won't do anything if hurt
632 self.count = 0; // reset counter
633 self.think = onslaught_generator_deaththink; // explosion sequence
634 self.nextthink = time; // start exploding immediately
635 self.think(); // do the first explosion now
637 WaypointSprite_UpdateMaxHealth(self.sprite, 0);
639 onslaught_updatelinks();
642 // Throw some flaming gibs on damage, more damage = more chance for gib
643 if(random() < damage/220)
645 sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
648 ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, TRUE);
650 ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib2.md3", 5, TRUE);
652 ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib3.md3", 5, TRUE);
656 // particles on every hit
657 pointparticles(particleeffectnum("sparks"), hitloc, force * -1, 1);
661 sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE, ATTEN_NORM);
663 sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM);
666 //throw some gibs on damage
667 if(random() < damage/200+0.2)
669 ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, FALSE);
671 self.SendFlags |= GSF_STATUS;
674 // update links after a delay
675 void onslaught_generator_delayed()
677 onslaught_updatelinks();
678 // now begin normal thinking
679 generator_link(onslaught_generator_think);
681 self.SendFlags = GSF_SETUP;
684 string onslaught_generator_waypointsprite_for_team(entity e, float t)
688 if(e.team == NUM_TEAM_1)
689 return "ons-gen-red";
690 else if(e.team == NUM_TEAM_2)
691 return "ons-gen-blue";
694 return "ons-gen-shielded";
695 if(e.team == NUM_TEAM_1)
696 return "ons-gen-red";
697 else if(e.team == NUM_TEAM_2)
698 return "ons-gen-blue";
702 void onslaught_generator_updatesprite(entity e)
705 s1 = onslaught_generator_waypointsprite_for_team(e, NUM_TEAM_1);
706 s2 = onslaught_generator_waypointsprite_for_team(e, NUM_TEAM_2);
707 s3 = onslaught_generator_waypointsprite_for_team(e, -1);
708 WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
710 if(e.lastteam != e.team + 2 || e.lastshielded != e.isshielded)
712 e.lastteam = e.team + 2;
713 e.lastshielded = e.isshielded;
716 if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
717 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
719 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
723 if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
724 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE));
726 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
728 WaypointSprite_Ping(e.sprite);
732 string onslaught_controlpoint_waypointsprite_for_team(entity e, float t)
737 a = onslaught_controlpoint_attackable(e, t);
738 if(a == 3 || a == 4) // ATTACK/TOUCH THIS ONE NOW
740 if(e.team == NUM_TEAM_1)
741 return "ons-cp-atck-red";
742 else if(e.team == NUM_TEAM_2)
743 return "ons-cp-atck-blue";
745 return "ons-cp-atck-neut";
747 else if(a == -2) // DEFEND THIS ONE NOW
749 if(e.team == NUM_TEAM_1)
750 return "ons-cp-dfnd-red";
751 else if(e.team == NUM_TEAM_2)
752 return "ons-cp-dfnd-blue";
754 else if(e.team == t || a == -1 || a == 1) // own point, or fire at it
756 if(e.team == NUM_TEAM_1)
758 else if(e.team == NUM_TEAM_2)
759 return "ons-cp-blue";
761 else if(a == 2) // touch it
762 return "ons-cp-neut";
766 if(e.team == NUM_TEAM_1)
768 else if(e.team == NUM_TEAM_2)
769 return "ons-cp-blue";
771 return "ons-cp-neut";
776 void onslaught_controlpoint_updatesprite(entity e)
779 s1 = onslaught_controlpoint_waypointsprite_for_team(e, NUM_TEAM_1);
780 s2 = onslaught_controlpoint_waypointsprite_for_team(e, NUM_TEAM_2);
781 s3 = onslaught_controlpoint_waypointsprite_for_team(e, -1);
782 WaypointSprite_UpdateSprites(e.sprite, s1, s2, s3);
785 sh = !(onslaught_controlpoint_can_be_linked(e, NUM_TEAM_1) || onslaught_controlpoint_can_be_linked(e, NUM_TEAM_2));
787 if(e.lastteam != e.team + 2 || e.lastshielded != sh || e.iscaptured != e.lastcaptured)
789 if(e.iscaptured) // don't mess up build bars!
793 WaypointSprite_UpdateMaxHealth(e.sprite, 0);
797 WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health);
798 WaypointSprite_UpdateHealth(e.sprite, e.goalentity.health);
803 if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
804 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
806 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
810 if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
811 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE));
813 WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
815 WaypointSprite_Ping(e.sprite);
817 e.lastteam = e.team + 2;
819 e.lastcaptured = e.iscaptured;
823 void onslaught_generator_reset()
825 self.team = self.team_saved;
826 self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
827 self.takedamage = DAMAGE_AIM;
828 self.bot_attack = TRUE;
829 self.iscaptured = TRUE;
830 self.islinked = TRUE;
831 self.isshielded = TRUE;
832 self.enemy.solid = SOLID_NOT;
833 self.think = onslaught_generator_delayed;
834 self.nextthink = time + 0.2;
835 setmodel(self, "models/onslaught/generator.md3");
836 setsize(self, GENERATOR_MIN, GENERATOR_MAX);
838 self.SendFlags |= GSF_STATUS;
842 setorigin(self, self.origin + '0 0 20');
846 WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
847 WaypointSprite_UpdateHealth(self.sprite, self.health);
850 /*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64)
853 spawnfunc_onslaught_link entities can target this.
856 "team" - team that owns this generator (5 = red, 14 = blue, etc), MUST BE SET.
857 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
859 void spawnfunc_onslaught_generator()
868 precache_model("models/onslaught/generator.md3");
869 precache_model("models/onslaught/generator_shield.md3");
870 precache_model("models/onslaught/shockwave.md3");
871 precache_model("models/onslaught/shockwavetransring.md3");
872 precache_model("models/onslaught/gen_gib1.md3");
873 precache_model("models/onslaught/gen_gib2.md3");
874 precache_model("models/onslaught/gen_gib3.md3");
875 precache_model("models/onslaught/ons_ray.md3");
876 precache_sound("onslaught/generator_decay.wav");
877 precache_sound("weapons/grenade_impact.wav");
878 precache_sound("weapons/rocket_impact.wav");
879 precache_sound("onslaught/generator_underattack.wav");
880 precache_sound("onslaught/shockwave.wav");
881 precache_sound("onslaught/ons_hit1.wav");
882 precache_sound("onslaught/ons_hit2.wav");
883 precache_sound("onslaught/electricity_explode.wav");
884 precache_sound("onslaught/generator_underattack.wav");
886 objerror("team must be set");
888 if(self.team == NUM_TEAM_1)
889 ons_red_generator = self;
891 if(self.team == NUM_TEAM_2)
892 ons_blue_generator = self;
894 self.team_saved = self.team;
895 self.colormap = 1024 + (self.team - 1) * 17;
896 self.solid = SOLID_BBOX;
897 self.movetype = MOVETYPE_NONE;
898 self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
899 setmodel(self, "models/onslaught/generator.md3");
900 setsize(self, GENERATOR_MIN, GENERATOR_MAX);
901 setorigin(self, self.origin);
902 self.takedamage = DAMAGE_AIM;
903 self.bot_attack = TRUE;
904 self.event_damage = onslaught_generator_damage;
905 self.iscaptured = TRUE;
906 self.islinked = TRUE;
907 self.isshielded = TRUE;
908 // helper entity that create fx when generator is damaged
909 onslaught_generator_damage_spawn(self);
910 // spawn shield model which indicates whether this can be damaged
911 self.enemy = spawn();
912 setattachment(self.enemy , self, "");
913 self.enemy.classname = "onslaught_generator_shield";
914 self.enemy.solid = SOLID_NOT;
915 self.enemy.movetype = MOVETYPE_NONE;
916 self.enemy.effects = EF_ADDITIVE;
917 setmodel(self.enemy, "models/onslaught/generator_shield.md3");
918 //setorigin(e, self.origin);
919 self.enemy.colormap = self.colormap;
920 self.enemy.team = self.team;
921 //self.think = onslaught_generator_delayed;
922 //self.nextthink = time + 0.2;
923 InitializeEntity(self, onslaught_generator_delayed, INITPRIO_LAST);
925 WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
926 WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY);
927 WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
928 WaypointSprite_UpdateHealth(self.sprite, self.health);
930 waypoint_spawnforitem(self);
932 onslaught_updatelinks();
934 self.reset = onslaught_generator_reset;
939 .vector cp_origin, cp_bob_origin, cp_bob_dmg;
941 float ons_notification_time_team1;
942 float ons_notification_time_team2;
944 void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
951 if (self.owner.isshielded)
953 // this is protected by a shield, so ignore the damage
954 if (time > self.pain_finished)
955 if (IS_PLAYER(attacker))
957 play2(attacker, "onslaught/damageblockedbyshield.wav");
958 self.pain_finished = time + 1;
963 if (IS_PLAYER(attacker))
966 if(self.team == NUM_TEAM_1)
968 if(time - ons_notification_time_team1 > 10)
971 ons_notification_time_team1 = time;
974 else if(self.team == NUM_TEAM_2)
976 if(time - ons_notification_time_team2 > 10)
979 ons_notification_time_team2 = time;
986 play2team(self.team, "onslaught/controlpoint_underattack.wav");
989 self.health = self.health - damage;
990 if(self.owner.iscaptured)
991 WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
993 WaypointSprite_UpdateBuildFinished(self.owner.sprite, time + (self.max_health - self.health) / (self.count / sys_frametime));
994 self.pain_finished = time + 1;
995 self.punchangle = (2 * randomvec() - '1 1 1') * 45;
996 self.cp_bob_dmg_z = (2 * random() - 1) * 15;
997 // colormod flash when shot
998 self.colormod = '2 2 2';
999 // particles on every hit
1000 pointparticles(particleeffectnum("sparks"), hitloc, force*-1, 1);
1001 //sound on every hit
1003 sound(self, CH_TRIGGER, "onslaught/ons_hit1.wav", VOL_BASE+0.3, ATTEN_NORM);
1005 sound(self, CH_TRIGGER, "onslaught/ons_hit2.wav", VOL_BASE+0.3, ATTEN_NORM);
1007 if (self.health < 0)
1009 sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
1010 pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
1013 t = Team_ColoredFullName(attacker.team);
1014 bprint(Team_ColoredFullName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
1015 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, FALSE);
1016 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
1017 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
1018 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
1019 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
1020 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
1021 ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
1023 self.owner.goalentity = world;
1024 self.owner.islinked = FALSE;
1025 self.owner.iscaptured = FALSE;
1026 self.owner.team = 0;
1027 self.owner.colormap = 1024;
1029 WaypointSprite_UpdateMaxHealth(self.owner.sprite, 0);
1031 onslaught_updatelinks();
1033 // Use targets now (somebody make sure this is in the right place..)
1041 self.owner.waslinked = self.owner.islinked;
1042 if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
1043 setmodel(self.owner, "models/onslaught/controlpoint_pad.md3");
1044 //setsize(self, '-32 -32 0', '32 32 8');
1050 void onslaught_controlpoint_icon_think()
1053 self.nextthink = time + sys_frametime;
1055 if(autocvar_g_onslaught_cp_proxydecap)
1057 float _enemy_count = 0;
1058 float _friendly_count = 0;
1062 FOR_EACH_PLAYER(_player)
1064 if(!_player.deadflag)
1066 _dist = vlen(_player.origin - self.origin);
1067 if(_dist < autocvar_g_onslaught_cp_proxydecap_distance)
1069 if(_player.team == self.team)
1077 _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * sys_frametime);
1078 _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * sys_frametime);
1080 self.health = bound(0, self.health + (_friendly_count - _enemy_count), self.max_health);
1081 if(self.health <= 0)
1083 onslaught_controlpoint_icon_damage(self, self, 1, 0, self.origin, '0 0 0');
1088 if (time > self.pain_finished + 5)
1090 if(self.health < self.max_health)
1092 self.health = self.health + self.count;
1093 if (self.health >= self.max_health)
1094 self.health = self.max_health;
1095 WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
1098 if (self.health < self.max_health * 0.25)
1099 setmodel(self, "models/onslaught/controlpoint_icon_dmg3.md3");
1100 else if (self.health < self.max_health * 0.50)
1101 setmodel(self, "models/onslaught/controlpoint_icon_dmg2.md3");
1102 else if (self.health < self.max_health * 0.75)
1103 setmodel(self, "models/onslaught/controlpoint_icon_dmg1.md3");
1104 else if (self.health < self.max_health * 0.90)
1105 setmodel(self, "models/onslaught/controlpoint_icon.md3");
1106 // colormod flash when shot
1107 self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
1109 if(self.owner.islinked != self.owner.waslinked)
1111 // unteam the spawnpoint if needed
1113 t = self.owner.team;
1114 if(!self.owner.islinked)
1115 self.owner.team = 0;
1123 self.owner.team = t;
1125 self.owner.waslinked = self.owner.islinked;
1128 if (self.punchangle_x > 0)
1130 self.punchangle_x = self.punchangle_x - 60 * sys_frametime;
1131 if (self.punchangle_x < 0)
1132 self.punchangle_x = 0;
1134 else if (self.punchangle_x < 0)
1136 self.punchangle_x = self.punchangle_x + 60 * sys_frametime;
1137 if (self.punchangle_x > 0)
1138 self.punchangle_x = 0;
1141 if (self.punchangle_y > 0)
1143 self.punchangle_y = self.punchangle_y - 60 * sys_frametime;
1144 if (self.punchangle_y < 0)
1145 self.punchangle_y = 0;
1147 else if (self.punchangle_y < 0)
1149 self.punchangle_y = self.punchangle_y + 60 * sys_frametime;
1150 if (self.punchangle_y > 0)
1151 self.punchangle_y = 0;
1154 if (self.punchangle_z > 0)
1156 self.punchangle_z = self.punchangle_z - 60 * sys_frametime;
1157 if (self.punchangle_z < 0)
1158 self.punchangle_z = 0;
1160 else if (self.punchangle_z < 0)
1162 self.punchangle_z = self.punchangle_z + 60 * sys_frametime;
1163 if (self.punchangle_z > 0)
1164 self.punchangle_z = 0;
1167 self.angles_x = self.punchangle_x;
1168 self.angles_y = self.punchangle_y + self.mangle_y;
1169 self.angles_z = self.punchangle_z;
1170 self.mangle_y = self.mangle_y + 45 * sys_frametime;
1172 self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd));
1173 self.cp_bob_spd = self.cp_bob_spd + 1.875 * sys_frametime;
1174 if(self.cp_bob_dmg_z > 0)
1175 self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * sys_frametime;
1177 self.cp_bob_dmg_z = 0;
1178 setorigin(self,self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg);
1181 if(random() < 0.6 - self.health / self.max_health)
1183 pointparticles(particleeffectnum("electricity_sparks"), self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
1186 sound(self, CH_PAIN, "onslaught/ons_spark1.wav", VOL_BASE, ATTEN_NORM);
1187 else if (random() > 0.5)
1188 sound(self, CH_PAIN, "onslaught/ons_spark2.wav", VOL_BASE, ATTEN_NORM);
1192 void onslaught_controlpoint_icon_buildthink()
1197 self.nextthink = time + sys_frametime;
1199 // only do this if there is power
1200 a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team);
1204 self.health = self.health + self.count;
1206 if (self.health >= self.max_health)
1208 self.health = self.max_health;
1209 self.count = autocvar_g_onslaught_cp_regen * sys_frametime; // slow repair rate from now on
1210 self.think = onslaught_controlpoint_icon_think;
1211 sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTEN_NORM);
1212 bprint(Team_ColoredFullName(self.team), " captured ", self.owner.message, " control point\n");
1213 self.owner.iscaptured = TRUE;
1215 WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
1216 WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
1218 onslaught_updatelinks();
1220 // Use targets now (somebody make sure this is in the right place..)
1226 self.cp_origin = self.origin;
1227 self.cp_bob_origin = '0 0 0.1';
1228 self.cp_bob_spd = 0;
1230 self.alpha = self.health / self.max_health;
1231 // colormod flash when shot
1232 self.colormod = '1 1 1' * (2 - bound(0, (self.pain_finished - time) / 10, 1));
1233 if(self.owner.model != "models/onslaught/controlpoint_pad2.md3")
1234 setmodel(self.owner, "models/onslaught/controlpoint_pad2.md3");
1235 //setsize(self, '-32 -32 0', '32 32 8');
1237 if(random() < 0.9 - self.health / self.max_health)
1238 pointparticles(particleeffectnum("rage"), self.origin + 10 * randomvec(), '0 0 -1', 1);
1244 void onslaught_controlpoint_touch()
1248 if not(IS_PLAYER(other))
1250 a = onslaught_controlpoint_attackable(self, other.team);
1251 if(a != 2 && a != 4)
1253 // we've verified that this player has a legitimate claim to this point,
1254 // so start building the captured point icon (which only captures this
1255 // point if it successfully builds without being destroyed first)
1256 self.goalentity = e = spawn();
1257 e.classname = "onslaught_controlpoint_icon";
1259 e.max_health = autocvar_g_onslaught_cp_health;
1260 e.health = autocvar_g_onslaught_cp_buildhealth;
1261 e.solid = SOLID_BBOX;
1262 e.movetype = MOVETYPE_NONE;
1263 setmodel(e, "models/onslaught/controlpoint_icon.md3");
1264 setsize(e, '-32 -32 -32', '32 32 32');
1265 setorigin(e, self.origin + '0 0 96');
1266 e.takedamage = DAMAGE_AIM;
1267 e.bot_attack = TRUE;
1268 e.event_damage = onslaught_controlpoint_icon_damage;
1269 e.team = other.team;
1270 e.colormap = 1024 + (e.team - 1) * 17;
1271 e.think = onslaught_controlpoint_icon_buildthink;
1272 e.nextthink = time + sys_frametime;
1273 e.count = (e.max_health - e.health) * sys_frametime / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
1274 sound(e, CH_TRIGGER, "onslaught/controlpoint_build.wav", VOL_BASE, ATTEN_NORM);
1276 self.colormap = e.colormap;
1277 WaypointSprite_UpdateBuildFinished(self.sprite, time + (e.max_health - e.health) / (e.count / sys_frametime));
1278 onslaught_updatelinks();
1281 void onslaught_controlpoint_reset()
1283 if(self.goalentity && self.goalentity != world)
1284 remove(self.goalentity);
1285 self.goalentity = world;
1287 self.colormap = 1024;
1288 self.iscaptured = FALSE;
1289 self.islinked = FALSE;
1290 self.isshielded = TRUE;
1291 self.enemy.solid = SOLID_NOT;
1292 self.enemy.colormap = self.colormap;
1293 self.think = self.enemy.think = func_null;
1294 self.nextthink = 0; // don't like func_null :P
1295 setmodel(self, "models/onslaught/controlpoint_pad.md3");
1296 //setsize(self, '-32 -32 0', '32 32 8');
1298 WaypointSprite_UpdateMaxHealth(self.sprite, 0);
1300 onslaught_updatelinks();
1303 SUB_UseTargets(); // to reset the structures, playerspawns etc.
1306 /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
1307 Control point. Be sure to give this enough clearance so that the shootable part has room to exist
1309 This should link to an spawnfunc_onslaught_controlpoint entity or spawnfunc_onslaught_generator entity.
1312 "targetname" - name that spawnfunc_onslaught_link entities will use to target this.
1313 "target" - target any entities that are tied to this control point, such as vehicles and buildable structure entities.
1314 "message" - name of this control point (should reflect the location in the map, such as "center bridge", "north tower", etc)
1317 void spawnfunc_onslaught_controlpoint()
1325 precache_model("models/onslaught/controlpoint_pad.md3");
1326 precache_model("models/onslaught/controlpoint_pad2.md3");
1327 precache_model("models/onslaught/controlpoint_shield.md3");
1328 precache_model("models/onslaught/controlpoint_icon.md3");
1329 precache_model("models/onslaught/controlpoint_icon_dmg1.md3");
1330 precache_model("models/onslaught/controlpoint_icon_dmg2.md3");
1331 precache_model("models/onslaught/controlpoint_icon_dmg3.md3");
1332 precache_model("models/onslaught/controlpoint_icon_gib1.md3");
1333 precache_model("models/onslaught/controlpoint_icon_gib2.md3");
1334 precache_model("models/onslaught/controlpoint_icon_gib4.md3");
1335 precache_sound("onslaught/controlpoint_build.wav");
1336 precache_sound("onslaught/controlpoint_built.wav");
1337 precache_sound("weapons/grenade_impact.wav");
1338 precache_sound("onslaught/damageblockedbyshield.wav");
1339 precache_sound("onslaught/controlpoint_underattack.wav");
1340 precache_sound("onslaught/ons_spark1.wav");
1341 precache_sound("onslaught/ons_spark2.wav");
1343 self.solid = SOLID_BBOX;
1344 self.movetype = MOVETYPE_NONE;
1345 setmodel(self, "models/onslaught/controlpoint_pad.md3");
1346 //setsize(self, '-32 -32 0', '32 32 8');
1349 setorigin(self, self.origin + '0 0 20');
1352 self.touch = onslaught_controlpoint_touch;
1354 self.colormap = 1024;
1355 self.iscaptured = FALSE;
1356 self.islinked = FALSE;
1357 self.isshielded = TRUE;
1359 // spawn shield model which indicates whether this can be damaged
1360 self.enemy = spawn();
1361 self.enemy.classname = "onslaught_controlpoint_shield";
1362 self.enemy.solid = SOLID_NOT;
1363 self.enemy.movetype = MOVETYPE_NONE;
1364 self.enemy.effects = EF_ADDITIVE;
1365 setmodel(self.enemy , "models/onslaught/controlpoint_shield.md3");
1367 setattachment(self.enemy , self, "");
1368 //setsize(e, '-32 -32 0', '32 32 128');
1370 //setorigin(e, self.origin);
1371 self.enemy.colormap = self.colormap;
1373 waypoint_spawnforitem(self);
1375 WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
1376 WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY);
1378 onslaught_updatelinks();
1380 self.reset = onslaught_controlpoint_reset;
1383 float onslaught_link_send(entity to, float sendflags)
1385 WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK);
1386 WriteByte(MSG_ENTITY, sendflags);
1389 WriteCoord(MSG_ENTITY, self.goalentity.origin_x);
1390 WriteCoord(MSG_ENTITY, self.goalentity.origin_y);
1391 WriteCoord(MSG_ENTITY, self.goalentity.origin_z);
1395 WriteCoord(MSG_ENTITY, self.enemy.origin_x);
1396 WriteCoord(MSG_ENTITY, self.enemy.origin_y);
1397 WriteCoord(MSG_ENTITY, self.enemy.origin_z);
1401 WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16
1406 void onslaught_link_checkupdate()
1408 // TODO check if the two sides have moved (currently they won't move anyway)
1409 float redpower, bluepower;
1411 redpower = bluepower = 0;
1412 if(self.goalentity.islinked)
1414 if(self.goalentity.team == NUM_TEAM_1)
1416 else if(self.goalentity.team == NUM_TEAM_2)
1419 if(self.enemy.islinked)
1421 if(self.enemy.team == NUM_TEAM_1)
1423 else if(self.enemy.team == NUM_TEAM_2)
1428 if(redpower == 1 && bluepower == 2)
1429 cc = (NUM_TEAM_1 - 1) * 0x01 + (NUM_TEAM_2 - 1) * 0x10;
1430 else if(redpower == 2 && bluepower == 1)
1431 cc = (NUM_TEAM_1 - 1) * 0x10 + (NUM_TEAM_2 - 1) * 0x01;
1433 cc = (NUM_TEAM_1 - 1) * 0x11;
1435 cc = (NUM_TEAM_2 - 1) * 0x11;
1439 //print(etos(self), " rp=", ftos(redpower), " bp=", ftos(bluepower), " ");
1440 //print("cc=", ftos(cc), "\n");
1442 if(cc != self.clientcolors)
1444 self.clientcolors = cc;
1445 self.SendFlags |= 4;
1448 self.nextthink = time;
1451 void onslaught_link_delayed()
1453 self.goalentity = find(world, targetname, self.target);
1454 self.enemy = find(world, targetname, self.target2);
1455 if (!self.goalentity)
1456 objerror("can not find target\n");
1458 objerror("can not find target2\n");
1459 dprint(etos(self.goalentity), " linked with ", etos(self.enemy), "\n");
1460 self.SendFlags |= 3;
1461 self.think = onslaught_link_checkupdate;
1462 self.nextthink = time;
1465 /*QUAKED spawnfunc_onslaught_link (0 .5 .8) (-16 -16 -16) (16 16 16)
1466 Link between control points.
1468 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.
1471 "target" - first control point.
1472 "target2" - second control point.
1474 void spawnfunc_onslaught_link()
1481 if (self.target == "" || self.target2 == "")
1482 objerror("target and target2 must be set\n");
1483 InitializeEntity(self, onslaught_link_delayed, INITPRIO_FINDTARGET);
1484 Net_LinkEntity(self, FALSE, 0, onslaught_link_send);
1487 MUTATOR_HOOKFUNCTION(ons_BuildMutatorsString)
1489 ret_string = strcat(ret_string, ":ONS");
1493 MUTATOR_HOOKFUNCTION(ons_BuildMutatorsPrettyString)
1495 ret_string = strcat(ret_string, ", Onslaught");
1499 MUTATOR_HOOKFUNCTION(ons_Spawn_Score)
1503 float _neer_home = (random() > 0.5 ? TRUE : FALSE);
1505 RandomSelection_Init();
1507 if(self.team == NUM_TEAM_1)
1508 RandomSelection_Add(ons_red_generator, 0, string_null, 1, 1);
1510 if(self.team == NUM_TEAM_2)
1511 RandomSelection_Add(ons_blue_generator, 0, string_null, 1, 1);
1513 entity _cp = findchain(classname, "onslaught_controlpoint"):
1516 if(_cp.team == self.team)
1517 RandomSelection_Add(_cp, 0, string_null, 1, 1);
1522 if(RandomSelection_chosen_ent)
1524 self.tur_head = RandomSelection_chosen_ent;
1525 spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_FOUND;
1527 else if(self.team == spawn_spot.team)
1528 spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
1535 MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
1537 if(!autocvar_g_onslaught_spawn_at_controlpoints)
1540 if(random() < 0.5) // 50/50 chane to use default spawnsystem.
1543 float _close_to_home = ((random() > 0.5) ? TRUE : FALSE);
1544 entity _best = world, _trg_gen = world;
1545 float _score, _best_score = MAX_SHOT_DISTANCE;
1547 RandomSelection_Init();
1549 if(self.team == NUM_TEAM_1)
1552 _trg_gen = ons_blue_generator;
1554 _trg_gen = ons_red_generator;
1557 if(self.team == NUM_TEAM_2)
1560 _trg_gen = ons_blue_generator;
1562 _trg_gen = ons_red_generator;
1565 entity _cp = findchain(classname, "onslaught_controlpoint");
1568 if(_cp.team == self.team)
1570 _score = vlen(_trg_gen.origin - _cp.origin);
1571 if(_score < _best_score)
1574 _best_score = _score;
1584 for(i = 0; i < 10; ++i)
1586 _loc = _best.origin + '0 0 96';
1587 _loc += ('0 1 0' * random()) * 128;
1588 tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
1589 if(trace_fraction == 1.0 && !trace_startsolid)
1591 setorigin(self, _loc);
1592 self.angles = normalize(_loc - _best.origin) * RAD2DEG;
1599 if(!autocvar_g_onslaught_spawn_at_generator)
1602 _trg_gen = ((self.team == NUM_TEAM_1) ? ons_red_generator : ons_blue_generator);
1604 for(i = 0; i < 10; ++i)
1606 _loc = _trg_gen.origin + '0 0 96';
1607 _loc += ('0 1 0' * random()) * 128;
1608 tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
1609 if(trace_fraction == 1.0 && !trace_startsolid)
1611 setorigin(self, _loc);
1612 self.angles = normalize(_loc - _trg_gen.origin) * RAD2DEG;
1621 MUTATOR_HOOKFUNCTION(ons_MonsterThink)
1623 entity e = find(world, targetname, self.target);
1627 self.SendFlags |= MSF_STATUS; // update team
1632 MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
1634 entity e, ee = world;
1638 e = find(world,target,self.targetname);
1642 self.SendFlags |= MSF_STATUS;
1656 MUTATOR_DEFINITION(gamemode_onslaught)
1658 MUTATOR_HOOK(BuildMutatorsPrettyString, ons_BuildMutatorsPrettyString, CBC_ORDER_ANY);
1659 MUTATOR_HOOK(BuildMutatorsString, ons_BuildMutatorsString, CBC_ORDER_ANY);
1660 MUTATOR_HOOK(PlayerSpawn, ons_PlayerSpawn, CBC_ORDER_ANY);
1661 MUTATOR_HOOK(MonsterMove, ons_MonsterThink, CBC_ORDER_ANY);
1662 MUTATOR_HOOK(MonsterSpawn, ons_MonsterSpawn, CBC_ORDER_ANY);
1663 //MUTATOR_HOOK(Spawn_Score, ons_Spawn_Score, CBC_ORDER_ANY);
1667 if(time > 1) // game loads at time 1
1668 error("This is a game type and it cannot be added at runtime.");
1673 print("This is a game type and it cannot be removed at runtime.");