7 vector pathlib_wateroutnode(vector start,vector end, float doedge)
11 pathlib_movenode_goodnode = 0;
13 end.x = fsnap(end.x, pathlib_gridsize);
14 end.y = fsnap(end.y, pathlib_gridsize);
16 traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
19 if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
22 for(surface = start ; surface.z < (end.z + 32); ++surface.z)
24 if(pointcontents(surface) == CONTENT_EMPTY)
28 if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
31 tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, self);
32 if(trace_fraction == 1)
33 pathlib_movenode_goodnode = 1;
35 if(fabs(surface.z - end.z) > 32)
36 pathlib_movenode_goodnode = 0;
41 vector pathlib_swimnode(vector start,vector end, float doedge)
43 pathlib_movenode_goodnode = 0;
45 if(pointcontents(start) != CONTENT_WATER)
48 end.x = fsnap(end.x, pathlib_gridsize);
49 end.y = fsnap(end.y, pathlib_gridsize);
51 if(pointcontents(end) == CONTENT_EMPTY)
52 return pathlib_wateroutnode( start, end, doedge);
54 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
55 if(trace_fraction == 1)
56 pathlib_movenode_goodnode = 1;
61 vector pathlib_flynode(vector start,vector end, float doedge)
63 pathlib_movenode_goodnode = 0;
65 end.x = fsnap(end.x, pathlib_gridsize);
66 end.y = fsnap(end.y, pathlib_gridsize);
68 tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
69 if(trace_fraction == 1)
70 pathlib_movenode_goodnode = 1;
77 te_lightning1(self,self.origin, self.pos1);
81 self.nextthink = time + 0.2;
84 vector pathlib_walknode(vector start,vector end,float doedge)
86 vector direction,point,last_point,s,e;
87 float steps, distance, i;
89 LOG_TRACE("Walking node from ", vtos(start), " to ", vtos(end), "\n");
91 pathlib_movenode_goodnode = 0;
93 end.x = fsnap(end.x,pathlib_gridsize);
94 end.y = fsnap(end.y,pathlib_gridsize);
95 start.x = fsnap(start.x,pathlib_gridsize);
96 start.y = fsnap(start.y,pathlib_gridsize);
99 traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
100 if(trace_fraction == 1.0)
106 setorigin(a,start + movenode_stepup);
107 a.pos1 = trace_endpos;
108 //start - movenode_maxdrop
111 LOG_TRACE("I cant walk on air!\n");
115 start = trace_endpos;
117 // Find the direcion, without Z
120 direction = normalize(e - s);
122 distance = vlen(start - end);
123 steps = rint(distance / movenode_stepsize);
126 for(i = 1; i < steps; ++i)
128 point = last_point + (direction * movenode_stepsize);
129 traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
130 if(trace_fraction == 1.0)
133 last_point = trace_endpos;
136 point = last_point + (direction * movenode_stepsize);
137 point.x = fsnap(point.x,pathlib_gridsize);
138 point.y = fsnap(point.y,pathlib_gridsize);
140 //dprint("end_x: ",ftos(end_x), " end_y: ",ftos(end_y),"\n");
141 //dprint("point_x:",ftos(point_x)," point_y:",ftos(point_y),"\n\n");
143 traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
144 if(trace_fraction == 1.0)
147 last_point = trace_endpos;
149 tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
150 if(trace_fraction != 1.0)
153 pathlib_movenode_goodnode = 1;