1 /* --- CheckNavNode ---
\r
2 Evaluates travel cost and wether to continue search or not in this direction*/
\r
4 float(entity from, entity to, float lflag) CheckNavNode =
\r
7 local vector foundpoint;
\r
12 if (!(lflag & LF_NOWALK))
\r
13 if (!(lflag & LF_NOLINK))
\r
15 if (from.sflags & S_TELEPORT) // teleporter exception
\r
16 foundpoint = from.origin;
\r
18 foundpoint = ClampPointToSpace(from.pointl, from, to);
\r
19 addcost = vlen(from.pointl - foundpoint);
\r
20 addcost = addcost + from.costl;
\r
21 if (addcost <= search_distance)
\r
22 if (to.costl > addcost)
\r
27 to.pointl = foundpoint;
\r
33 /* --- MarkRoute ---
\r
34 Searches as far as possible, and gives all navnodes a travel cost and shortest
\r
35 travel point, which is then used for goal evaluation
\r
37 Starts by clearing all navnodes, and searches breadth first from the starting navnode*/
\r
39 void(float sdist) MarkRoute =
\r
41 local entity t, start;
\r
42 local float searching;
\r
44 start = FindCurrentNavNode(self.origin, self.mins, self.maxs);
\r
49 search_distance = sdist;
\r
63 start.pointl = self.origin;
\r
76 if (CheckNavNode(t, t.link0, t.lflags0))
\r
77 if (CheckNavNode(t, t.link1, t.lflags1))
\r
78 if (CheckNavNode(t, t.link2, t.lflags2))
\r
79 if (CheckNavNode(t, t.link3, t.lflags3))
\r
80 if (CheckNavNode(t, t.link4, t.lflags4))
\r
81 if (CheckNavNode(t, t.link5, t.lflags5))
\r
82 if (CheckNavNode(t, t.link6, t.lflags6))
\r
83 if (CheckNavNode(t, t.link7, t.lflags7))
\r
84 if (CheckNavNode(t, t.link8, t.lflags8))
\r
85 if (CheckNavNode(t, t.link9, t.lflags9))
\r
86 if (CheckNavNode(t, t.link10, t.lflags10))
\r
87 if (CheckNavNode(t, t.link11, t.lflags11))
\r
88 if (CheckNavNode(t, t.link12, t.lflags12))
\r
89 if (CheckNavNode(t, t.link13, t.lflags13))
\r
90 if (CheckNavNode(t, t.link14, t.lflags14))
\r
91 if (CheckNavNode(t, t.link15, t.lflags15))
\r
92 if (CheckNavNode(t, t.link16, t.lflags16))
\r
93 if (CheckNavNode(t, t.link17, t.lflags17))
\r
94 if (CheckNavNode(t, t.link18, t.lflags18))
\r
95 CheckNavNode(t, t.link19, t.lflags19);
\r