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
8 local entity optpoint;
\r
13 if (!(lflag & LF_NOWALK))
\r
14 if (!(lflag & LF_NOLINK))
\r
16 if (from.sflags & S_TELEPORT) // teleporter exception
\r
17 foundpoint = from.origin;
\r
20 optpoint = MatchOptPoint(from, from.goallist, to);
\r
22 foundpoint = optpoint.origin;
\r
25 bprint("boo hoo!\n");
\r
26 foundpoint = ClampPointToSpace(from.pointl, from, to);
\r
29 addcost = vlen(from.pointl - foundpoint);
\r
30 addcost = addcost + from.costl;
\r
31 if (addcost <= search_distance)
\r
32 if (to.costl > addcost)
\r
37 to.pointl = foundpoint;
\r
43 /* --- MarkRoute ---
\r
44 Searches as far as possible, and gives all navnodes a travel cost and shortest
\r
45 travel point, which is then used for goal evaluation
\r
47 Starts by clearing all navnodes, and searches breadth first from the starting navnode*/
\r
49 void(float sdist) MarkRoute =
\r
51 local entity t, start;
\r
52 local float searching;
\r
54 start = FindCurrentNavNode(self.origin, self.mins, self.maxs);
\r
59 search_distance = sdist;
\r
73 start.pointl = self.origin;
\r
86 if (CheckNavNode(t, t.link0, t.lflags0))
\r
87 if (CheckNavNode(t, t.link1, t.lflags1))
\r
88 if (CheckNavNode(t, t.link2, t.lflags2))
\r
89 if (CheckNavNode(t, t.link3, t.lflags3))
\r
90 if (CheckNavNode(t, t.link4, t.lflags4))
\r
91 if (CheckNavNode(t, t.link5, t.lflags5))
\r
92 if (CheckNavNode(t, t.link6, t.lflags6))
\r
93 if (CheckNavNode(t, t.link7, t.lflags7))
\r
94 if (CheckNavNode(t, t.link8, t.lflags8))
\r
95 if (CheckNavNode(t, t.link9, t.lflags9))
\r
96 if (CheckNavNode(t, t.link10, t.lflags10))
\r
97 if (CheckNavNode(t, t.link11, t.lflags11))
\r
98 if (CheckNavNode(t, t.link12, t.lflags12))
\r
99 if (CheckNavNode(t, t.link13, t.lflags13))
\r
100 if (CheckNavNode(t, t.link14, t.lflags14))
\r
101 if (CheckNavNode(t, t.link15, t.lflags15))
\r
102 if (CheckNavNode(t, t.link16, t.lflags16))
\r
103 if (CheckNavNode(t, t.link17, t.lflags17))
\r
104 if (CheckNavNode(t, t.link18, t.lflags18))
\r
105 CheckNavNode(t, t.link19, t.lflags19);
\r