]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Hunter-Killer: Only attack vehicles by default
authorMario <zacjardine@y7mail.com>
Sun, 9 Sep 2018 14:29:53 +0000 (00:29 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 9 Sep 2018 14:29:53 +0000 (00:29 +1000)
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret.qh
qcsrc/common/turrets/turret/hk.qc

index 11d6d9863e6160717bc3c20ae2811aa1bac666eb..d3994fd8369436f20024506b1c71ba8880e149bf 100644 (file)
@@ -688,6 +688,7 @@ void turret_track(entity this)
  + TFL_TARGETSELECT_LOS
  + TFL_TARGETSELECT_PLAYERS
  + TFL_TARGETSELECT_MISSILES
+ + TFL_TARGETSELECT_VEHICLES
  - TFL_TARGETSELECT_TRIGGERTARGET
  + TFL_TARGETSELECT_ANGLELIMITS
  + TFL_TARGETSELECT_RANGELIMITS
@@ -734,6 +735,9 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
        {
                if (e_target.vehicle_health <= 0)
                        return -6;
+
+               if ((validate_flags & TFL_TARGETSELECT_VEHICLES) && !e_target.owner)
+                       return -7;
        }
        else if (GetResourceAmount(e_target, RESOURCE_HEALTH) <= 0)
                return -6;
index 7f9b746cd379e88b8a034ddc3e95199697b236c4..aa5a50c9e67dd6d8b8e55953d55b7cde0372b3a1 100644 (file)
@@ -62,19 +62,20 @@ ENDCLASS(Turret)
 // target selection flags
 .int target_select_flags;
 .int target_validate_flags;
-const int TFL_TARGETSELECT_NO = 2; // don't automatically find targets
-const int TFL_TARGETSELECT_LOS = 4; // require line of sight to find targets
-const int TFL_TARGETSELECT_PLAYERS = 8; // target players
-const int TFL_TARGETSELECT_MISSILES = 16; // target projectiles
-const int TFL_TARGETSELECT_TRIGGERTARGET = 32; // respond to turret_trigger_target events
-const int TFL_TARGETSELECT_ANGLELIMITS = 64; // apply extra angular limits to target selection
-const int TFL_TARGETSELECT_RANGELIMITS = 128; // limit target selection range
-const int TFL_TARGETSELECT_TEAMCHECK = 256; // don't attack teammates
-const int TFL_TARGETSELECT_NOBUILTIN = 512; // only attack targets when triggered
-const int TFL_TARGETSELECT_OWNTEAM = 1024; // only attack teammates
-const int TFL_TARGETSELECT_NOTURRETS = 2048; // don't attack other turrets
-const int TFL_TARGETSELECT_FOV = 4096; // extra limits to attack range
-const int TFL_TARGETSELECT_MISSILESONLY = 8192; // only attack missiles
+const int TFL_TARGETSELECT_NO = BIT(1); // don't automatically find targets
+const int TFL_TARGETSELECT_LOS = BIT(2); // require line of sight to find targets
+const int TFL_TARGETSELECT_PLAYERS = BIT(3); // target players
+const int TFL_TARGETSELECT_MISSILES = BIT(4); // target projectiles
+const int TFL_TARGETSELECT_TRIGGERTARGET = BIT(5); // respond to turret_trigger_target events
+const int TFL_TARGETSELECT_ANGLELIMITS = BIT(6); // apply extra angular limits to target selection
+const int TFL_TARGETSELECT_RANGELIMITS = BIT(7); // limit target selection range
+const int TFL_TARGETSELECT_TEAMCHECK = BIT(8); // don't attack teammates
+const int TFL_TARGETSELECT_NOBUILTIN = BIT(9); // only attack targets when triggered
+const int TFL_TARGETSELECT_OWNTEAM = BIT(10); // only attack teammates
+const int TFL_TARGETSELECT_NOTURRETS = BIT(11); // don't attack other turrets
+const int TFL_TARGETSELECT_FOV = BIT(12); // extra limits to attack range
+const int TFL_TARGETSELECT_MISSILESONLY = BIT(13); // only attack missiles
+const int TFL_TARGETSELECT_VEHICLES = BIT(14); // target manned vehicles
 
 // aim flags
 .int aim_flags;
index 811e386f5b4e38bc85cb90f8f0ade95e0e3b3e8c..ba2e89c2c12e1d8024eeaacdd57f573e1c806c8b 100644 (file)
@@ -22,10 +22,10 @@ METHOD(HunterKiller, tr_setup, void(HunterKiller this, entity it))
 {
     it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
     it.aim_flags = TFL_AIM_SIMPLE;
-    it.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_TRIGGERTARGET | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
+    it.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_VEHICLES | TFL_TARGETSELECT_TRIGGERTARGET | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
     it.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_TEAMCHECK  | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF;
     it.shoot_flags = TFL_SHOOT_CLEARTARGET;
-    it.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_TEAMCHECK;
+    it.target_validate_flags = TFL_TARGETSELECT_VEHICLES | TFL_TARGETSELECT_TEAMCHECK;
 
     it.turret_addtarget = turret_hk_addtarget;
 }