1 vector pathlib_wateroutnode(vector start,vector end)
5 pathlib_movenode_goodnode = 0;
7 end_x = fsnap(end_x, pathlib_gridsize);
8 end_y = fsnap(end_y, pathlib_gridsize);
10 traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
13 if not(pointcontents(end - '0 0 1') == CONTENT_SOLID)
16 for(surface = start ; surface_z < (end_z + 32); ++surface_z)
18 if(pointcontents(surface) == CONTENT_EMPTY)
22 if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
25 tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, self);
26 if(trace_fraction == 1)
27 pathlib_movenode_goodnode = 1;
29 if(fabs(surface_z - end_z) > 32)
30 pathlib_movenode_goodnode = 0;
35 vector pathlib_swimnode(vector start,vector end)
37 pathlib_movenode_goodnode = 0;
39 if(pointcontents(start) != CONTENT_WATER)
42 end_x = fsnap(end_x, pathlib_gridsize);
43 end_y = fsnap(end_y, pathlib_gridsize);
45 if(pointcontents(end) == CONTENT_EMPTY)
46 return pathlib_wateroutnode( start, end);
48 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
49 if(trace_fraction == 1)
50 pathlib_movenode_goodnode = 1;
55 vector pathlib_flynode(vector start,vector end)
57 pathlib_movenode_goodnode = 0;
59 end_x = fsnap(end_x, pathlib_gridsize);
60 end_y = fsnap(end_y, pathlib_gridsize);
62 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
63 if(trace_fraction == 1)
64 pathlib_movenode_goodnode = 1;
69 vector pathlib_walknode(vector start,vector end,float doedge)
71 vector direction,point,last_point,s,e;
72 float steps, distance, i;
74 pathlib_movenode_goodnode = 0;
76 end_x = fsnap(end_x,pathlib_gridsize);
77 end_y = fsnap(end_y,pathlib_gridsize);
78 start_x = fsnap(start_x,pathlib_gridsize);
79 start_y = fsnap(start_y,pathlib_gridsize);
82 traceline(start + movenode_stepup, start - movenode_maxdrop,MOVE_WORLDONLY,self);
83 if(trace_fraction == 1.0)
88 // Find the direcion, without Z
91 direction = normalize(e - s);
93 distance = vlen(start - end);
94 steps = rint(distance / movenode_stepsize);
97 for(i = 1; i < steps; ++i)
99 point = last_point + (direction * movenode_stepsize);
100 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
101 if(trace_fraction == 1.0)
104 last_point = trace_endpos;
107 point = last_point + (direction * movenode_stepsize);
108 point_x = fsnap(point_x,pathlib_gridsize);
109 point_y = fsnap(point_y,pathlib_gridsize);
111 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
112 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
114 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
115 if(trace_fraction == 1.0)
118 last_point = trace_endpos;
120 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
121 if(trace_fraction != 1.0)
124 pathlib_movenode_goodnode = 1;