Someone forgot to reset self after assigning it for a function call.
[divverent/nexuiz.git] / data / qcsrc / server / gamec / urrebot_load.c
1 /* --- UrreBotSetup ---\r
2 Issues a random funky name, random colors, playermodel and team to the bot*/\r
3 \r
4 void() UrreBotSetup =\r
5 {\r
6         local float r, shirt, pants;\r
7         local string s;\r
8 \r
9         r = random()*18;\r
10         if (r <= 1)\r
11                 s = "GrooveMachine";\r
12         else if (r <= 2)\r
13                 s = "Worm";\r
14         else if (r <= 3)\r
15                 s = "ClownLock";\r
16         else if (r <= 4)\r
17                 s = "DiscO";\r
18         else if (r <= 5)\r
19                 s = "FunkyFresh";\r
20         else if (r <= 6)\r
21                 s = "DanceWithMe";\r
22         else if (r <= 7)\r
23                 s = "BodyJiggle";\r
24         else if (r <= 8)\r
25                 s = "CantSwim";\r
26         else if (r <= 9)\r
27                 s = "AtomicDog";\r
28         else if (r <= 10)\r
29                 s = "Follower";\r
30         else if (r <= 11)\r
31                 s = "BrassMonkey";\r
32         else if (r <= 12)\r
33                 s = "SirNose";\r
34         else if (r <= 13)\r
35                 s = "StarChild";\r
36         else if (r <= 14)\r
37                 s = "GeorgeC";\r
38         else if (r <= 15)\r
39                 s = "Bootsy";\r
40         else if (r <= 16)\r
41                 s = "Flashlight";\r
42         else if (r <= 17)\r
43                 s = "Bodysnatcher";\r
44         else\r
45                 s = "Boogieboy";\r
46 \r
47         self.netname = s;\r
48 \r
49         r = random()*15;\r
50         if (r <= 1)\r
51         {\r
52                 self.playermodel = "models/player/carni.zym";\r
53                 if (random() < 0.5)\r
54                         self.playerskin = "0";\r
55                 else\r
56                         self.playerskin = "1";\r
57         }\r
58         else if (r <= 2)\r
59         {\r
60                 self.playermodel = "models/player/crash.zym";\r
61                 self.playerskin = "0";\r
62         }\r
63         else if (r <= 3)\r
64         {\r
65                 self.playermodel = "models/player/grunt.zym";\r
66                 self.playerskin = "0";\r
67         }\r
68         else if (r <= 4)\r
69         {\r
70                 self.playermodel = "models/player/headhunter.zym";\r
71                 self.playerskin = "0";\r
72         }\r
73         else if (r <= 5)\r
74         {\r
75                 self.playermodel = "models/player/insurrectionist.zym";\r
76                 self.playerskin = "0";\r
77         }\r
78         else if (r <= 6)\r
79         {\r
80                 self.playermodel = "models/player/jeandarc.zym";\r
81                 self.playerskin = "0";\r
82         }\r
83         else if (r <= 7)\r
84         {\r
85                 self.playermodel = "models/player/lurk.zym";\r
86                 if (random() < 0.5)\r
87                         self.playerskin = "0";\r
88                 else\r
89                         self.playerskin = "1";\r
90         }\r
91         else if (r <= 8)\r
92         {\r
93                 self.playermodel = "models/player/lycanthrope.zym";\r
94                 self.playerskin = "0";\r
95         }\r
96         else if (r <= 9)\r
97         {\r
98                 self.playermodel = "models/player/marine.zym";\r
99                 self.playerskin = "0";\r
100         }\r
101         else if (r <= 10)\r
102         {\r
103                 self.playermodel = "models/player/nexus.zym";\r
104                 if (random() < 0.5)\r
105                         self.playerskin = "0";\r
106                 else\r
107                         self.playerskin = "1";\r
108         }\r
109         else if (r <= 11)\r
110         {\r
111                 self.playermodel = "models/player/pyria.zym";\r
112                 self.playerskin = "0";\r
113         }\r
114         else if (r <= 12)\r
115         {\r
116                 self.playermodel = "models/player/shock.zym";\r
117                 self.playerskin = "0";\r
118         }\r
119         else if (r <= 13)\r
120         {\r
121                 self.playermodel = "models/player/skadi.zym";\r
122                 self.playerskin = "0";\r
123         }\r
124         else if (r <= 14)\r
125         {\r
126                 self.playermodel = "models/player/specop.zym";\r
127                 self.playerskin = "0";\r
128         }\r
129         else\r
130         {\r
131                 self.playermodel = "models/player/visitant.zym";\r
132                 self.playerskin = "0";\r
133         }\r
134 \r
135         if (teamplay)\r
136                 JoinBestTeam(self, 0);\r
137         else\r
138         {\r
139                 shirt = floor(random()*15);\r
140                 pants = floor(random()*15);\r
141                 self.clientcolors = pants + shirt * 16;\r
142         }\r
143 };\r
144 \r
145 /* --- UrreBotAdd ---\r
146 Adds an UrreBot to the server*/\r
147 \r
148 entity(float bottype) UrreBotAdd =\r
149 {\r
150         local float shirt, pants;\r
151         local entity ent, ret;\r
152 \r
153         ent = self;\r
154         self = spawnclient();\r
155         if (!self)\r
156         {\r
157                 bprint("Can not add UrreBot, server full\n");\r
158                 if (bottype == BOT_TYPE_URREBOT)\r
159                         cvar_set("urrebots", ftos(urrebots));\r
160                 else\r
161                         cvar_set("bot_number", ftos(bot_number));\r
162                 self = ent;\r
163                 return world;\r
164         }\r
165         // UrreBotSetup();\r
166         // Requested by Vermeulen\r
167         self.netname = PickARandomName();\r
168         if (teamplay)\r
169                 JoinBestTeam(self, 0);\r
170         else\r
171         {\r
172                 shirt = floor(random()*15);\r
173                 pants = floor(random()*15);\r
174                 self.clientcolors = pants + shirt * 16;\r
175         }\r
176         self.list = urrebot_chain;\r
177         urrebot_chain = self;\r
178         ClientConnect();\r
179         PutClientInServer();\r
180         ret = self;\r
181         self = ent;\r
182 \r
183         strategytoken = urrebot_chain;\r
184 \r
185         return ret;\r
186 };\r
187 \r
188 /* --- UrreBotRemove ---\r
189 removes an UrreBot from the server*/\r
190 \r
191 void() UrreBotRemove =\r
192 {\r
193         local entity ent, t, oldself;\r
194 \r
195         ent = findchainflags(flags, FL_CLIENT);\r
196         while (ent)\r
197         {\r
198                 if (clienttype(ent) == CLIENTTYPE_BOT)\r
199                 {\r
200                         if (ent.bot_type == BOT_TYPE_URREBOT)\r
201                         {\r
202                                 if (urrebot_chain == ent)\r
203                                         urrebot_chain = ent.list;\r
204                                 else\r
205                                 {\r
206                                         t = find(world, classname, "player");\r
207                                         while(t)\r
208                                         {\r
209                                                 if (t.list == ent)\r
210                                                         t.list = ent.list;\r
211                                                 t = find(t, classname, "player");\r
212                                         }\r
213                                 }\r
214                                 if (urrebots > 0)\r
215                                         urrebots -= 1;\r
216                                 oldself = self;\r
217                                 self = ent;\r
218                                 ClientDisconnect();\r
219                                 dropclient(ent);\r
220                                 self = oldself;\r
221                         }\r
222                 }\r
223                 ent = ent.chain;\r
224         }\r
225 };\r
226 \r
227 /* --- SpawnNavNode ---\r
228 The one to guess what this does gets free bacon from FrikaC*/\r
229 \r
230 entity(vector org, vector nnmins, vector nnmaxs) SpawnNavNode =\r
231 {\r
232         newmis = spawn();\r
233         setsize(newmis, nnmins, nnmaxs);\r
234         newmis.classname = "navnode";\r
235         setorigin(newmis, org);\r
236         return newmis;\r
237 };\r
238 \r
239 /* --- AddPlane ---\r
240 Adds a plane to the plane list of a navnode*/\r
241 \r
242 void(entity navn, vector normal, float dist) AddPlane =\r
243 {\r
244         local float f;\r
245 \r
246         newmis = spawn();\r
247         newmis.classname = "plane";\r
248         newmis.list = navn.plane_chain;\r
249         navn.plane_chain = newmis;\r
250         newmis.mangle = normal*-1;\r
251         newmis.delay = dist;\r
252         f = (navn.origin * newmis.mangle) - ((navn.origin + (newmis.delay * newmis.mangle)) * newmis.mangle);\r
253         if (f > 0)\r
254         {\r
255                 newmis.mangle = newmis.mangle*-1;\r
256                 newmis.delay = newmis.delay*-1;\r
257         }\r
258 };\r
259 \r
260 /* --- SpawnOptPoint ---\r
261 This function spawns waypoints for the most used paths between navnodes as an\r
262 optimisation*/\r
263 \r
264 void(entity navn, entity l1, entity l2) SpawnOptPoint =\r
265 {\r
266         local float upd;\r
267         local vector point;\r
268         local entity oldself;\r
269         local entity l, upd_pt;\r
270 \r
271         newmis = spawn();\r
272         setsize (newmis, PL_MIN, PL_MAX);\r
273         oldself = self;\r
274         self = newmis;\r
275         point = ClampPointToSpace(ClampPointToSpace(l2.origin, l2, navn), l1, navn);\r
276         self = oldself;\r
277         upd = FALSE;\r
278         l = navn.optp_chain;\r
279         while (l)\r
280         {\r
281                 if (point == l.origin)\r
282                 {\r
283                         upd = TRUE;\r
284                         upd_pt = l;\r
285                         l = world;\r
286                 }\r
287                 else\r
288                         l = l.list;\r
289         }\r
290 \r
291         if (upd)\r
292         {\r
293                 if (upd_pt.link0 != l1)\r
294                 if (upd_pt.link1 != l1)\r
295                 if (upd_pt.link2 != l1)\r
296                 if (upd_pt.link3 != l1)\r
297                 if (upd_pt.link4 != l1)\r
298                 if (upd_pt.link5 != l1)\r
299                 if (upd_pt.link6 != l1)\r
300                 if (upd_pt.link7 != l1)\r
301                 if (upd_pt.link8 != l1)\r
302                 if (upd_pt.link9 != l1)\r
303                 {\r
304                         if (!upd_pt.link0)\r
305                                 upd_pt.link0 = l1;\r
306                         else if (!upd_pt.link1)\r
307                                 upd_pt.link1 = l1;\r
308                         else if (!upd_pt.link2)\r
309                                 upd_pt.link2 = l1;\r
310                         else if (!upd_pt.link3)\r
311                                 upd_pt.link3 = l1;\r
312                         else if (!upd_pt.link4)\r
313                                 upd_pt.link4 = l1;\r
314                         else if (!upd_pt.link5)\r
315                                 upd_pt.link5 = l1;\r
316                         else if (!upd_pt.link6)\r
317                                 upd_pt.link6 = l1;\r
318                         else if (!upd_pt.link7)\r
319                                 upd_pt.link7 = l1;\r
320                         else if (!upd_pt.link8)\r
321                                 upd_pt.link8 = l1;\r
322                         else if (!upd_pt.link9)\r
323                                 upd_pt.link9 = l1;\r
324                 }\r
325                 upd = FALSE;\r
326                 if (upd_pt.link10 != l2)\r
327                 if (upd_pt.link11 != l2)\r
328                 if (upd_pt.link12 != l2)\r
329                 if (upd_pt.link13 != l2)\r
330                 if (upd_pt.link14 != l2)\r
331                 if (upd_pt.link15 != l2)\r
332                 if (upd_pt.link16 != l2)\r
333                 if (upd_pt.link17 != l2)\r
334                 if (upd_pt.link18 != l2)\r
335                 if (upd_pt.link19 != l2)\r
336                 {\r
337                         if (!upd_pt.link10)\r
338                         {\r
339                                 upd_pt.link10 = l2;\r
340                                 upd = TRUE;\r
341                         }\r
342                         else if (!upd_pt.link11)\r
343                         {\r
344                                 upd_pt.link11 = l2;\r
345                                 upd = TRUE;\r
346                         }\r
347                         else if (!upd_pt.link12)\r
348                         {\r
349                                 upd_pt.link12 = l2;\r
350                                 upd = TRUE;\r
351                         }\r
352                         else if (!upd_pt.link13)\r
353                         {\r
354                                 upd_pt.link13 = l2;\r
355                                 upd = TRUE;\r
356                         }\r
357                         else if (!upd_pt.link14)\r
358                         {\r
359                                 upd_pt.link14 = l2;\r
360                                 upd = TRUE;\r
361                         }\r
362                         else if (!upd_pt.link15)\r
363                         {\r
364                                 upd_pt.link15 = l2;\r
365                                 upd = TRUE;\r
366                         }\r
367                         else if (!upd_pt.link16)\r
368                         {\r
369                                 upd_pt.link16 = l2;\r
370                                 upd = TRUE;\r
371                         }\r
372                         else if (!upd_pt.link17)\r
373                         {\r
374                                 upd_pt.link17 = l2;\r
375                                 upd = TRUE;\r
376                         }\r
377                         else if (!upd_pt.link18)\r
378                         {\r
379                                 upd_pt.link18 = l2;\r
380                                 upd = TRUE;\r
381                         }\r
382                         else if (!upd_pt.link19)\r
383                         {\r
384                                 upd_pt.link19 = l2;\r
385                                 upd = TRUE;\r
386                         }\r
387                 }\r
388         }\r
389 \r
390         if (!upd)\r
391         {\r
392                 newmis.classname = "optpoint";\r
393                 newmis.list = navn.optp_chain;\r
394                 navn.optp_chain = newmis;\r
395                 setorigin(newmis, point);\r
396                 newmis.link0 = l1;\r
397                 newmis.link10 = l2;\r
398         }\r
399         else\r
400                 remove(newmis);\r
401 };\r
402 \r
403 void() OptimiseNavigation =\r
404 {\r
405         local entity navn, l;\r
406 \r
407         navn = navnode_chain;\r
408         while (navn)\r
409         {\r
410                 l = navn.optp_chain;\r
411                 while (l)\r
412                 {\r
413                         l.think = SUB_Remove;\r
414                         l.nextthink = time;\r
415                         SpawnOptPoint(navn, l.enemy, navn);\r
416                         if (navn.link0 != l.enemy)\r
417                         if (!(navn.lflags0 & LF_NOWALK))\r
418                         if (!(navn.lflags0 & LF_NOLINK))\r
419                                 SpawnOptPoint(navn, l.enemy, navn.link0);\r
420                         if (navn.link1)\r
421                         {\r
422                                 if (navn.link1 != l.enemy)\r
423                                 if (!(navn.lflags1 & LF_NOWALK))\r
424                                 if (!(navn.lflags1 & LF_NOLINK))\r
425                                         SpawnOptPoint(navn, l.enemy, navn.link1);\r
426                                 if (navn.link2)\r
427                                 {\r
428                                         if (navn.link2 != l.enemy)\r
429                                         if (!(navn.lflags2 & LF_NOWALK))\r
430                                         if (!(navn.lflags2 & LF_NOLINK))\r
431                                                 SpawnOptPoint(navn, l.enemy, navn.link2);\r
432                                         if (navn.link3)\r
433                                         {\r
434                                                 if (navn.link3 != l.enemy)\r
435                                                 if (!(navn.lflags3 & LF_NOWALK))\r
436                                                 if (!(navn.lflags3 & LF_NOLINK))\r
437                                                         SpawnOptPoint(navn, l.enemy, navn.link3);\r
438                                                 if (navn.link4)\r
439                                                 {\r
440                                                         if (navn.link4 != l.enemy)\r
441                                                         if (!(navn.lflags4 & LF_NOWALK))\r
442                                                         if (!(navn.lflags4 & LF_NOLINK))\r
443                                                                 SpawnOptPoint(navn, l.enemy, navn.link4);\r
444                                                         if (navn.link5)\r
445                                                         {\r
446                                                                 if (navn.link5 != l.enemy)\r
447                                                                 if (!(navn.lflags5 & LF_NOWALK))\r
448                                                                 if (!(navn.lflags5 & LF_NOLINK))\r
449                                                                         SpawnOptPoint(navn, l.enemy, navn.link5);\r
450                                                                 if (navn.link6)\r
451                                                                 {\r
452                                                                         if (navn.link6 != l.enemy)\r
453                                                                         if (!(navn.lflags6 & LF_NOWALK))\r
454                                                                         if (!(navn.lflags6 & LF_NOLINK))\r
455                                                                                 SpawnOptPoint(navn, l.enemy, navn.link6);\r
456                                                                         if (navn.link7)\r
457                                                                         {\r
458                                                                                 if (navn.link7 != l.enemy)\r
459                                                                                 if (!(navn.lflags7 & LF_NOWALK))\r
460                                                                                 if (!(navn.lflags7 & LF_NOLINK))\r
461                                                                                         SpawnOptPoint(navn, l.enemy, navn.link7);\r
462                                                                                 if (navn.link8)\r
463                                                                                 {\r
464                                                                                         if (navn.link8 != l.enemy)\r
465                                                                                         if (!(navn.lflags8 & LF_NOWALK))\r
466                                                                                         if (!(navn.lflags8 & LF_NOLINK))\r
467                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link8);\r
468                                                                                         if (navn.link9)\r
469                                                                                         {\r
470                                                                                                 if (navn.link9 != l.enemy)\r
471                                                                                                 if (!(navn.lflags9 & LF_NOWALK))\r
472                                                                                                 if (!(navn.lflags9 & LF_NOLINK))\r
473                                                                                                         SpawnOptPoint(navn, l.enemy, navn.link9);\r
474                                                                                                 if (navn.link10)\r
475                                                                                                 {\r
476                                                                                                         if (navn.link10 != l.enemy)\r
477                                                                                                         if (!(navn.lflags10 & LF_NOWALK))\r
478                                                                                                         if (!(navn.lflags10 & LF_NOLINK))\r
479                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link10);\r
480                                                                                                         if (navn.link11)\r
481                                                                                                         {\r
482                                                                                                                 if (navn.link11 != l.enemy)\r
483                                                                                                                 if (!(navn.lflags11 & LF_NOWALK))\r
484                                                                                                                 if (!(navn.lflags11 & LF_NOLINK))\r
485                                                                                                                         SpawnOptPoint(navn, l.enemy, navn.link11);\r
486                                                                                                                 if (navn.link12)\r
487                                                                                                                 {\r
488                                                                                                                         if (navn.link12 != l.enemy)\r
489                                                                                                                         if (!(navn.lflags12 & LF_NOWALK))\r
490                                                                                                                         if (!(navn.lflags12 & LF_NOLINK))\r
491                                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link12);\r
492                                                                                                                         if (navn.link13)\r
493                                                                                                                         {\r
494                                                                                                                                 if (navn.link13 != l.enemy)\r
495                                                                                                                                 if (!(navn.lflags13 & LF_NOWALK))\r
496                                                                                                                                 if (!(navn.lflags13 & LF_NOLINK))\r
497                                                                                                                                         SpawnOptPoint(navn, l.enemy, navn.link13);\r
498                                                                                                                                 if (navn.link14)\r
499                                                                                                                                 {\r
500                                                                                                                                         if (navn.link14 != l.enemy)\r
501                                                                                                                                         if (!(navn.lflags14 & LF_NOWALK))\r
502                                                                                                                                         if (!(navn.lflags14 & LF_NOLINK))\r
503                                                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link14);\r
504                                                                                                                                         if (navn.link15)\r
505                                                                                                                                         {\r
506                                                                                                                                                 if (navn.link15 != l.enemy)\r
507                                                                                                                                                 if (!(navn.lflags15 & LF_NOWALK))\r
508                                                                                                                                                 if (!(navn.lflags15 & LF_NOLINK))\r
509                                                                                                                                                         SpawnOptPoint(navn, l.enemy, navn.link15);\r
510                                                                                                                                                 if (navn.link16)\r
511                                                                                                                                                 {\r
512                                                                                                                                                         if (navn.link16 != l.enemy)\r
513                                                                                                                                                         if (!(navn.lflags16 & LF_NOWALK))\r
514                                                                                                                                                         if (!(navn.lflags16 & LF_NOLINK))\r
515                                                                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link16);\r
516                                                                                                                                                         if (navn.link17)\r
517                                                                                                                                                         {\r
518                                                                                                                                                                 if (navn.link17 != l.enemy)\r
519                                                                                                                                                                 if (!(navn.lflags17 & LF_NOWALK))\r
520                                                                                                                                                                 if (!(navn.lflags17 & LF_NOLINK))\r
521                                                                                                                                                                         SpawnOptPoint(navn, l.enemy, navn.link17);\r
522                                                                                                                                                                 if (navn.link18)\r
523                                                                                                                                                                 {\r
524                                                                                                                                                                         if (navn.link18 != l.enemy)\r
525                                                                                                                                                                         if (!(navn.lflags18 & LF_NOWALK))\r
526                                                                                                                                                                         if (!(navn.lflags18 & LF_NOLINK))\r
527                                                                                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link18);\r
528                                                                                                                                                                         if (navn.link19)\r
529                                                                                                                                                                         if (navn.link19 != l.enemy)\r
530                                                                                                                                                                         if (!(navn.lflags19 & LF_NOWALK))\r
531                                                                                                                                                                         if (!(navn.lflags19 & LF_NOLINK))\r
532                                                                                                                                                                                 SpawnOptPoint(navn, l.enemy, navn.link19);\r
533                                                                                                                                                                 }\r
534                                                                                                                                                         }\r
535                                                                                                                                                 }\r
536                                                                                                                                         }\r
537                                                                                                                                 }\r
538                                                                                                                         }\r
539                                                                                                                 }\r
540                                                                                                         }\r
541                                                                                                 }\r
542                                                                                         }\r
543                                                                                 }\r
544                                                                         }\r
545                                                                 }\r
546                                                         }\r
547                                                 }\r
548                                         }\r
549                                 }\r
550                         }\r
551                         l = l.list;\r
552                 }\r
553                 navn = navn.list;\r
554         }\r
555 };\r
556 \r
557 void(entity navn, entity linked) SpawnOptController =\r
558 {\r
559         newmis = spawn();\r
560         newmis.classname = "optcontroller";\r
561         newmis.list = navn.optp_chain;\r
562         navn.optp_chain = newmis;\r
563         newmis.enemy = linked;\r
564 };\r
565 \r
566 /* --- LinkNavNodes ---\r
567 Links the navnodes and gives some special attributes (like doors, teleporters)*/\r
568 \r
569 void() LinkNavNodes =\r
570 {\r
571         local entity e, t, tdest;\r
572 \r
573         navnode_chain = world;\r
574         navnodes = 0;\r
575 \r
576         e = findchain(classname, "navnode");\r
577         while (e)\r
578         {\r
579                 e.list = navnode_chain;\r
580                 navnode_chain = e;\r
581                 e.delay = navnodes;\r
582                 navnodes = navnodes + 1;\r
583                 e = e.chain;\r
584         }\r
585 \r
586         e = navnode_chain;\r
587         while (e)\r
588         {\r
589                 if (e.link0)\r
590                 {\r
591                         e.link0.think = SUB_Remove;\r
592                         e.link0.nextthink = time;\r
593                         t = navnode_chain;\r
594                         while (t)\r
595                         {\r
596                                 if (t.delay == e.link0.delay)\r
597                                         e.link0 = t;\r
598                                 t = t.list;\r
599                         }\r
600                         e.lflags0 = e.lflags0 | LF_REMOTE;\r
601                 }\r
602                 if (e.link1)\r
603                 {\r
604                         e.link1.think = SUB_Remove;\r
605                         e.link1.nextthink = time;\r
606                         t = navnode_chain;\r
607                         while (t)\r
608                         {\r
609                                 if (t.delay == e.link1.delay)\r
610                                         e.link1 = t;\r
611                                 t = t.list;\r
612                         }\r
613                         e.lflags1 = e.lflags1 | LF_REMOTE;\r
614                 }\r
615                 if (e.link2)\r
616                 {\r
617                         e.link2.think = SUB_Remove;\r
618                         e.link2.nextthink = time;\r
619                         t = navnode_chain;\r
620                         while (t)\r
621                         {\r
622                                 if (t.delay == e.link2.delay)\r
623                                         e.link2 = t;\r
624                                 t = t.list;\r
625                         }\r
626                         e.lflags2 = e.lflags2 | LF_REMOTE;\r
627                 }\r
628                 if (e.link3)\r
629                 {\r
630                         e.link3.think = SUB_Remove;\r
631                         e.link3.nextthink = time;\r
632                         t = navnode_chain;\r
633                         while (t)\r
634                         {\r
635                                 if (t.delay == e.link3.delay)\r
636                                         e.link3 = t;\r
637                                 t = t.list;\r
638                         }\r
639                         e.lflags3 = e.lflags3 | LF_REMOTE;\r
640                 }\r
641                 if (e.link4)\r
642                 {\r
643                         e.link4.think = SUB_Remove;\r
644                         e.link4.nextthink = time;\r
645                         t = navnode_chain;\r
646                         while (t)\r
647                         {\r
648                                 if (t.delay == e.link4.delay)\r
649                                         e.link4 = t;\r
650                                 t = t.list;\r
651                         }\r
652                         e.lflags4 = e.lflags4 | LF_REMOTE;\r
653                 }\r
654                 if (e.link5)\r
655                 {\r
656                         e.link5.think = SUB_Remove;\r
657                         e.link5.nextthink = time;\r
658                         t = navnode_chain;\r
659                         while (t)\r
660                         {\r
661                                 if (t.delay == e.link5.delay)\r
662                                         e.link5 = t;\r
663                                 t = t.list;\r
664                         }\r
665                         e.lflags5 = e.lflags5 | LF_REMOTE;\r
666                 }\r
667                 if (e.link6)\r
668                 {\r
669                         e.link6.think = SUB_Remove;\r
670                         e.link6.nextthink = time;\r
671                         t = navnode_chain;\r
672                         while (t)\r
673                         {\r
674                                 if (t.delay == e.link6.delay)\r
675                                         e.link6 = t;\r
676                                 t = t.list;\r
677                         }\r
678                         e.lflags6 = e.lflags6 | LF_REMOTE;\r
679                 }\r
680                 if (e.link7)\r
681                 {\r
682                         e.link7.think = SUB_Remove;\r
683                         e.link7.nextthink = time;\r
684                         t = navnode_chain;\r
685                         while (t)\r
686                         {\r
687                                 if (t.delay == e.link7.delay)\r
688                                         e.link7 = t;\r
689                                 t = t.list;\r
690                         }\r
691                         e.lflags7 = e.lflags7 | LF_REMOTE;\r
692                 }\r
693                 if (e.link8)\r
694                 {\r
695                         e.link8.think = SUB_Remove;\r
696                         e.link8.nextthink = time;\r
697                         t = navnode_chain;\r
698                         while (t)\r
699                         {\r
700                                 if (t.delay == e.link8.delay)\r
701                                         e.link8 = t;\r
702                                 t = t.list;\r
703                         }\r
704                         e.lflags8 = e.lflags8 | LF_REMOTE;\r
705                 }\r
706                 if (e.link9)\r
707                 {\r
708                         e.link9.think = SUB_Remove;\r
709                         e.link9.nextthink = time;\r
710                         t = navnode_chain;\r
711                         while (t)\r
712                         {\r
713                                 if (t.delay == e.link9.delay)\r
714                                         e.link9 = t;\r
715                                 t = t.list;\r
716                         }\r
717                         e.lflags9 = e.lflags9 | LF_REMOTE;\r
718                 }\r
719                 if (e.link10)\r
720                 {\r
721                         e.link10.think = SUB_Remove;\r
722                         e.link10.nextthink = time;\r
723                         t = navnode_chain;\r
724                         while (t)\r
725                         {\r
726                                 if (t.delay == e.link10.delay)\r
727                                         e.link10 = t;\r
728                                 t = t.list;\r
729                         }\r
730                         e.lflags10 = e.lflags10 | LF_REMOTE;\r
731                 }\r
732                 if (e.link11)\r
733                 {\r
734                         e.link11.think = SUB_Remove;\r
735                         e.link11.nextthink = time;\r
736                         t = navnode_chain;\r
737                         while (t)\r
738                         {\r
739                                 if (t.delay == e.link11.delay)\r
740                                         e.link11 = t;\r
741                                 t = t.list;\r
742                         }\r
743                         e.lflags11 = e.lflags11 | LF_REMOTE;\r
744                 }\r
745                 if (e.link12)\r
746                 {\r
747                         e.link12.think = SUB_Remove;\r
748                         e.link12.nextthink = time;\r
749                         t = navnode_chain;\r
750                         while (t)\r
751                         {\r
752                                 if (t.delay == e.link12.delay)\r
753                                         e.link12 = t;\r
754                                 t = t.list;\r
755                         }\r
756                         e.lflags12 = e.lflags12 | LF_REMOTE;\r
757                 }\r
758                 if (e.link13)\r
759                 {\r
760                         e.link13.think = SUB_Remove;\r
761                         e.link13.nextthink = time;\r
762                         t = navnode_chain;\r
763                         while (t)\r
764                         {\r
765                                 if (t.delay == e.link13.delay)\r
766                                         e.link13 = t;\r
767                                 t = t.list;\r
768                         }\r
769                         e.lflags13 = e.lflags13 | LF_REMOTE;\r
770                 }\r
771                 if (e.link14)\r
772                 {\r
773                         e.link14.think = SUB_Remove;\r
774                         e.link14.nextthink = time;\r
775                         t = navnode_chain;\r
776                         while (t)\r
777                         {\r
778                                 if (t.delay == e.link14.delay)\r
779                                         e.link14 = t;\r
780                                 t = t.list;\r
781                         }\r
782                         e.lflags14 = e.lflags14 | LF_REMOTE;\r
783                 }\r
784                 if (e.link15)\r
785                 {\r
786                         e.link15.think = SUB_Remove;\r
787                         e.link15.nextthink = time;\r
788                         t = navnode_chain;\r
789                         while (t)\r
790                         {\r
791                                 if (t.delay == e.link15.delay)\r
792                                         e.link15 = t;\r
793                                 t = t.list;\r
794                         }\r
795                         e.lflags15 = e.lflags15 | LF_REMOTE;\r
796                 }\r
797                 if (e.link16)\r
798                 {\r
799                         e.link16.think = SUB_Remove;\r
800                         e.link16.nextthink = time;\r
801                         t = navnode_chain;\r
802                         while (t)\r
803                         {\r
804                                 if (t.delay == e.link16.delay)\r
805                                         e.link16 = t;\r
806                                 t = t.list;\r
807                         }\r
808                         e.lflags16 = e.lflags16 | LF_REMOTE;\r
809                 }\r
810                 if (e.link17)\r
811                 {\r
812                         e.link17.think = SUB_Remove;\r
813                         e.link17.nextthink = time;\r
814                         t = navnode_chain;\r
815                         while (t)\r
816                         {\r
817                                 if (t.delay == e.link17.delay)\r
818                                         e.link17 = t;\r
819                                 t = t.list;\r
820                         }\r
821                         e.lflags17 = e.lflags17 | LF_REMOTE;\r
822                 }\r
823                 if (e.link18)\r
824                 {\r
825                         e.link18.think = SUB_Remove;\r
826                         e.link18.nextthink = time;\r
827                         t = navnode_chain;\r
828                         while (t)\r
829                         {\r
830                                 if (t.delay == e.link18.delay)\r
831                                         e.link18 = t;\r
832                                 t = t.list;\r
833                         }\r
834                         e.lflags18 = e.lflags18 | LF_REMOTE;\r
835                 }\r
836                 if (e.link19)\r
837                 {\r
838                         e.link19.think = SUB_Remove;\r
839                         e.link19.nextthink = time;\r
840                         t = navnode_chain;\r
841                         while (t)\r
842                         {\r
843                                 if (t.delay == e.link19.delay)\r
844                                         e.link19 = t;\r
845                                 t = t.list;\r
846                         }\r
847                         e.lflags19 = e.lflags19 | LF_REMOTE;\r
848                 }\r
849                 e = e.list;\r
850         }\r
851         e = navnode_chain;\r
852         while (e)\r
853         {\r
854                 if (!(e.sflags & S_TELEPORT))\r
855                 {\r
856                         t = navnode_chain;\r
857                         while (t)\r
858                         {\r
859                                 if (boxesoverlap(e.origin + e.mins, e.origin + e.maxs, t.origin + t.mins, t.origin + t.maxs))\r
860                                 if (t != e)\r
861                                 if (t != e.link0)\r
862                                 if (t != e.link1)\r
863                                 if (t != e.link2)\r
864                                 if (t != e.link3)\r
865                                 if (t != e.link4)\r
866                                 if (t != e.link5)\r
867                                 if (t != e.link6)\r
868                                 if (t != e.link7)\r
869                                 if (t != e.link8)\r
870                                 if (t != e.link9)\r
871                                 if (t != e.link10)\r
872                                 if (t != e.link11)\r
873                                 if (t != e.link12)\r
874                                 if (t != e.link13)\r
875                                 if (t != e.link14)\r
876                                 if (t != e.link15)\r
877                                 if (t != e.link16)\r
878                                 if (t != e.link17)\r
879                                 if (t != e.link18)\r
880                                 if (t != e.link19)\r
881                                 {\r
882                                         if (!e.link0)\r
883                                                 e.link0 = t;\r
884                                         else if (!e.link1)\r
885                                                 e.link1 = t;\r
886                                         else if (!e.link2)\r
887                                                 e.link2 = t;\r
888                                         else if (!e.link3)\r
889                                                 e.link3 = t;\r
890                                         else if (!e.link4)\r
891                                                 e.link4 = t;\r
892                                         else if (!e.link5)\r
893                                                 e.link5 = t;\r
894                                         else if (!e.link6)\r
895                                                 e.link6 = t;\r
896                                         else if (!e.link7)\r
897                                                 e.link7 = t;\r
898                                         else if (!e.link8)\r
899                                                 e.link8 = t;\r
900                                         else if (!e.link9)\r
901                                                 e.link9 = t;\r
902                                         else if (!e.link10)\r
903                                                 e.link10 = t;\r
904                                         else if (!e.link11)\r
905                                                 e.link11 = t;\r
906                                         else if (!e.link12)\r
907                                                 e.link12 = t;\r
908                                         else if (!e.link13)\r
909                                                 e.link13 = t;\r
910                                         else if (!e.link14)\r
911                                                 e.link14 = t;\r
912                                         else if (!e.link15)\r
913                                                 e.link15 = t;\r
914                                         else if (!e.link16)\r
915                                                 e.link16 = t;\r
916                                         else if (!e.link17)\r
917                                                 e.link17 = t;\r
918                                         else if (!e.link18)\r
919                                                 e.link18 = t;\r
920                                         else if (!e.link19)\r
921                                                 e.link19 = t;\r
922                                         else\r
923                                                 dprint("WARNING: Too many linking NavNodes!\n");\r
924                                         if (urrebots_navopt)\r
925                                                 SpawnOptController(e, t);\r
926                                 }\r
927                                 t = t.list;\r
928                         }\r
929                 }\r
930                 e = e.list;\r
931         }\r
932         e = navnode_chain;\r
933         while (e)\r
934         {\r
935                 if (e.sflags & S_TELEPORT)\r
936                 {\r
937                         t = findchain(classname, "trigger_teleport");\r
938                         while (t)\r
939                         {\r
940                                 if (boxesoverlap(t.absmin, t.absmax, e.absmin, e.absmax))\r
941                                 {\r
942                                         tdest = find(world, targetname, t.target);\r
943                                         tdest = FindCurrentNavNode(tdest.origin, '0 0 0', '0 0 0');\r
944                                         e.link0 = tdest;\r
945                                 }\r
946                                 t = t.chain;\r
947                         }\r
948                         if (!e.link0)\r
949                                 error("Expected navnode\n");\r
950                 }\r
951                 else if (e.sflags & S_DOOR)\r
952                 {\r
953                         t = findchain(classname, "door");\r
954                         while (t)\r
955                         {\r
956                                 if (boxesoverlap(t.absmin, t.absmax, e.absmin, e.absmax))\r
957                                         e.goalentity = t;\r
958                                 t = t.chain;\r
959                         }\r
960                         if (!e.goalentity)\r
961                                 error("Expected door\n");\r
962                 }\r
963                 e = e.list;\r
964         }\r
965 };\r
966 \r
967 /* --- LoadNavNodes ---\r
968 Loads the navnodes from an .nnl file (NavNodeList) for the map*/\r
969 \r
970 void() LoadNavNodes =\r
971 {\r
972         local float f, file, length;\r
973         local float pdst;\r
974         local float sfl;\r
975         local float tfl0, tfl1, tfl2, tfl3, tfl4, tfl5, tfl6, tfl7, tfl8, tfl9;\r
976         local float tfl10, tfl11, tfl12, tfl13, tfl14, tfl15, tfl16, tfl17, tfl18, tfl19;\r
977         local string s;\r
978         local float rl0, rl1, rl2, rl3, rl4, rl5, rl6, rl7, rl8, rl9;\r
979         local float rl10, rl11, rl12, rl13, rl14, rl15, rl16, rl17, rl18, rl19;\r
980         local vector pln;\r
981         local vector wborg, wbmaxs, wbmins;\r
982         local entity e, plane_storage;\r
983 \r
984         if (navnodes)\r
985         {\r
986                 dprint("NavNodes present, map needs to be reloaded to load navnode-file\n");\r
987                 return;\r
988         }\r
989 \r
990         plane_storage = spawn();\r
991 \r
992         length = strlen(world.model);\r
993         length = length - 5;\r
994         s = substring(world.model, 5, length);\r
995         s = strcat("maps/", s, ".nnl");\r
996 \r
997         file = fopen(s, FILE_READ);\r
998 \r
999         if (file >= 0)\r
1000         {\r
1001                 dprint("Found navnode file\n");\r
1002                 s = fgets(file);\r
1003                 while (s == "navnode")\r
1004                 {\r
1005                         f = 0;\r
1006                         pdst = -1;\r
1007                         pln = nullvector;\r
1008                         wborg = wbmaxs = wbmins = nullvector;\r
1009                         plane_storage.plane_chain = world;\r
1010                         sfl = 0;\r
1011                         tfl0 = tfl1 = tfl2 = tfl3 = tfl4 = tfl5 = tfl6 = tfl7 = tfl8 = tfl9 = 0;\r
1012                         tfl10 = tfl11 = tfl12 = tfl13 = tfl14 = tfl15 = tfl16 = tfl17 = tfl18 = tfl19 = 0;\r
1013                         rl0 = rl1 = rl2 = rl3 = rl4 = rl5 = rl6 = rl7 = rl8 = rl9 = -1;\r
1014                         rl10 = rl11 = rl12 = rl13 = rl14 = rl15 = rl16 = rl17 = rl18 = rl19 = -1;\r
1015                         s = fgets(file);\r
1016                         wborg = stov(s);\r
1017                         s = fgets(file);\r
1018                         wbmins = stov(s);\r
1019                         s = fgets(file);\r
1020                         wbmaxs = stov(s);\r
1021                         s = fgets(file);\r
1022                         while (s == "plane")\r
1023                         {\r
1024                                 s = fgets(file);\r
1025                                 pln = stov(s);\r
1026                                 s = fgets(file);\r
1027                                 pdst = stof(s);\r
1028                                 AddPlane(plane_storage, pln*-1, pdst);\r
1029                                 s = fgets(file);\r
1030                         }\r
1031                         while (substring(s, 0, 6) == "remote")\r
1032                         {\r
1033                                 length = strlen(s);\r
1034                                 f = stof(substring(s, 6, length));\r
1035                                 s = fgets(file);\r
1036                                 if (!f)\r
1037                                         rl0 = stof(s);\r
1038                                 else if (f == 1)\r
1039                                         rl1 = stof(s);\r
1040                                 else if (f == 2)\r
1041                                         rl2 = stof(s);\r
1042                                 else if (f == 3)\r
1043                                         rl3 = stof(s);\r
1044                                 else if (f == 4)\r
1045                                         rl4 = stof(s);\r
1046                                 else if (f == 5)\r
1047                                         rl5 = stof(s);\r
1048                                 else if (f == 6)\r
1049                                         rl6 = stof(s);\r
1050                                 else if (f == 7)\r
1051                                         rl7 = stof(s);\r
1052                                 else if (f == 8)\r
1053                                         rl8 = stof(s);\r
1054                                 else if (f == 9)\r
1055                                         rl9 = stof(s);\r
1056                                 else if (f == 10)\r
1057                                         rl10 = stof(s);\r
1058                                 else if (f == 11)\r
1059                                         rl11 = stof(s);\r
1060                                 else if (f == 12)\r
1061                                         rl12 = stof(s);\r
1062                                 else if (f == 13)\r
1063                                         rl13 = stof(s);\r
1064                                 else if (f == 14)\r
1065                                         rl14 = stof(s);\r
1066                                 else if (f == 15)\r
1067                                         rl15 = stof(s);\r
1068                                 else if (f == 16)\r
1069                                         rl16 = stof(s);\r
1070                                 else if (f == 17)\r
1071                                         rl17 = stof(s);\r
1072                                 else if (f == 18)\r
1073                                         rl18 = stof(s);\r
1074                                 else if (f == 19)\r
1075                                         rl19 = stof(s);\r
1076                                 s = fgets(file);\r
1077                         }\r
1078                         if (s == "sflags")\r
1079                         {\r
1080                                 s = fgets(file);\r
1081                                 sfl = stof(s);\r
1082                                 s = fgets(file);\r
1083                         }\r
1084                         while (substring(s, 0, 6) == "lflags")\r
1085                         {\r
1086                                 length = strlen(s);\r
1087                                 f = stof(substring(s, 6, length));\r
1088                                 s = fgets(file);\r
1089                                 if (!f)\r
1090                                         tfl0 = stof(s);\r
1091                                 else if (f == 1)\r
1092                                         tfl1 = stof(s);\r
1093                                 else if (f == 2)\r
1094                                         tfl2 = stof(s);\r
1095                                 else if (f == 3)\r
1096                                         tfl3 = stof(s);\r
1097                                 else if (f == 4)\r
1098                                         tfl4 = stof(s);\r
1099                                 else if (f == 5)\r
1100                                         tfl5 = stof(s);\r
1101                                 else if (f == 6)\r
1102                                         tfl6 = stof(s);\r
1103                                 else if (f == 7)\r
1104                                         tfl7 = stof(s);\r
1105                                 else if (f == 8)\r
1106                                         tfl8 = stof(s);\r
1107                                 else if (f == 9)\r
1108                                         tfl9 = stof(s);\r
1109                                 else if (f == 10)\r
1110                                         tfl10 = stof(s);\r
1111                                 else if (f == 11)\r
1112                                         tfl11 = stof(s);\r
1113                                 else if (f == 12)\r
1114                                         tfl12 = stof(s);\r
1115                                 else if (f == 13)\r
1116                                         tfl13 = stof(s);\r
1117                                 else if (f == 14)\r
1118                                         tfl14 = stof(s);\r
1119                                 else if (f == 15)\r
1120                                         tfl15 = stof(s);\r
1121                                 else if (f == 16)\r
1122                                         tfl16 = stof(s);\r
1123                                 else if (f == 17)\r
1124                                         tfl17 = stof(s);\r
1125                                 else if (f == 18)\r
1126                                         tfl18 = stof(s);\r
1127                                 else if (f == 19)\r
1128                                         tfl19 = stof(s);\r
1129                                 s = fgets(file);\r
1130                         }\r
1131                         e = SpawnNavNode(wborg, wbmins, wbmaxs);\r
1132                         if (plane_storage.plane_chain)\r
1133                                 e.plane_chain = plane_storage.plane_chain;\r
1134                         e.sflags = sfl;\r
1135                         e.lflags0 = tfl0;\r
1136                         e.lflags1 = tfl1;\r
1137                         e.lflags2 = tfl2;\r
1138                         e.lflags3 = tfl3;\r
1139                         e.lflags4 = tfl4;\r
1140                         e.lflags5 = tfl5;\r
1141                         e.lflags6 = tfl6;\r
1142                         e.lflags7 = tfl7;\r
1143                         e.lflags8 = tfl8;\r
1144                         e.lflags9 = tfl9;\r
1145                         e.lflags10 = tfl10;\r
1146                         e.lflags11 = tfl11;\r
1147                         e.lflags12 = tfl12;\r
1148                         e.lflags13 = tfl13;\r
1149                         e.lflags14 = tfl14;\r
1150                         e.lflags15 = tfl15;\r
1151                         e.lflags16 = tfl16;\r
1152                         e.lflags17 = tfl17;\r
1153                         e.lflags18 = tfl18;\r
1154                         e.lflags19 = tfl19;\r
1155                         if (rl0 > -1)\r
1156                         {\r
1157                                 newmis = spawn();\r
1158                                 newmis.classname = "remotelinker";\r
1159                                 newmis.delay = rl0;\r
1160                                 e.link0 = newmis;\r
1161                         }\r
1162                         if (rl1 > -1)\r
1163                         {\r
1164                                 newmis = spawn();\r
1165                                 newmis.classname = "remotelinker";\r
1166                                 newmis.delay = rl1;\r
1167                                 e.link1 = newmis;\r
1168                         }\r
1169                         if (rl2 > -1)\r
1170                         {\r
1171                                 newmis = spawn();\r
1172                                 newmis.classname = "remotelinker";\r
1173                                 newmis.delay = rl2;\r
1174                                 e.link2 = newmis;\r
1175                         }\r
1176                         if (rl3 > -1)\r
1177                         {\r
1178                                 newmis = spawn();\r
1179                                 newmis.classname = "remotelinker";\r
1180                                 newmis.delay = rl3;\r
1181                                 e.link3 = newmis;\r
1182                         }\r
1183                         if (rl4 > -1)\r
1184                         {\r
1185                                 newmis = spawn();\r
1186                                 newmis.classname = "remotelinker";\r
1187                                 newmis.delay = rl4;\r
1188                                 e.link4 = newmis;\r
1189                         }\r
1190                         if (rl5 > -1)\r
1191                         {\r
1192                                 newmis = spawn();\r
1193                                 newmis.classname = "remotelinker";\r
1194                                 newmis.delay = rl5;\r
1195                                 e.link5 = newmis;\r
1196                         }\r
1197                         if (rl6 > -1)\r
1198                         {\r
1199                                 newmis = spawn();\r
1200                                 newmis.classname = "remotelinker";\r
1201                                 newmis.delay = rl6;\r
1202                                 e.link6 = newmis;\r
1203                         }\r
1204                         if (rl7 > -1)\r
1205                         {\r
1206                                 newmis = spawn();\r
1207                                 newmis.classname = "remotelinker";\r
1208                                 newmis.delay = rl7;\r
1209                                 e.link7 = newmis;\r
1210                         }\r
1211                         if (rl8 > -1)\r
1212                         {\r
1213                                 newmis = spawn();\r
1214                                 newmis.classname = "remotelinker";\r
1215                                 newmis.delay = rl8;\r
1216                                 e.link8 = newmis;\r
1217                         }\r
1218                         if (rl9 > -1)\r
1219                         {\r
1220                                 newmis = spawn();\r
1221                                 newmis.classname = "remotelinker";\r
1222                                 newmis.delay = rl9;\r
1223                                 e.link9 = newmis;\r
1224                         }\r
1225                         if (rl10 > -1)\r
1226                         {\r
1227                                 newmis = spawn();\r
1228                                 newmis.classname = "remotelinker";\r
1229                                 newmis.delay = rl10;\r
1230                                 e.link10 = newmis;\r
1231                         }\r
1232                         if (rl11 > -1)\r
1233                         {\r
1234                                 newmis = spawn();\r
1235                                 newmis.classname = "remotelinker";\r
1236                                 newmis.delay = rl11;\r
1237                                 e.link11 = newmis;\r
1238                         }\r
1239                         if (rl12 > -1)\r
1240                         {\r
1241                                 newmis = spawn();\r
1242                                 newmis.classname = "remotelinker";\r
1243                                 newmis.delay = rl12;\r
1244                                 e.link12 = newmis;\r
1245                         }\r
1246                         if (rl13 > -1)\r
1247                         {\r
1248                                 newmis = spawn();\r
1249                                 newmis.classname = "remotelinker";\r
1250                                 newmis.delay = rl13;\r
1251                                 e.link13 = newmis;\r
1252                         }\r
1253                         if (rl14 > -1)\r
1254                         {\r
1255                                 newmis = spawn();\r
1256                                 newmis.classname = "remotelinker";\r
1257                                 newmis.delay = rl14;\r
1258                                 e.link14 = newmis;\r
1259                         }\r
1260                         if (rl15 > -1)\r
1261                         {\r
1262                                 newmis = spawn();\r
1263                                 newmis.classname = "remotelinker";\r
1264                                 newmis.delay = rl15;\r
1265                                 e.link15 = newmis;\r
1266                         }\r
1267                         if (rl16 > -1)\r
1268                         {\r
1269                                 newmis = spawn();\r
1270                                 newmis.classname = "remotelinker";\r
1271                                 newmis.delay = rl16;\r
1272                                 e.link16 = newmis;\r
1273                         }\r
1274                         if (rl17 > -1)\r
1275                         {\r
1276                                 newmis = spawn();\r
1277                                 newmis.classname = "remotelinker";\r
1278                                 newmis.delay = rl17;\r
1279                                 e.link17 = newmis;\r
1280                         }\r
1281                         if (rl18 > -1)\r
1282                         {\r
1283                                 newmis = spawn();\r
1284                                 newmis.classname = "remotelinker";\r
1285                                 newmis.delay = rl18;\r
1286                                 e.link18 = newmis;\r
1287                         }\r
1288                         if (rl19 > -1)\r
1289                         {\r
1290                                 newmis = spawn();\r
1291                                 newmis.classname = "remotelinker";\r
1292                                 newmis.delay = rl19;\r
1293                                 e.link19 = newmis;\r
1294                         }\r
1295                 }\r
1296                 fclose(file);\r
1297         }\r
1298         else\r
1299                 dprint("No navnode file found\n");\r
1300         remove(plane_storage);\r
1301         plane_storage = world;\r
1302 };\r