]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/turrets/turret/fusionreactor.qc
Merge branch 'master' into terencehill/min_spec_time
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / fusionreactor.qc
index 163bffb9d70ebd8988f9f595b75b622c450bd605..32ac81d586cc7ecc9035d7accddf5aada188bbdb 100644 (file)
@@ -1,32 +1,25 @@
 #include "fusionreactor.qh"
 
-#ifdef IMPLEMENTATION
 #ifdef SVQC
 bool turret_fusionreactor_firecheck(entity this)
 {
-    if (this.attack_finished_single[0] > time)
-        return false;
-
-    if (IS_DEAD(this.enemy))
-        return false;
-
-    if (this.enemy == NULL)
-        return false;
-
-    if (this.ammo < this.shot_dmg)
-        return false;
-
-    if (this.enemy.ammo >= this.enemy.ammo_max)
-        return false;
-
-    if(vdist(this.enemy.origin - this.origin, >, this.target_range))
-        return false;
-
-    if(this.team != this.enemy.team)
-        return false;
-
-    if(!(this.enemy.ammo_flags & TFL_AMMO_ENERGY))
-        return false;
+    entity targ = this.enemy;
+
+    switch(MUTATOR_CALLHOOK(FusionReactor_ValidTarget, this, targ))
+    {
+        case MUT_FUSREAC_TARG_VALID: { return true; }
+        case MUT_FUSREAC_TARG_INVALID: { return false; }
+    }
+
+    if((this.attack_finished_single[0] > time)
+    || (!targ)
+    || (IS_DEAD(targ))
+    || (this.ammo < this.shot_dmg)
+    || (targ.ammo >= targ.ammo_max)
+    || (vdist(targ.origin - this.origin, >, this.target_range))
+    || (this.team != targ.team)
+    || (!(targ.ammo_flags & TFL_AMMO_ENERGY))
+    ) { return false; }
 
     return true;
 }
@@ -59,4 +52,3 @@ METHOD(FusionReactor, tr_setup, void(FusionReactor this, entity it))
 }
 
 #endif
-#endif