From 910abcc75e55da59dc40ecb9f3d31a6b6cb4ba27 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sun, 26 Sep 2010 13:53:44 +0300 Subject: [PATCH] Turrets: Don't shoot someone who's in the belly. Wrong for many reasons, one being that turrets would shoot team mates aiming at their prey who's from the other team. --- .../server/tturrets/system/system_main.qc | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/data/qcsrc/server/tturrets/system/system_main.qc b/data/qcsrc/server/tturrets/system/system_main.qc index 19821bc2..e7dd022a 100644 --- a/data/qcsrc/server/tturrets/system/system_main.qc +++ b/data/qcsrc/server/tturrets/system/system_main.qc @@ -464,45 +464,48 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag if not (e_target) return -2; + if(e_target.predator.classname == "player") // don't shoot someone from the belly + return -3; + if(g_onslaught) if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job! - return - 3; + return - 4; if (validate_flags & TFL_TARGETSELECT_NO) - return -4; + return -5; // If only this was used more.. if (e_target.flags & FL_NOTARGET) - return -5; + return -6; // Cant touch this if (e_target.health < 0) - return -6; + return -7; // player if (e_target.flags & FL_CLIENT) { if not (validate_flags & TFL_TARGETSELECT_PLAYERS) - return -7; + return -8; if (e_target.deadflag != DEAD_NO) - return -8; + return -9; } // enemy turrets if (validate_flags & TFL_TARGETSELECT_NOTURRETS) if (e_target.turret_firefunc || e_target.owner.tur_head == e_target) if(e_target.team != e_turret.team) // Dont break support units. - return -9; + return -10; // Missile if (e_target.flags & FL_PROJECTILE) if not (validate_flags & TFL_TARGETSELECT_MISSILES) - return -10; + return -11; if (validate_flags & TFL_TARGETSELECT_MISSILESONLY) if not (e_target.flags & FL_PROJECTILE) - return -10.5; + return -11.5; // Team check if (validate_flags & TFL_TARGETSELECT_TEAMCHECK) @@ -510,18 +513,18 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag if (validate_flags & TFL_TARGETSELECT_OWNTEAM) { if (e_target.team != e_turret.team) - return -11; + return -12; if (e_turret.team != e_target.owner.team) - return -12; + return -13; } else { if (e_target.team == e_turret.team) - return -13; + return -14; if (e_turret.team == e_target.owner.team) - return -14; + return -15; } } @@ -530,10 +533,10 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag if (validate_flags & TFL_TARGETSELECT_RANGELIMTS) { if (tvt_dist < e_turret.target_range_min) - return -15; + return -16; if (tvt_dist > e_turret.target_range) - return -16; + return -17; } // Can we even aim this thing? @@ -557,10 +560,10 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag if (validate_flags & TFL_TARGETSELECT_ANGLELIMITS) { if (fabs(tvt_tadv_x) > e_turret.aim_maxpitch) - return -17; + return -18; if (fabs(tvt_tadv_y) > e_turret.aim_maxrot) - return -18; + return -19; } // Line of sight? @@ -570,20 +573,20 @@ float turret_validate_target(entity e_turret,entity e_target,float validate_flag traceline(e_turret.tur_shotorg,v_tmp,0,e_turret); if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos)) - return -19; + return -20; } if (e_target.classname == "grabber") - return -20; + return -21; /* if (e_target.classname == "func_button") - return -21; + return -22; */ // Don't attack in RPG if this is not allowed if(cvar("g_rpg") && !cvar("g_rpg_turretattack")) - return -22; + return -23; #ifdef TURRET_DEBUG_TARGETSELECT dprint("Target:",e_target.netname," is a valid target for ",e_turret.netname,"\n"); -- 2.39.2