TUNIC: Error catching for logic bugs in ER (#3082)

This commit is contained in:
Scipio Wright 2024-04-13 18:20:52 -04:00 committed by GitHub
parent 11073dfdac
commit fbeba1e470
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 15 deletions

View File

@ -1,5 +1,5 @@
from typing import Dict, List, Any from typing import Dict, List, Any
from logging import warning
from BaseClasses import Region, Location, Item, Tutorial, ItemClassification from BaseClasses import Region, Location, Item, Tutorial, ItemClassification
from .items import item_name_to_id, item_table, item_name_groups, fool_tiers, filler_items, slot_data_item_names from .items import item_name_to_id, item_table, item_name_groups, fool_tiers, filler_items, slot_data_item_names
from .locations import location_table, location_name_groups, location_name_to_id, hexagon_locations from .locations import location_table, location_name_groups, location_name_to_id, hexagon_locations
@ -245,7 +245,16 @@ class TunicWorld(World):
continue continue
path_to_loc = [] path_to_loc = []
previous_name = "placeholder" previous_name = "placeholder"
try:
name, connection = paths[location.parent_region] name, connection = paths[location.parent_region]
except KeyError:
# logic bug, proceed with warning since it takes a long time to update AP
warning(f"{location.name} is not logically accessible for "
f"{self.multiworld.get_file_safe_player_name(self.player)}. "
"Creating entrance hint Inaccessible. "
"Please report this to the TUNIC rando devs.")
hint_text = "Inaccessible"
else:
while connection != ("Menu", None): while connection != ("Menu", None):
name, connection = connection name, connection = connection
# for LS entrances, we just want to give the portal name # for LS entrances, we just want to give the portal name
@ -256,6 +265,7 @@ class TunicWorld(World):
previous_name = name previous_name = name
path_to_loc.append(name) path_to_loc.append(name)
hint_text = " -> ".join(reversed(path_to_loc)) hint_text = " -> ".join(reversed(path_to_loc))
if hint_text: if hint_text:
hint_data[self.player][location.address] = hint_text hint_data[self.player][location.address] = hint_text