d = d + 1;
e = e.chain;
}
-
+
if(autocvar_g_campaign && autocvar__campaign_testrun)
d = d * self.max_health;
else
d = d * self.max_health / max(30, 60 * autocvar_timelimit_suddendeath);
-
+
Damage(self, self, self, d, DEATH_HURTTRIGGER, self.origin, '0 0 0');
}
else if (overtime_msg_time)
vector org;
float i;
- if not (self.count)
+ if (!self.count)
self.count = 40;
// White shockwave
#endif
self.lasthealth = self.health;
}
- else if not(warmup_stage)
+ else if (!warmup_stage)
{
if (attacker == self)
bprint(Team_ColoredFullName(self.team), " generator spontaneously exploded due to overtime!\n");
precache_sound("onslaught/electricity_explode.wav");
if (!self.team)
objerror("team must be set");
-
+
if(self.team == NUM_TEAM_1)
ons_red_generator = self;
if(self.team == NUM_TEAM_2)
ons_blue_generator = self;
-
+
self.team_saved = self.team;
self.colormap = 1024 + (self.team - 1) * 17;
self.solid = SOLID_BBOX;
waypoint_spawnforitem(self);
onslaught_updatelinks();
-
+
self.reset = onslaught_generator_reset;
}
float _friendly_count = 0;
float _dist;
entity _player;
-
+
FOR_EACH_PLAYER(_player)
{
if(!_player.deadflag)
a = onslaught_controlpoint_can_be_linked(self.owner, self.owner.team);
if(!a)
return;
-
+
self.health = self.health + self.count;
if (self.health >= self.max_health)
{
entity e;
float a;
- if not(IS_PLAYER(other))
+ if (!IS_PLAYER(other))
return;
a = onslaught_controlpoint_attackable(self, other.team);
if(a != 2 && a != 4)
onslaught_updatelinks();
}
+void onslaught_controlpoint_think()
+{
+ self.nextthink = time;
+ CSQCMODEL_AUTOUPDATE();
+}
+
void onslaught_controlpoint_reset()
{
if(self.goalentity && self.goalentity != world)
self.isshielded = TRUE;
self.enemy.solid = SOLID_NOT;
self.enemy.colormap = self.colormap;
- self.think = self.enemy.think = func_null;
- self.nextthink = 0; // don't like func_null :P
+ self.think = onslaught_controlpoint_think;
+ self.enemy.think = func_null;
+ self.nextthink = time; // don't like func_null :P
setmodel(self, "models/onslaught/controlpoint_pad.md3");
//setsize(self, '-32 -32 0', '32 32 8');
activator = self;
SUB_UseTargets(); // to reset the structures, playerspawns etc.
+
+ CSQCMODEL_AUTOUPDATE();
}
/*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
self.enemy.colormap = self.colormap;
waypoint_spawnforitem(self);
+
+ self.think = onslaught_controlpoint_think;
+ self.nextthink = time;
WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY);
onslaught_updatelinks();
self.reset = onslaught_controlpoint_reset;
+
+ CSQCMODEL_AUTOINIT();
}
float onslaught_link_send(entity to, float sendflags)
MUTATOR_HOOKFUNCTION(ons_Spawn_Score)
{
-
+
/*
float _neer_home = (random() > 0.5 ? TRUE : FALSE);
-
+
RandomSelection_Init();
-
+
if(self.team == NUM_TEAM_1)
RandomSelection_Add(ons_red_generator, 0, string_null, 1, 1);
-
+
if(self.team == NUM_TEAM_2)
RandomSelection_Add(ons_blue_generator, 0, string_null, 1, 1);
-
+
entity _cp = findchain(classname, "onslaught_controlpoint"):
while _cp;
{
- if(_cp.team == self.team)
+ if(_cp.team == self.team)
RandomSelection_Add(_cp, 0, string_null, 1, 1);
-
+
_cp = _cp.chain;
}
}
else if(self.team == spawn_spot.team)
spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
-
+
*/
-
+
return 0;
}
{
if(!autocvar_g_onslaught_spawn_at_controlpoints)
return 0;
-
+
if(random() < 0.5) // 50/50 chane to use default spawnsystem.
return 0;
-
+
float _close_to_home = ((random() > 0.5) ? TRUE : FALSE);
entity _best = world, _trg_gen = world;
float _score, _best_score = MAX_SHOT_DISTANCE;
-
+
RandomSelection_Init();
-
+
if(self.team == NUM_TEAM_1)
{
if(!_close_to_home)
_trg_gen = ons_blue_generator;
- else
- _trg_gen = ons_red_generator;
+ else
+ _trg_gen = ons_red_generator;
}
-
+
if(self.team == NUM_TEAM_2)
{
if(_close_to_home)
_trg_gen = ons_blue_generator;
- else
- _trg_gen = ons_red_generator;
+ else
+ _trg_gen = ons_red_generator;
}
-
+
entity _cp = findchain(classname, "onslaught_controlpoint");
while(_cp)
{
- if(_cp.team == self.team)
- {
+ if(_cp.team == self.team)
+ {
_score = vlen(_trg_gen.origin - _cp.origin);
if(_score < _best_score)
{
_best = _cp;
- _best_score = _score;
+ _best_score = _score;
}
- }
+ }
_cp = _cp.chain;
}
-
- vector _loc;
- float i;
+
+ vector _loc;
+ float i;
if(_best)
{
for(i = 0; i < 10; ++i)
{
_loc = _best.origin + '0 0 96';
- _loc += ('0 1 0' * random()) * 128;
+ _loc += ('0 1 0' * random()) * 128;
tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
if(trace_fraction == 1.0 && !trace_startsolid)
{
{
if(!autocvar_g_onslaught_spawn_at_generator)
return 0;
-
+
_trg_gen = ((self.team == NUM_TEAM_1) ? ons_red_generator : ons_blue_generator);
-
+
for(i = 0; i < 10; ++i)
{
_loc = _trg_gen.origin + '0 0 96';
- _loc += ('0 1 0' * random()) * 128;
+ _loc += ('0 1 0' * random()) * 128;
tracebox(_loc, PL_MIN, PL_MAX, _loc, MOVE_NORMAL, self);
if(trace_fraction == 1.0 && !trace_startsolid)
{
}
}
}
-
+
return 0;
}
if(self.targetname)
{
e = find(world, target, self.targetname);
+
if(e != world)
{
self.team = e.team;
activator = ee;
self.use();
}
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(ons_MonsterThink)
+{
+ entity e = find(world, targetname, self.target);
+ if (e != world)
+ self.team = e.team;
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
+{
+ entity e, ee = world;
+ if(self.targetname)
+ {
+ e = find(world,target,self.targetname);
+ activator = ee;
+ self.use();
+ }
+
return FALSE;
}
MUTATOR_HOOK(BuildMutatorsString, ons_BuildMutatorsString, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, ons_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(TurretSpawn, ons_TurretSpawn, CBC_ORDER_ANY);
+ MUTATOR_HOOK(MonsterMove, ons_MonsterThink, CBC_ORDER_ANY);
+ MUTATOR_HOOK(MonsterSpawn, ons_MonsterSpawn, CBC_ORDER_ANY);
//MUTATOR_HOOK(Spawn_Score, ons_Spawn_Score, CBC_ORDER_ANY);
MUTATOR_ONADD