4 vector pathlib_wateroutnode(vector start,vector end, float doedge)
8 pathlib_movenode_goodnode = 0;
10 end.x = fsnap(end.x, pathlib_gridsize);
11 end.y = fsnap(end.y, pathlib_gridsize);
13 traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
16 if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
19 for(surface = start ; surface.z < (end.z + 32); ++surface.z)
21 if(pointcontents(surface) == CONTENT_EMPTY)
25 if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
28 tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, self);
29 if(trace_fraction == 1)
30 pathlib_movenode_goodnode = 1;
32 if(fabs(surface.z - end.z) > 32)
33 pathlib_movenode_goodnode = 0;
38 vector pathlib_swimnode(vector start,vector end, float doedge)
40 pathlib_movenode_goodnode = 0;
42 if(pointcontents(start) != CONTENT_WATER)
45 end.x = fsnap(end.x, pathlib_gridsize);
46 end.y = fsnap(end.y, pathlib_gridsize);
48 if(pointcontents(end) == CONTENT_EMPTY)
49 return pathlib_wateroutnode( start, end, doedge);
51 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
52 if(trace_fraction == 1)
53 pathlib_movenode_goodnode = 1;
58 vector pathlib_flynode(vector start,vector end, float doedge)
60 pathlib_movenode_goodnode = 0;
62 end.x = fsnap(end.x, pathlib_gridsize);
63 end.y = fsnap(end.y, pathlib_gridsize);
65 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
66 if(trace_fraction == 1)
67 pathlib_movenode_goodnode = 1;
74 te_lightning1(self,self.origin, self.pos1);
78 self.nextthink = time + 0.2;
81 vector pathlib_walknode(vector start,vector end,float doedge)
83 vector direction,point,last_point,s,e;
84 float steps, distance, i;
86 LOG_TRACE("Walking node from ", vtos(start), " to ", vtos(end), "\n");
88 pathlib_movenode_goodnode = 0;
90 end.x = fsnap(end.x,pathlib_gridsize);
91 end.y = fsnap(end.y,pathlib_gridsize);
92 start.x = fsnap(start.x,pathlib_gridsize);
93 start.y = fsnap(start.y,pathlib_gridsize);
96 traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
97 if(trace_fraction == 1.0)
103 setorigin(a,start + movenode_stepup);
104 a.pos1 = trace_endpos;
105 //start - movenode_maxdrop
108 LOG_TRACE("I cant walk on air!\n");
112 start = trace_endpos;
114 // Find the direcion, without Z
117 direction = normalize(e - s);
119 distance = vlen(start - end);
120 steps = rint(distance / movenode_stepsize);
123 for(i = 1; i < steps; ++i)
125 point = last_point + (direction * movenode_stepsize);
126 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
127 if(trace_fraction == 1.0)
130 last_point = trace_endpos;
133 point = last_point + (direction * movenode_stepsize);
134 point.x = fsnap(point.x,pathlib_gridsize);
135 point.y = fsnap(point.y,pathlib_gridsize);
137 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
138 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
140 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
141 if(trace_fraction == 1.0)
144 last_point = trace_endpos;
146 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
147 if(trace_fraction != 1.0)
150 pathlib_movenode_goodnode = 1;