6 vector pathlib_wateroutnode(vector start,vector end, float doedge)
10 pathlib_movenode_goodnode = 0;
12 end.x = fsnap(end.x, pathlib_gridsize);
13 end.y = fsnap(end.y, pathlib_gridsize);
15 traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
18 if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
21 for(surface = start ; surface.z < (end.z + 32); ++surface.z)
23 if(pointcontents(surface) == CONTENT_EMPTY)
27 if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
30 tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, self);
31 if(trace_fraction == 1)
32 pathlib_movenode_goodnode = 1;
34 if(fabs(surface.z - end.z) > 32)
35 pathlib_movenode_goodnode = 0;
40 vector pathlib_swimnode(vector start,vector end, float doedge)
42 pathlib_movenode_goodnode = 0;
44 if(pointcontents(start) != CONTENT_WATER)
47 end.x = fsnap(end.x, pathlib_gridsize);
48 end.y = fsnap(end.y, pathlib_gridsize);
50 if(pointcontents(end) == CONTENT_EMPTY)
51 return pathlib_wateroutnode( start, end, doedge);
53 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
54 if(trace_fraction == 1)
55 pathlib_movenode_goodnode = 1;
60 vector pathlib_flynode(vector start,vector end, float doedge)
62 pathlib_movenode_goodnode = 0;
64 end.x = fsnap(end.x, pathlib_gridsize);
65 end.y = fsnap(end.y, pathlib_gridsize);
67 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
68 if(trace_fraction == 1)
69 pathlib_movenode_goodnode = 1;
76 te_lightning1(self,self.origin, self.pos1);
80 self.nextthink = time + 0.2;
83 vector pathlib_walknode(vector start,vector end,float doedge)
85 vector direction,point,last_point,s,e;
86 float steps, distance, i;
88 dprint("Walking node from ", vtos(start), " to ", vtos(end), "\n");
90 pathlib_movenode_goodnode = 0;
92 end.x = fsnap(end.x,pathlib_gridsize);
93 end.y = fsnap(end.y,pathlib_gridsize);
94 start.x = fsnap(start.x,pathlib_gridsize);
95 start.y = fsnap(start.y,pathlib_gridsize);
98 traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
99 if(trace_fraction == 1.0)
105 setorigin(a,start + movenode_stepup);
106 a.pos1 = trace_endpos;
107 //start - movenode_maxdrop
110 dprint("I cant walk on air!\n");
114 start = trace_endpos;
116 // Find the direcion, without Z
119 direction = normalize(e - s);
121 distance = vlen(start - end);
122 steps = rint(distance / movenode_stepsize);
125 for(i = 1; i < steps; ++i)
127 point = last_point + (direction * movenode_stepsize);
128 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
129 if(trace_fraction == 1.0)
132 last_point = trace_endpos;
135 point = last_point + (direction * movenode_stepsize);
136 point.x = fsnap(point.x,pathlib_gridsize);
137 point.y = fsnap(point.y,pathlib_gridsize);
139 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
140 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
142 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
143 if(trace_fraction == 1.0)
146 last_point = trace_endpos;
148 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
149 if(trace_fraction != 1.0)
152 pathlib_movenode_goodnode = 1;