1
1
from typing import Dict , List , Any
2
-
2
+ from logging import warning
3
3
from BaseClasses import Region , Location , Item , Tutorial , ItemClassification
4
4
from .items import item_name_to_id , item_table , item_name_groups , fool_tiers , filler_items , slot_data_item_names
5
5
from .locations import location_table , location_name_groups , location_name_to_id , hexagon_locations
@@ -123,7 +123,7 @@ def create_items(self) -> None:
123
123
# Filler items in the item pool
124
124
available_filler : List [str ] = [filler for filler in items_to_create if items_to_create [filler ] > 0 and
125
125
item_table [filler ].classification == ItemClassification .filler ]
126
-
126
+
127
127
# Remove filler to make room for other items
128
128
def remove_filler (amount : int ):
129
129
for _ in range (0 , amount ):
@@ -150,7 +150,7 @@ def remove_filler(amount: int):
150
150
hexagon_goal = self .options .hexagon_goal
151
151
extra_hexagons = self .options .extra_hexagon_percentage
152
152
items_to_create [gold_hexagon ] += int ((Decimal (100 + extra_hexagons ) / 100 * hexagon_goal ).to_integral_value (rounding = ROUND_HALF_UP ))
153
-
153
+
154
154
# Replace pages and normal hexagons with filler
155
155
for replaced_item in list (filter (lambda item : "Pages" in item or item in hexagon_locations , items_to_create )):
156
156
filler_name = self .get_filler_item_name ()
@@ -184,7 +184,7 @@ def create_regions(self) -> None:
184
184
self .tunic_portal_pairs = {}
185
185
self .er_portal_hints = {}
186
186
self .ability_unlocks = randomize_ability_unlocks (self .random , self .options )
187
-
187
+
188
188
# stuff for universal tracker support, can be ignored for standard gen
189
189
if hasattr (self .multiworld , "re_gen_passthrough" ):
190
190
if "TUNIC" in self .multiworld .re_gen_passthrough :
@@ -245,17 +245,27 @@ def extend_hint_information(self, hint_data: Dict[int, Dict[int, str]]):
245
245
continue
246
246
path_to_loc = []
247
247
previous_name = "placeholder"
248
- name , connection = paths [location .parent_region ]
249
- while connection != ("Menu" , None ):
250
- name , connection = connection
251
- # for LS entrances, we just want to give the portal name
252
- if "(LS)" in name :
253
- name , _ = name .split (" (LS) " )
254
- # was getting some cases like Library Grave -> Library Grave -> other place
255
- if name in portal_names and name != previous_name :
256
- previous_name = name
257
- path_to_loc .append (name )
258
- hint_text = " -> " .join (reversed (path_to_loc ))
248
+ try :
249
+ name , connection = paths [location .parent_region ]
250
+ except KeyError :
251
+ # logic bug, proceed with warning since it takes a long time to update AP
252
+ warning (f"{ location .name } is not logically accessible for "
253
+ f"{ self .multiworld .get_file_safe_player_name (self .player )} . "
254
+ "Creating entrance hint Inaccessible. "
255
+ "Please report this to the TUNIC rando devs." )
256
+ hint_text = "Inaccessible"
257
+ else :
258
+ while connection != ("Menu" , None ):
259
+ name , connection = connection
260
+ # for LS entrances, we just want to give the portal name
261
+ if "(LS)" in name :
262
+ name , _ = name .split (" (LS) " )
263
+ # was getting some cases like Library Grave -> Library Grave -> other place
264
+ if name in portal_names and name != previous_name :
265
+ previous_name = name
266
+ path_to_loc .append (name )
267
+ hint_text = " -> " .join (reversed (path_to_loc ))
268
+
259
269
if hint_text :
260
270
hint_data [self .player ][location .address ] = hint_text
261
271
0 commit comments