diff options
Diffstat (limited to 'racing/router.gd')
-rw-r--r-- | racing/router.gd | 268 |
1 files changed, 149 insertions, 119 deletions
diff --git a/racing/router.gd b/racing/router.gd index debfafb..ea3693f 100644 --- a/racing/router.gd +++ b/racing/router.gd | |||
@@ -1,135 +1,151 @@ | |||
1 | extends Node | 1 | extends Node |
2 | 2 | ||
3 | const LL1_AREAS = [ | 3 | const LL1_AREAS = [ |
4 | ["Starting Room", 0, 0, 0], | 4 | {"title": "Starting Room", "pos": [0, 0, 0]}, |
5 | ["Second Room", 0, 0, -15], | 5 | {"title": "Second Room", "pos": [0, 0, -15]}, |
6 | ["The Traveled", 34, 0, -18], | 6 | {"title": "The Traveled", "pos": [34, 0, -18]}, |
7 | ["The Agreeable", 30, 0, -45], | 7 | {"title": "The Agreeable", "pos": [30, 0, -45]}, |
8 | ["The Colorful", 10, 0, -83], | 8 | {"title": "The Colorful", "pos": [10, 0, -83]}, |
9 | ["Suits Area", 0, 0, -78, true], | 9 | {"title": "Suits Area", "pos": [0, 0, -78], "no_start": true}, |
10 | ["Arrow Garden", -93, 1, -93], | 10 | {"title": "Arrow Garden", "pos": [-93, 1, -93]}, |
11 | ["The Wondrous (Table)", -108, 1, -78], | 11 | {"title": "The Wondrous (Table)", "pos": [-108, 1, -78]}, |
12 | ["Courtyard", -64, 0, -71], | 12 | {"title": "Courtyard", "pos": [-64, 0, -71]}, |
13 | ["Yellow Backside Nine", -38, 0, -58], | 13 | {"title": "Yellow Backside Nine", "pos": [-38, 0, -58]}, |
14 | ["Hot Crusts Area", -20, 0, -81], | 14 | {"title": "Hot Crusts Area", "pos": [-20, 0, -81]}, |
15 | ["Crossroads Corner", -28, 0, -54], | 15 | {"title": "Crossroads Corner", "pos": [-28, 0, -54]}, |
16 | ["The Discerning", -54, 0, -34, true], | 16 | {"title": "The Discerning", "pos": [-54, 0, -34], "no_start": true}, |
17 | ["Green Backside", 22, 0, -94], | 17 | {"title": "Green Backside", "pos": [22, 0, -94]}, |
18 | ["Observant Upstairs", 40, 9, -92, true], | 18 | {"title": "Observant Upstairs", "pos": [40, 9, -92], "no_start": true}, |
19 | ["Eight Room", 95, 15, -28], | 19 | {"title": "Eight Room", "pos": [95, 15, -28]}, |
20 | ["The Perceptive", 60, 9, -57], | 20 | {"title": "The Perceptive", "pos": [60, 9, -57]}, |
21 | ["The Tenacious", 0, 0, -43], | 21 | {"title": "The Tenacious", "pos": [0, 0, -43]}, |
22 | ["Rainbow", -96, 0, -41], | 22 | {"title": "Rainbow", "pos": [-96, 0, -41]}, |
23 | ["The Undeterred", -87, 0, 25, true], | 23 | {"title": "The Undeterred", "pos": [-87, 0, 25], "no_start": true}, |
24 | ["Directional Gallery", -57, 0, 0], | 24 | {"title": "Directional Gallery", "pos": [-57, 0, 0]}, |
25 | ["The Eyes They See", -54, 0, -23], | 25 | {"title": "The Eyes They See", "pos": [-54, 0, -23]}, |
26 | ["Tower First Floor", -27, 0, -23], | 26 | {"title": "Tower First Floor", "pos": [-27, 0, -23], "long": true}, |
27 | ["The Optimistic", 76, 0, -17], | 27 | {"title": "The Optimistic", "pos": [76, 0, -17]}, |
28 | ["The Initiated", 63, 0, -0, true], | 28 | {"title": "The Initiated", "pos": [63, 0, -0], "no_start": true}, |
29 | ["Art Gallery", 92, 0, 15], | 29 | {"title": "Art Gallery", "pos": [92, 0, 15]}, |
30 | ["Art Gallery Top", 80, 30, 15], | 30 | {"title": "Art Gallery Top", "pos": [80, 30, 15]}, |
31 | ["Lookout", 75, 18, 51], | 31 | {"title": "Lookout", "pos": [75, 18, 51]}, |
32 | ["Knight Night Room", 37, 0, 7], | 32 | {"title": "Knight Night Room", "pos": [37, 0, 7]}, |
33 | ["The Seeker", 9, 0, 16, true], | 33 | {"title": "The Seeker", "pos": [9, 0, 16], "no_start": true}, |
34 | ["Hidden Room", 13, 0, 4], | 34 | {"title": "Hidden Room", "pos": [13, 0, 4]}, |
35 | ["Owl Hallway", 44, 0, -26], | 35 | {"title": "Owl Hallway", "pos": [44, 0, -26]}, |
36 | ["Challenge Room", -9, 6, 13], | 36 | {"title": "Challenge Room", "pos": [-9, 6, 13], "long": true}, |
37 | ["Pilgrim Room", -22, 0, 24, true], | 37 | {"title": "Pilgrim Room", "pos": [-22, 0, 24], "no_start": true, "long": true}, |
38 | ["Cellar Replica", -44, 0, 30], | 38 | {"title": "Cellar Replica", "pos": [-44, 0, 30]}, |
39 | ["Elements Area", -61, 0, 40], | 39 | {"title": "Elements Area", "pos": [-61, 0, 40]}, |
40 | ["The Artistic", -25, 0, 54, true], | 40 | {"title": "The Artistic", "pos": [-25, 0, 54], "no_start": true}, |
41 | ["Outside The Wise", -44, 0, 71], | 41 | {"title": "Outside The Wise", "pos": [-44, 0, 71]}, |
42 | ["The Wise", -72, 0, 72, true], | 42 | {"title": "The Wise", "pos": [-72, 0, 72], "no_start": true}, |
43 | ["The Scientific", -18, 0, 89], | 43 | {"title": "The Scientific", "pos": [-18, 0, 89], "long": true}, |
44 | ["The Wanderer", 0, 0, 80], | 44 | {"title": "The Wanderer", "pos": [0, 0, 80], "long": true}, |
45 | ["The Fearless", 18, 10, 90], | 45 | {"title": "The Fearless", "pos": [18, 10, 90]}, |
46 | ["Champion's Rest", 23, 0, 62, true], | 46 | {"title": "Champion's Rest", "pos": [23, 0, 62], "no_start": true, "long": true}, |
47 | ["The Steady", 31, 0, 77, true], | 47 | {"title": "The Steady", "pos": [31, 0, 77], "no_start": true}, |
48 | ["The Bold", 67, 0, 77, true], | 48 | {"title": "The Bold", "pos": [67, 0, 77], "no_start": true}, |
49 | ["Color Hunt", 45, 0, 69], | 49 | {"title": "Color Hunt", "pos": [45, 0, 69]}, |
50 | ["Room Room", 95, 6, 84], | 50 | {"title": "Room Room", "pos": [95, 6, 84]}, |
51 | ["The Bearer", 61, 0, 51], | 51 | {"title": "The Bearer", "pos": [61, 0, 51]}, |
52 | ["Tower Third Floor", 18, 0, 33], | 52 | {"title": "Tower Third Floor", "pos": [18, 0, 33]}, |
53 | ["Rhyme Room (Cross)", 0, 9, 42], | 53 | {"title": "Rhyme Room (Cross)", "pos": [0, 9, 42]}, |
54 | ["Tower Seventh Floor", 0, 37, 64], | 54 | {"title": "Tower Seventh Floor", "pos": [0, 37, 64], "long": true}, |
55 | ] | 55 | ] |
56 | 56 | ||
57 | const LL2_AREAS = [ | 57 | const LL2_AREAS = [ |
58 | ["Orange Pyramid", 86, 10, -84, true], | 58 | {"title": "Orange Pyramid", "pos": [86, 10, -84], "no_start": true, "long": true}, |
59 | ["The Stellar", 43, 6, -86], | 59 | {"title": "The Stellar", "pos": [43, 6, -86]}, |
60 | ["The Fuzzy", 12, 1, -86, true], | 60 | {"title": "The Fuzzy", "pos": [12, 1, -86], "no_start": true}, |
61 | ["The Devious", 0, 0, -88], | 61 | {"title": "The Devious", "pos": [0, 0, -88]}, |
62 | ["The Sharp", -26, 0, -88, true], | 62 | {"title": "The Sharp", "pos": [-26, 0, -88], "no_start": true}, |
63 | ["The Structured", -50, 0, -88], | 63 | {"title": "The Structured", "pos": [-50, 0, -88]}, |
64 | ["Brown Pyramid", -86, 10, -85, true], | 64 | {"title": "Brown Pyramid", "pos": [-86, 10, -85], "no_start": true, "long": true}, |
65 | ["The Tasty", -86, 7, -62], | 65 | {"title": "The Tasty", "pos": [-86, 7, -62]}, |
66 | ["Black White Room", -88, 0, -32], | 66 | {"title": "Black White Room", "pos": [-88, 0, -32]}, |
67 | ["Lime Magenta Room", -96, 0, -24], | 67 | {"title": "Lime Magenta Room", "pos": [-96, 0, -24]}, |
68 | ["Red Blue Room", -87, 0, -23], | 68 | {"title": "Red Blue Room", "pos": [-87, 0, -23]}, |
69 | ["The Archaeologist", -74, 0, -32], | 69 | {"title": "The Archaeologist", "pos": [-74, 0, -32], "long": true}, |
70 | ["The Earnest", -87, 0, -56], | 70 | {"title": "The Earnest", "pos": [-87, 0, -56]}, |
71 | ["The Hidden", -50, 6, -71, true], | 71 | {"title": "The Hidden", "pos": [-50, 6, -71], "no_start": true}, |
72 | ["The Sapient", -36, 36, -36], | 72 | {"title": "The Sapient", "pos": [-36, 36, -36]}, |
73 | ["The Ethereal", -42, 0, -22], | 73 | {"title": "The Ethereal", "pos": [-42, 0, -22]}, |
74 | ["The Learned", 34, 1, -64, true], | 74 | {"title": "The Learned", "pos": [34, 1, -64], "no_start": true}, |
75 | ["Whispers Behind Quiet Walls", 44, 0, -51, true], | 75 | {"title": "Whispers Behind Quiet Walls", "pos": [44, 0, -51], "no_start": true, "long": true}, |
76 | ["The Lunar", 45, 0, -22], | 76 | {"title": "The Lunar", "pos": [45, 0, -22]}, |
77 | ["The Arcadian", 86, 0, -53], | 77 | {"title": "The Arcadian", "pos": [86, 0, -53]}, |
78 | ["The Frozen", 84, 0, -27], | 78 | {"title": "The Frozen", "pos": [84, 0, -27]}, |
79 | ["The Unscrambled", -50, 0, -10], | 79 | {"title": "The Unscrambled", "pos": [-50, 0, -10]}, |
80 | ["Nightmare", 73, 0, -27, true], | 80 | {"title": "Nightmare", "pos": [73, 0, -27], "no_start": true}, |
81 | ["The Amazing", -13, 0, -42], | 81 | {"title": "The Amazing", "pos": [-13, 0, -42]}, |
82 | ["Challenge Room", -94, 0, 2], | 82 | {"title": "Challenge Room", "pos": [-94, 0, 2]}, |
83 | ["The Fresh", -82, 0, -10], | 83 | {"title": "The Fresh", "pos": [-82, 0, -10]}, |
84 | ["The Exemplary", -82, 0, 11], | 84 | {"title": "The Exemplary", "pos": [-82, 0, 11]}, |
85 | ["The Roaming", -66, 0, -11], | 85 | {"title": "The Roaming", "pos": [-66, 0, -11]}, |
86 | ["The Veteran", -66, 0, 12], | 86 | {"title": "The Veteran", "pos": [-66, 0, 12]}, |
87 | ["The Royal", -50, 0, 10], | 87 | {"title": "The Royal", "pos": [-50, 0, 10]}, |
88 | ["The Exact", -33, 0, -12], | 88 | {"title": "The Exact", "pos": [-33, 0, -12]}, |
89 | ["The Appreciated", -33, 0, 11], | 89 | {"title": "The Appreciated", "pos": [-33, 0, 11]}, |
90 | ["The Unsullied", -17, 0, -11], | 90 | {"title": "The Unsullied", "pos": [-17, 0, -11]}, |
91 | ["The Unopposed", -18, 0, 10], | 91 | {"title": "The Unopposed", "pos": [-18, 0, 10]}, |
92 | ["The Multitalented", -10, 0, 0], | 92 | {"title": "The Multitalented", "pos": [-10, 0, 0]}, |
93 | ["Starting Room", 0, 0, 0], | 93 | {"title": "Starting Room", "pos": [0, 0, 0]}, |
94 | ["Control Room", 0, 0, 14], | 94 | {"title": "Control Room", "pos": [0, 0, 14]}, |
95 | ["Countdown Room", 0, 0, 33, true], | 95 | {"title": "Countdown Room", "pos": [0, 0, 33], "no_start": true}, |
96 | ["The Lucky", 13, 1, 32, true], | 96 | {"title": "The Lucky", "pos": [13, 1, 32], "no_start": true, "long": true}, |
97 | ["Greenhouse", 14, 0, 6], | 97 | {"title": "Greenhouse", "pos": [14, 0, 6]}, |
98 | ["The Sweet", 24, 0, 18, true], | 98 | {"title": "The Sweet", "pos": [24, 0, 18], "no_start": true}, |
99 | ["The Fall", 87, 0, -4, true], | 99 | {"title": "The Fall", "pos": [87, 0, -4], "no_start": true, "long": true}, |
100 | ["White Pyramid", 46, 0, -1], | 100 | {"title": "White Pyramid", "pos": [46, 0, -1], "long": true}, |
101 | ["Z", 95, 0, 25, true], | 101 | {"title": "Z", "pos": [95, 0, 25], "no_start": true}, |
102 | ["The Worldly", 92, 0, 58], | 102 | {"title": "The Worldly", "pos": [92, 0, 58]}, |
103 | ["The Perennial", 39, 0, 32], | 103 | {"title": "The Perennial", "pos": [39, 0, 32]}, |
104 | ["The Analytical", -28, 0, 35], | 104 | {"title": "The Analytical", "pos": [-28, 0, 35]}, |
105 | ["Car Room", -59, 0, 50, true], | 105 | {"title": "Car Room", "pos": [-59, 0, 50], "no_start": true}, |
106 | ["The Mythical", -35, 4, 73], | 106 | {"title": "The Mythical", "pos": [-35, 4, 73]}, |
107 | ["LL1 Starting Room", -70, 0, 41], | 107 | {"title": "LL1 Starting Room", "pos": [-70, 0, 41]}, |
108 | ["LL1 Second Room", -86, 0, 41], | 108 | {"title": "LL1 Second Room", "pos": [-86, 0, 41]}, |
109 | ["The Seen", -83, 0, 57, true], | 109 | {"title": "The Seen", "pos": [-83, 0, 57], "no_start": true}, |
110 | ["Purple Pyramid", -87, 10, 85, true], | 110 | {"title": "Purple Pyramid", "pos": [-87, 10, 85], "no_start": true, "long": true}, |
111 | ["Four Pips", -66, 0, 76], | 111 | {"title": "Four Pips", "pos": [-66, 0, 76]}, |
112 | ["Twinkle Twinkle Little Star", 6, 0, 55, true], | 112 | {"title": "Twinkle Twinkle Little Star", "pos": [6, 0, 55], "no_start": true}, |
113 | ["The Unforgettable", 9, 40, 88], | 113 | {"title": "The Unforgettable", "pos": [9, 40, 88]}, |
114 | ["HI Room", 27, 0, 59], | 114 | {"title": "HI Room", "pos": [27, 0, 59]}, |
115 | ["The Handy", 39, 10, 83], | 115 | {"title": "The Handy", "pos": [39, 10, 83]}, |
116 | ["Mint Pyramid", 86, 10, 83, true], | 116 | {"title": "Mint Pyramid", "pos": [86, 10, 83], "no_start": true, "long": true}, |
117 | ] | 117 | ] |
118 | 118 | ||
119 | const kLEVEL_CHOICE_ANY = 0 | ||
120 | const kLEVEL_CHOICE_LL1 = 1 | ||
121 | const kLEVEL_CHOICE_LL2 = 2 | ||
119 | 122 | ||
120 | func choose_route(): | 123 | const kLENGTH_CHOICE_ANY = 0 |
124 | const kLENGTH_CHOICE_SHORT = 1 | ||
125 | const kLENGTH_CHOICE_LONG = 2 | ||
126 | |||
127 | |||
128 | func choose_route(levelchoice: int, lengthchoice: int): | ||
121 | var rng = RandomNumberGenerator.new() | 129 | var rng = RandomNumberGenerator.new() |
122 | rng.randomize() | 130 | rng.randomize() |
123 | 131 | ||
124 | var areas_slot | 132 | var areas_slot |
125 | var level_name | 133 | var level_name |
126 | if rng.randi_range(0, 2) == 0: | 134 | if levelchoice == kLEVEL_CHOICE_ANY: |
127 | areas_slot = LL1_AREAS | 135 | if rng.randi_range(0, 2) == 0: |
136 | level_name = "level1" | ||
137 | else: | ||
138 | level_name = "level2" | ||
139 | elif levelchoice == kLEVEL_CHOICE_LL1: | ||
128 | level_name = "level1" | 140 | level_name = "level1" |
129 | else: | 141 | elif levelchoice == kLEVEL_CHOICE_LL2: |
130 | areas_slot = LL2_AREAS | ||
131 | level_name = "level2" | 142 | level_name = "level2" |
132 | 143 | ||
144 | if level_name == "level1": | ||
145 | areas_slot = LL1_AREAS | ||
146 | elif level_name == "level2": | ||
147 | areas_slot = LL2_AREAS | ||
148 | |||
133 | var start_pos | 149 | var start_pos |
134 | var end_pos | 150 | var end_pos |
135 | var found = false | 151 | var found = false |
@@ -141,9 +157,23 @@ func choose_route(): | |||
141 | i = rng.randi_range(0, areas_dupe.size() - 1) | 157 | i = rng.randi_range(0, areas_dupe.size() - 1) |
142 | end_pos = areas_dupe[i] | 158 | end_pos = areas_dupe[i] |
143 | 159 | ||
144 | var start_vec = Vector3(start_pos[1], start_pos[2], start_pos[3]) | 160 | var start_vec = Vector3(start_pos["pos"][0], start_pos["pos"][1], start_pos["pos"][2]) |
145 | var end_vec = Vector3(end_pos[1], end_pos[2], end_pos[3]) | 161 | var end_vec = Vector3(end_pos["pos"][0], end_pos["pos"][1], end_pos["pos"][2]) |
146 | if start_vec.distance_to(end_vec) > 50 and not (start_pos.size() >= 5 and start_pos[4]): | 162 | if start_vec.distance_to(end_vec) < 50: |
147 | found = true | 163 | continue |
164 | |||
165 | if start_pos.has("no_start") and start_pos["no_start"]: | ||
166 | continue | ||
167 | |||
168 | if end_pos.has("long") and end_pos["long"] and lengthchoice == kLENGTH_CHOICE_SHORT: | ||
169 | continue | ||
170 | |||
171 | if ( | ||
172 | ((end_pos.has("long") and !end_pos["long"]) or !end_pos.has("long")) | ||
173 | and lengthchoice == kLENGTH_CHOICE_LONG | ||
174 | ): | ||
175 | continue | ||
176 | |||
177 | found = true | ||
148 | 178 | ||
149 | return [level_name, start_pos, end_pos] | 179 | return [level_name, start_pos, end_pos] |