]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Diable fancy pathing for walker by default. Simply move from target to target now...
authorJakob MG <jakob_mg@hotmail.com>
Wed, 22 Jun 2011 14:36:20 +0000 (16:36 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Wed, 22 Jun 2011 14:36:20 +0000 (16:36 +0200)
qcsrc/server/tturrets/units/unit_checkpoint.qc
qcsrc/server/tturrets/units/unit_walker.qc

index 8a581ea39995a28d02fb5a30671317c5bf718d1f..481b4a285d4d3f5816ab37d01cd24db31652d364 100644 (file)
@@ -33,6 +33,15 @@ void turret_checkpoint_use()
 {
 }
 
+#if 0
+void turret_checkpoint_think()
+{
+    if(self.enemy)
+        te_lightning1(self,self.origin, self.enemy.origin);
+    
+    self.nextthink = time + 0.25;
+}
+#endif
 /*QUAKED turret_checkpoint (1 0 1) (-32 -32 -32) (32 32 32)
 -----------KEYS------------
 target: .targetname of next waypoint in chain.
@@ -42,24 +51,28 @@ wait:   Pause at this point # seconds.
 If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly.
 If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached.
 */
+//float tc_acum;
 void turret_checkpoint_init()
 {
-    traceline(self.origin, self.origin - '0 0 1024', MOVE_WORLDONLY, self);
-    setorigin(self,trace_endpos + '0 0 8');
+    traceline(self.origin + '0 0 16', self.origin - '0 0 1024', MOVE_WORLDONLY, self);
+    setorigin(self, trace_endpos + '0 0 32');
 
     if(self.target != "")
     {
-        self.enemy = find(world,targetname,self.target);
+        self.enemy = find(world, targetname, self.target);
         if(self.enemy == world)
             dprint("A turret_checkpoint faild to find its target!\n");
     }
+    //self.think = turret_checkpoint_think;
+    //self.nextthink = time + tc_acum + 0.25;
+    //tc_acum += 0.25;
 }
 
 void spawnfunc_turret_checkpoint()
 {
     setorigin(self,self.origin);
     self.think = turret_checkpoint_init;
-    self.nextthink = time + 0.1;
+    self.nextthink = time + 0.2;    
 }
 
 // Compat.
index 143884c119571dce473f4999dd15b0d90f16eadd..a6e5204808901bb43733a797817cba48b0d89b2e 100644 (file)
@@ -259,8 +259,11 @@ void walker_move_to(vector _target, float _dist)
     }
 }
 
+//#define WALKER_FANCYPATHING
+
 void walker_move_path()
 {
+#ifdef WALKER_FANCYPATHING
     // 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)
@@ -290,6 +293,17 @@ void walker_move_path()
     self.steerto = steerlib_attract2(self.moveto,0.5,500,0.95);
     walker_move_to(self.moveto, 0);
 
+#else
+    if (vlen(self.origin - self.pathcurrent.origin) < 64)    
+        self.pathcurrent = self.pathcurrent.enemy;
+    
+    if(!self.pathcurrent)
+        return;
+    
+    self.moveto = self.pathcurrent.origin;
+    self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
+    walker_move_to(self.moveto, 0);
+#endif
 }
 
 .float idletime;
@@ -550,8 +564,10 @@ void walker_respawnhook()
 
 void walker_diehook()
 {
+#ifdef self.pathcurrent
     if (self.pathcurrent)
         pathlib_deletepath(self.pathcurrent.owner);
+#endif
 
     self.pathcurrent = world;
 }
@@ -608,7 +624,7 @@ void turret_walker_dinit()
 
     if (self.target != "")
     {
-        e = find(world,targetname,self.target);
+        e = find(world, targetname, self.target);
         if (!e)
         {
             dprint("Initital waypoint for walker does NOT exsist, fix your map!\n");
@@ -619,8 +635,12 @@ void turret_walker_dinit()
             dprint("Warning: not a turrret path\n");
         else
         {
-            self.pathcurrent = WALKER_PATH(self.origin,e.origin);
+#ifdef WALKER_FANCYPATHING
+            self.pathcurrent = WALKER_PATH(self.origin, e.origin);
             self.pathgoal = e;
+#else
+            self.pathcurrent = e;
+#endif
         }
     }
 }