From: Jakob MG Date: Sat, 22 Oct 2011 09:07:38 +0000 (+0200) Subject: Make tesla coil work again X-Git-Tag: xonotic-v0.6.0~40^2~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2c21917a15a968e4a714b732d490c9bf85b3d702;p=xonotic%2Fxonotic-data.pk3dir.git Make tesla coil work again --- diff --git a/qcsrc/server/tturrets/units/unit_tessla.qc b/qcsrc/server/tturrets/units/unit_tessla.qc index 454557010..6c2cce6a7 100644 --- a/qcsrc/server/tturrets/units/unit_tessla.qc +++ b/qcsrc/server/tturrets/units/unit_tessla.qc @@ -46,24 +46,45 @@ entity toast(entity from, float range, float damage) float turret_tesla_firecheck() { - if not (turret_stdproc_firecheck()) - return 0; + // g_turrets_targetscan_maxdelay forces a target re-scan at least this often + float do_target_scan; + + if((self.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time) + do_target_scan = 1; + + // Old target (if any) invalid? + if(self.target_validate_time < time) + if (turret_validate_target(self, self.enemy, self.target_validate_flags) <= 0) + { + self.enemy = world; + self.target_validate_time = time + 0.5; + do_target_scan = 1; + } - self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK; + // But never more often then g_turrets_targetscan_mindelay! + if (self.target_select_time + autocvar_g_turrets_targetscan_mindelay > time) + do_target_scan = 0; - self.enemy = turret_select_target(); + if(do_target_scan) + { + self.enemy = turret_select_target(); + self.target_select_time = time; + } + + if not (turret_stdproc_firecheck()) + return 0; if(self.enemy) return 1; return 0; - } + void turret_tesla_fire() { - entity e,t; - float d,r,i; + entity e, t; + float d, r, i; //w_deathtypestring = "discoverd how a tesla coil works";