- local entity proj;
-
- turret_tag_fire_update();
-
- sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", VOL_BASE, ATTN_NORM);
- proj = spawn ();
- setorigin(proj, self.tur_shotorg);
- setsize(proj, '0 0 0', '0 0 0');
- proj.classname = "flac_projectile";
- proj.owner = self;
- proj.bot_dodge = TRUE;
- proj.bot_dodgerating = self.shot_dmg;
- proj.solid = SOLID_BBOX;
- proj.movetype = MOVETYPE_FLYMISSILE;
- proj.flags = FL_PROJECTILE;
- proj.takedamage = DAMAGE_NO;
- proj.velocity = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
- proj.angles = vectoangles(proj.velocity);
- proj.touch = turret_flac_projectile_explode;
- proj.think = turret_flac_projectile_explode;
- proj.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 3) / self.shot_speed);
- proj.enemy = self.enemy;
- proj.cnt = time + 5;
-
- CSQCProjectile(proj, TRUE, PROJECTILE_HAGAR, TRUE);
-
- self.tur_head.frame = self.tur_head.frame + 1;
- if (self.tur_head.frame >= 4) self.tur_head.frame = 0;
-
+ if(self.enemy != world)
+ if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
+ setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
+
+#ifdef TURRET_DEBUG
+ float d;
+ d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+ self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
+ self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
+#else
+ RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, self.owner.shot_force, self.totalfrags, world);
+#endif
+ remove(self);