if(e_target.alpha <= 0.3)
return -1;
- if(g_onslaught)
- if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
- return - 3;
+ if(MUTATOR_CALLHOOK(TurretValidateTarget, e_turret, e_target, validate_flags))
+ return ret_float;
if (validate_flags & TFL_TARGETSELECT_NO)
return -4;
void turret_think()
{SELFPARAM();
- entity e;
-
self.nextthink = time + self.ticrate;
- // ONS uses somewhat backwards linking.
- if (teamplay)
- {
- if (g_onslaught)
- if (self.target)
- {
- e = find(world, targetname,self.target);
- if (e != world)
- self.team = e.team;
- }
-
- if (self.team != self.tur_head.team)
- turret_respawn();
- }
+ MUTATOR_CALLHOOK(TurretThink, self);
#ifdef TURRET_DEBUG
if (self.tur_debug_tmr1 < time)
if (self.shoot_flags & TFL_SHOOT_HITALLVALID)
{
// Do a self.turret_fire for every valid target.
- e = findradius(self.origin,self.target_range);
+ entity e = findradius(self.origin,self.target_range);
while (e)
{
if(e.takedamage)
int wp_sendflags;
int wp_flag;
MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
+
+#define EV_TurretValidateTarget(i, o) \
+ /**/ i(entity, turret_this) \
+ /**/ i(entity, turret_target) \
+ /**/ i(int, turret_vflags) \
+ /**/
+entity turret_this;
+entity turret_target;
+int turret_vflags;
+MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
+
+#define EV_TurretThink(i, o) \
+ /**/ i(entity, __self) \
+ /**/
+MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
#endif
return false;
}
+MUTATOR_HOOKFUNCTION(ons, TurretValidateTarget)
+{
+ if(substring(turret_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
+ {
+ ret_float = -3;
+ return true;
+ }
+
+ return false;
+}
+
+MUTATOR_HOOKFUNCTION(ons, TurretThink)
+{
+ // ONS uses somewhat backwards linking.
+ if(self.target)
+ {
+ entity e = find(world, targetname, self.target);
+ if (e != world)
+ self.team = e.team;
+ }
+
+ if(self.team != self.tur_head.team)
+ turret_respawn();
+
+ return false;
+}
+
+
// ==========
// Spawnfuncs
// ==========