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;
71 te_lightning1(self,self.origin, self.pos1);
75 self.nextthink = time + 0.2;
78 vector pathlib_walknode(vector start,vector end,float doedge)
80 vector direction,point,last_point,s,e;
81 float steps, distance, i;
83 dprint("Walking node from ", vtos(start), " to ", vtos(end), "\n");
85 pathlib_movenode_goodnode = 0;
87 end_x = fsnap(end_x,pathlib_gridsize);
88 end_y = fsnap(end_y,pathlib_gridsize);
89 start_x = fsnap(start_x,pathlib_gridsize);
90 start_y = fsnap(start_y,pathlib_gridsize);
93 traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
94 if(trace_fraction == 1.0)
100 setorigin(a,start + movenode_stepup);
101 a.pos1 = trace_endpos;
102 //start - movenode_maxdrop
105 dprint("I cant walk on air!\n");
109 start = trace_endpos;
111 // Find the direcion, without Z
114 direction = normalize(e - s);
116 distance = vlen(start - end);
117 steps = rint(distance / movenode_stepsize);
120 for(i = 1; i < steps; ++i)
122 point = last_point + (direction * movenode_stepsize);
123 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
124 if(trace_fraction == 1.0)
127 last_point = trace_endpos;
130 point = last_point + (direction * movenode_stepsize);
131 point_x = fsnap(point_x,pathlib_gridsize);
132 point_y = fsnap(point_y,pathlib_gridsize);
134 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
135 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
137 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
138 if(trace_fraction == 1.0)
141 last_point = trace_endpos;
143 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
144 if(trace_fraction != 1.0)
147 pathlib_movenode_goodnode = 1;