Core: Refactor Autoworld.options to Autoworld.option_definitions (#906)

* refactor `world.options` -> `world.option_definitions`

* rename world api reference

* missed some self.options
This commit is contained in:
alwaysintreble
2022-08-15 16:46:59 -05:00
committed by GitHub
parent 8484193151
commit 81cf1508e0
39 changed files with 49 additions and 49 deletions

View File

@@ -111,7 +111,7 @@ class World(metaclass=AutoWorldRegister):
"""A World object encompasses a game's Items, Locations, Rules and additional data or functionality required.
A Game should have its own subclass of World in which it defines the required data structures."""
options: Dict[str, Option[Any]] = {} # link your Options mapping
option_definitions: Dict[str, Option[Any]] = {} # link your Options mapping
game: str # name the game
topology_present: bool = False # indicate if world type has any meaningful layout/pathing

View File

@@ -110,7 +110,7 @@ class ALTTPWorld(World):
Ganon!
"""
game: str = "A Link to the Past"
options = alttp_options
option_definitions = alttp_options
topology_present = True
item_name_groups = item_name_groups
hint_blacklist = {"Triforce"}

View File

@@ -27,7 +27,7 @@ class ChecksFinderWorld(World):
with the mines! You win when you get all your items and beat the board!
"""
game: str = "ChecksFinder"
options = checksfinder_options
option_definitions = checksfinder_options
topology_present = True
web = ChecksFinderWeb()

View File

@@ -46,7 +46,7 @@ class DarkSouls3World(World):
"""
game: str = "Dark Souls III"
options = dark_souls_options
option_definitions = dark_souls_options
topology_present: bool = True
remote_items: bool = False
remote_start_inventory: bool = False

View File

@@ -38,7 +38,7 @@ class DKC3World(World):
mystery of why Donkey Kong and Diddy disappeared while on vacation.
"""
game: str = "Donkey Kong Country 3"
options = dkc3_options
option_definitions = dkc3_options
topology_present = False
data_version = 1
#hint_blacklist = {LocationName.rocket_rush_flag}

View File

@@ -193,7 +193,7 @@ class Factorio(World):
return super(Factorio, self).collect_item(state, item, remove)
options = factorio_options
option_definitions = factorio_options
@classmethod
def stage_write_spoiler(cls, world, spoiler_handle):

View File

@@ -27,7 +27,7 @@ class FF1World(World):
Part puzzle and part speed-run, it breathes new life into one of the most influential games ever made.
"""
options = ff1_options
option_definitions = ff1_options
game = "Final Fantasy"
topology_present = False
remote_items = True

View File

@@ -142,7 +142,7 @@ class HKWorld(World):
As the enigmatic Knight, youll traverse the depths, unravel its mysteries and conquer its evils.
""" # from https://www.hollowknight.com
game: str = "Hollow Knight"
options = hollow_knight_options
option_definitions = hollow_knight_options
web = HKWeb()
@@ -435,7 +435,7 @@ class HKWorld(World):
slot_data = {}
options = slot_data["options"] = {}
for option_name in self.options:
for option_name in self.option_definitions:
option = getattr(self.world, option_name)[self.player]
try:
optionvalue = int(option.value)

View File

@@ -49,7 +49,7 @@ class MeritousWorld(World):
# NOTE: Remember to change this before this game goes live
required_client_version = (0, 2, 4)
options = meritous_options
option_definitions = meritous_options
def __init__(self, world: MultiWorld, player: int):
super(MeritousWorld, self).__init__(world, player)

View File

@@ -58,7 +58,7 @@ class MinecraftWorld(World):
victory!
"""
game: str = "Minecraft"
options = minecraft_options
option_definitions = minecraft_options
topology_present = True
web = MinecraftWebWorld()

View File

@@ -95,7 +95,7 @@ class OOTWorld(World):
to rescue the Seven Sages, and then confront Ganondorf to save Hyrule!
"""
game: str = "Ocarina of Time"
options: dict = oot_options
option_definitions: dict = oot_options
topology_present: bool = True
item_name_to_id = {item_name: oot_data_to_ap_id(data, False) for item_name, data in item_table.items() if
data[2] is not None}

View File

@@ -17,7 +17,7 @@ class OriBlindForest(World):
item_name_to_id = item_table
location_name_to_id = lookup_name_to_id
options = options
option_definitions = options
hidden = True

View File

@@ -37,7 +37,7 @@ class RaftWorld(World):
lastItemId = max(filter(lambda val: val is not None, item_name_to_id.values()))
location_name_to_id = locations_lookup_name_to_id
options = raft_options
option_definitions = raft_options
data_version = 2
required_client_version = (0, 3, 4)

View File

@@ -30,7 +30,7 @@ class LegacyWorld(World):
But that's OK, because no one is perfect, and you don't have to be to succeed.
"""
game: str = "Rogue Legacy"
options = legacy_options
option_definitions = legacy_options
topology_present = False
data_version = 3
required_client_version = (0, 2, 3)

View File

@@ -28,7 +28,7 @@ class RiskOfRainWorld(World):
first crash landing.
"""
game: str = "Risk of Rain 2"
options = ror2_options
option_definitions = ror2_options
topology_present = False
item_name_to_id = item_table

View File

@@ -49,7 +49,7 @@ class SA2BWorld(World):
Sonic Adventure 2 Battle is an action platforming game. Play as Sonic, Tails, Knuckles, Shadow, Rogue, and Eggman across 31 stages and prevent the destruction of the earth.
"""
game: str = "Sonic Adventure 2 Battle"
options = sa2b_options
option_definitions = sa2b_options
topology_present = False
data_version = 2

View File

@@ -37,7 +37,7 @@ class SC2WoLWorld(World):
item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = {location.name: location.code for location in get_locations(None, None)}
options = sc2wol_options
option_definitions = sc2wol_options
item_name_groups = item_name_groups
locked_locations: typing.List[str]

View File

@@ -79,7 +79,7 @@ class SMWorld(World):
game: str = "Super Metroid"
topology_present = True
data_version = 1
options = sm_options
option_definitions = sm_options
item_names: Set[str] = frozenset(items_lookup_name_to_id)
location_names: Set[str] = frozenset(locations_lookup_name_to_id)
item_name_to_id = items_lookup_name_to_id
@@ -567,7 +567,7 @@ class SMWorld(World):
def fill_slot_data(self):
slot_data = {}
if not self.world.is_race:
for option_name in self.options:
for option_name in self.option_definitions:
option = getattr(self.world, option_name)[self.player]
slot_data[option_name] = option.value

View File

@@ -39,7 +39,7 @@ class SM64World(World):
area_connections: typing.Dict[int, int]
options = sm64_options
option_definitions = sm64_options
def generate_early(self):
self.topology_present = self.world.AreaRandomizer[self.player].value

View File

@@ -62,7 +62,7 @@ class SMZ3World(World):
game: str = "SMZ3"
topology_present = False
data_version = 2
options = smz3_options
option_definitions = smz3_options
item_names: Set[str] = frozenset(TotalSMZ3Item.lookup_name_to_id)
location_names: Set[str]
item_name_to_id = TotalSMZ3Item.lookup_name_to_id

View File

@@ -151,7 +151,7 @@ class SoEWorld(World):
space station where the final boss must be defeated.
"""
game: str = "Secret of Evermore"
options = soe_options
option_definitions = soe_options
topology_present = False
remote_items = False
data_version = 3
@@ -162,7 +162,7 @@ class SoEWorld(World):
location_name_to_id, location_id_to_raw = _get_location_mapping()
item_name_groups = _get_item_grouping()
trap_types = [name[12:] for name in options if name.startswith('trap_chance_')]
trap_types = [name[12:] for name in option_definitions if name.startswith('trap_chance_')]
evermizer_seed: int
connect_name: str
@@ -339,7 +339,7 @@ class SoEWorld(World):
placement_file = out_base + '.txt'
patch_file = out_base + '.apsoe'
flags = 'l' # spoiler log
for option_name in self.options:
for option_name in self.option_definitions:
option = getattr(self.world, option_name)[self.player]
if hasattr(option, 'to_flag'):
flags += option.to_flag()

View File

@@ -27,7 +27,7 @@ class SpireWorld(World):
immense power, and Slay the Spire!
"""
options = spire_options
option_definitions = spire_options
game = "Slay the Spire"
topology_present = False
data_version = 1

View File

@@ -39,7 +39,7 @@ class SubnauticaWorld(World):
item_name_to_id = {data["name"]: item_id for item_id, data in Items.item_table.items()}
location_name_to_id = all_locations
options = Options.options
option_definitions = Options.options
data_version = 5
required_client_version = (0, 3, 4)

View File

@@ -40,7 +40,7 @@ class TimespinnerWorld(World):
Travel back in time to change fate itself. Join timekeeper Lunais on her quest for revenge against the empire that killed her family.
"""
options = timespinner_options
option_definitions = timespinner_options
game = "Timespinner"
topology_present = True
remote_items = False

View File

@@ -41,7 +41,7 @@ class V6World(World):
music_map: typing.Dict[int,int]
options = v6_options
option_definitions = v6_options
def create_regions(self):
create_regions(self.world,self.player)

View File

@@ -41,7 +41,7 @@ class WitnessWorld(World):
static_locat = StaticWitnessLocations()
static_items = StaticWitnessItems()
web = WitnessWebWorld()
options = the_witness_options
option_definitions = the_witness_options
item_name_to_id = {
name: data.code for name, data in static_items.ALL_ITEM_TABLE.items()