From: Jakob MG Date: Tue, 22 Nov 2011 11:39:21 +0000 (+0100) Subject: Fix moving turrets failing target check due to non updated tur_shotorg (use origin... X-Git-Tag: xonotic-v0.6.0~35^2~35 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e45c5ab75a12d3379d7a02be5c4f2c4ec0e4fe8a;p=xonotic%2Fxonotic-data.pk3dir.git Fix moving turrets failing target check due to non updated tur_shotorg (use origin insted). Better vehicle target check --- diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc index cc01f29d3..570310a25 100644 --- a/qcsrc/server/tturrets/system/system_main.qc +++ b/qcsrc/server/tturrets/system/system_main.qc @@ -571,7 +571,7 @@ float turret_stdproc_firecheck() float turret_validate_target(entity e_turret, entity e_target, float validate_flags) { vector v_tmp; - + //if(!validate_flags & TFL_TARGETSELECT_NOBUILTIN) // return -0.5; @@ -579,7 +579,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl return -0.5; if not(checkpvs(e_target.origin, e_turret)) - return -1; + return -1; if not (e_target) return -2; @@ -596,7 +596,12 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl return -5; // Cant touch this - if (e_target.health < 0) + if(e_target.vehicle_flags & VHF_ISVEHICLE) + { + if (e_target.vehicle_health <= 0) + return -6; + } + else if (e_target.health <= 0) return -6; // player @@ -684,7 +689,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl { v_tmp = real_origin(e_target) + ((e_target.mins + e_target.maxs) * 0.5); - traceline(e_turret.tur_shotorg, v_tmp, 0, e_turret); + traceline(e_turret.origin + '0 0 16', v_tmp, 0, e_turret); if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos)) return -19; @@ -733,7 +738,9 @@ entity turret_select_target() { if(e.takedamage) { - if (turret_validate_target(self, e, self.target_select_flags) > 0) + float f = turret_validate_target(self, e, self.target_select_flags); + //dprint("F is: ", ftos(f), "\n"); + if ( f > 0) { score = self.turret_score_target(self,e); if ((score > m_score) && (score > 0))