View/Edit #9494:create_warps

Switch to edit mode.

Name(s): create_warps
1:  caller == #9494 || raise(E_PERM)
2:  targ = toobj(args[1])
3:  "We start by linking the universe together."
4:  for count in [4..this.max_sectors]
5:    $cmd_utils:suspend_if_needed(1)
6:    dest = random(this.max_Sectors - 3) + 3
7:    dest = count == dest ? random(this.max_sectors) | dest
8:    targ.sectors[count].warps = {@targ.sectors[count].warps, dest}
9:    targ.sectors[dest].warps = {@targ.sectors[dest].warps, count}
10: endfor
11: "Start with two-way links."
12: for count in [1..this.two_way_warps]
13:   $cmd_utils:suspend_if_needed(1)
14:   done = 0
15:   while (!done)
16:     $cmd_utils:suspend_if_needed(0)
17:     sector = random(this.max_sectors - 3) + 3
18:     dest = random(this.max_sectors - 3) + 3
19:     "Max amount of warps per sector is 6."
20:     done = length(targ.sectors[sector].warps) < 6 && length(targ.sectors[dest].warps) < 6
21:   endwhile
22:   targ.sectors[sector].warps = {@targ.sectors[sector].warps, dest}
23:   targ.sectors[dest].warps = {@targ.sectors[dest].warps, sector}
24: endfor
25: "Next, one way links."
26: for count in [1..this.one_way_warps]
27:   $cmd_utils:suspend_if_needed(1)
28:   done = 0
29:   while (!done)
30:     sector = random(this.max_sectors - 3) + 3
31:     dest = random(this.max_sectors - 3) + 3
32:     "Max amount of warps per sector is 6."
33:     done = length(targ.sectors[sector].warps) < 6 && length(targ.sectors[dest].warps) < 6
34:   endwhile
35:   targ.sectors[sector].warps = {@targ.sectors[sector].warps, dest}
36: endfor

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Oblivion (#7951)

You are not logged in.

[home | help | who | search | setup | code]