]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/pathlib/movenode.qc
Bots: define the API boundaries
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / pathlib / movenode.qc
index c45ac0dee4bb266fc1f36552037dffc94b625198..6645d712661d9a08e5c95be125f41073d526f783 100644 (file)
@@ -1,19 +1,24 @@
+#include "../_all.qh"
+
+#include "pathlib.qh"
+#include "utility.qh"
+
 vector pathlib_wateroutnode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
     vector surface;
 
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
     end = trace_endpos;
 
-    if not(pointcontents(end - '0 0 1') == CONTENT_SOLID)
+    if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
         return end;
 
-    for(surface = start ; surface_z < (end_z + 32); ++surface_z)
+    for(surface = start ; surface.z < (end.z + 32); ++surface.z)
     {
         if(pointcontents(surface) == CONTENT_EMPTY)
             break;
@@ -26,21 +31,21 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
-    if(fabs(surface_z - end_z) > 32)
+    if(fabs(surface.z - end.z) > 32)
         pathlib_movenode_goodnode = 0;
 
     return end;
 }
 
 vector pathlib_swimnode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
     pathlib_movenode_goodnode = 0;
 
     if(pointcontents(start) != CONTENT_WATER)
         return end;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     if(pointcontents(end) == CONTENT_EMPTY)
         return pathlib_wateroutnode( start, end, doedge);
@@ -53,11 +58,11 @@ vector pathlib_swimnode(vector start,vector end, float doedge)
 }
 
 vector pathlib_flynode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
     if(trace_fraction == 1)
@@ -67,7 +72,7 @@ vector pathlib_flynode(vector start,vector end, float doedge)
 }
 
 void a_think()
-{
+{SELFPARAM();
     te_lightning1(self,self.origin, self.pos1);
     if(self.cnt < time)
         remove(self);
@@ -76,18 +81,18 @@ void a_think()
 }
 
 vector pathlib_walknode(vector start,vector end,float doedge)
-{
+{SELFPARAM();
     vector direction,point,last_point,s,e;
     float steps, distance, i;
 
-    dprint("Walking node from ", vtos(start), " to ", vtos(end), "\n");
+    LOG_TRACE("Walking node from ", vtos(start), " to ", vtos(end), "\n");
 
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x,pathlib_gridsize);
-    end_y = fsnap(end_y,pathlib_gridsize);
-    start_x = fsnap(start_x,pathlib_gridsize);
-    start_y = fsnap(start_y,pathlib_gridsize);
+    end.x = fsnap(end.x,pathlib_gridsize);
+    end.y = fsnap(end.y,pathlib_gridsize);
+    start.x = fsnap(start.x,pathlib_gridsize);
+    start.y = fsnap(start.y,pathlib_gridsize);
 
     // Find the floor
     traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
@@ -102,7 +107,7 @@ vector pathlib_walknode(vector start,vector end,float doedge)
         //start - movenode_maxdrop
         a.cnt = time + 10;
 
-        dprint("I cant walk on air!\n");
+        LOG_TRACE("I cant walk on air!\n");
         return trace_endpos;
     }
 
@@ -128,8 +133,8 @@ vector pathlib_walknode(vector start,vector end,float doedge)
     }
 
     point = last_point + (direction * movenode_stepsize);
-    point_x = fsnap(point_x,pathlib_gridsize);
-    point_y = fsnap(point_y,pathlib_gridsize);
+    point.x = fsnap(point.x,pathlib_gridsize);
+    point.y = fsnap(point.y,pathlib_gridsize);
 
     //dprint("end_x:  ",ftos(end_x),  "  end_y:  ",ftos(end_y),"\n");
     //dprint("point_x:",ftos(point_x),"  point_y:",ftos(point_y),"\n\n");