]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/tturrets/units/unit_ewheel.qc
Merge remote-tracking branch 'origin/master' into samual/mutator_ctf
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_ewheel.qc
index fb5007c5799f7270b7ca1b84761956b1a9406665..31b984e391767845be993b5faecb3bc4779f1ae5 100644 (file)
@@ -4,51 +4,19 @@
 #define ewheel_amin_bck_slow 3
 #define ewheel_amin_bck_fast 4
 
-void turret_ewheel_projectile_explode()
-{
-#ifdef TURRET_DEBUG
-    float d;
-
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET_EWHEEL, 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.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, world, self.owner.shot_force, DEATH_TURRET_EWHEEL, world);
-#endif
-
-    remove (self);
-}
-
-
 void ewheel_attack()
 {
-    entity proj;
     float i;
-
+    entity _mis;
+    
     for (i = 0; i < 1; ++i)
     {
         turret_do_updates(self);
 
-        sound (self, CHAN_WEAPON, "weapons/lasergun_fire.wav", VOL_BASE, ATTN_NORM);
-        pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
+        _mis = turret_projectile("weapons/lasergun_fire.wav", 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_LASER, TRUE, TRUE); 
+        _mis.missile_flags = MIF_SPLASH;
 
-        proj                    = spawn ();
-        setorigin(proj, self.tur_shotorg);
-        proj.classname       = "ewheel bolt";
-        proj.owner           = self;
-        proj.bot_dodge       = FALSE;
-        proj.bot_dodgerating = self.shot_dmg;
-        proj.think           = turret_ewheel_projectile_explode;
-        proj.nextthink       = time + 9;
-        //proj.solid           = SOLID_TRIGGER;
-        proj.movetype        = MOVETYPE_FLYMISSILE;
-        proj.velocity        = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
-        proj.touch           = turret_ewheel_projectile_explode;
-        proj.enemy           = self.enemy;
-        proj.flags           = FL_PROJECTILE | FL_NOTARGET;
-        PROJECTILE_MAKETRIGGER(proj);
-
-        CSQCProjectile(proj, TRUE, PROJECTILE_LASER, TRUE);
+        pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
 
         self.tur_head.frame += 2;
 
@@ -57,10 +25,10 @@ void ewheel_attack()
     }
 
 }
-
+//#define EWHEEL_FANCYPATH
 void ewheel_move_path()
 {
-
+#ifdef EWHEEL_FANCYPATH
     // Are we close enougth to a path node to switch to the next?
     if (vlen(self.origin  - self.pathcurrent.origin) < 64)
         if (self.pathcurrent.path_next == world)
@@ -86,7 +54,10 @@ void ewheel_move_path()
         else
             self.pathcurrent = self.pathcurrent.path_next;
 
-
+#else
+    if (vlen(self.origin - self.pathcurrent.origin) < 64)    
+        self.pathcurrent = self.pathcurrent.enemy;
+#endif
 
     if (self.pathcurrent)
     {
@@ -95,8 +66,6 @@ void ewheel_move_path()
         self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
 
         movelib_move_simple(v_forward, autocvar_g_turrets_unit_ewheel_speed_fast, 0.4);
-
-        return;
     }
 }
 
@@ -141,12 +110,14 @@ void  ewheel_move_enemy()
         movelib_beak_simple(autocvar_g_turrets_unit_ewheel_speed_stop);
     }
     
-    if(self.frame != newframe)
+    turrets_setframe(newframe , FALSE);
+    
+    /*if(self.frame != newframe)
     {
         self.frame = newframe;
         self.SendFlags |= TNSF_ANIM;
         self.anim_start_time = time;
-    }
+    }*/
 }
 
 
@@ -224,8 +195,13 @@ void ewheel_respawnhook()
             dprint("Warning: not a turrret path\n");
         else
         {
+
+#ifdef EWHEEL_FANCYPATH
             self.pathcurrent = WALKER_PATH(self.origin,e.origin);
             self.pathgoal = e;
+#else
+            self.pathcurrent  = e;
+#endif
         }
     }
 }
@@ -234,9 +210,10 @@ void ewheel_diehook()
 {
     self.velocity = '0 0 0';
 
+#ifdef EWHEEL_FANCYPATH
     if (self.pathcurrent)
         pathlib_deletepath(self.pathcurrent.owner);
-
+#endif
     self.pathcurrent = world;
 }
 
@@ -273,21 +250,20 @@ void turret_ewheel_dinit()
         remove(self);
         return;
     }
-
+    
+    self.frame = 1;
     self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
     self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-
-    self.damage_flags          |= TFL_DMG_DEATH_NOGIBS;
-
     self.iscreature = TRUE;
+    self.teleportable = TELEPORT_NORMAL;
+    self.damagedbycontents = TRUE;
     self.movetype   = MOVETYPE_WALK;
     self.solid      = SOLID_SLIDEBOX;
     self.takedamage = DAMAGE_AIM;
+    self.idle_aim   = '0 0 0';
+    self.pos1       = self.origin;
 
     setsize(self, '-32 -32 0', '32 32 48');
-    self.idle_aim = '0 0 0';
-
-    self.pos1 = self.origin;
 
     // Our fire routine
     self.turret_firefunc  = ewheel_attack;
@@ -312,8 +288,12 @@ void turret_ewheel_dinit()
             dprint("Warning: not a turrret path\n");
         else
         {
+#ifdef EWHEEL_FANCYPATH
             self.pathcurrent = WALKER_PATH(self.origin, e.origin);
             self.pathgoal = e;
+#else
+            self.pathcurrent = e;
+#endif
         }
     }
 }