]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/tturrets/units/unit_ewheel.qc
Merge remote-tracking branch 'origin/samual/serverlist'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_ewheel.qc
index 86f5c44021ba6f987c8333e7fa5f3d456b82f8a4..b98388984ce16a15e1d245f4c6d8bf84afac2400 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, CH_WEAPON_A, "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;
 
@@ -87,7 +55,7 @@ void ewheel_move_path()
             self.pathcurrent = self.pathcurrent.path_next;
 
 #else
-    if (vlen(self.origin - self.pathcurrent.origin) < 64)    
+    if (vlen(self.origin - self.pathcurrent.origin) < 64)
         self.pathcurrent = self.pathcurrent.enemy;
 #endif
 
@@ -105,7 +73,7 @@ void  ewheel_move_enemy()
 {
 
     float newframe;
-    
+
     self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal);
 
     //self.steerto = steerlib_standoff(self.enemy.origin,self.target_range_optimal);
@@ -141,13 +109,15 @@ void  ewheel_move_enemy()
         newframe = ewheel_amin_stop;
         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;
-    }
+    }*/
 }
 
 
@@ -194,7 +164,7 @@ void ewheel_postthink()
 
 
     self.velocity_z = vz;
-    
+
     if(vlen(self.velocity))
         self.SendFlags |= TNSF_MOVE;
 }
@@ -206,7 +176,7 @@ void ewheel_respawnhook()
     // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
     if(self.movetype != MOVETYPE_WALK)
                return;
-               
+
     self.velocity = '0 0 0';
     self.enemy = world;
 
@@ -251,7 +221,7 @@ void turret_ewheel_dinit()
 {
     entity e;
 
-    if (self.netname == "")      
+    if (self.netname == "")
         self.netname     = "eWheel Turret";
 
     if (self.target != "")
@@ -281,20 +251,19 @@ void turret_ewheel_dinit()
         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;