Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: move option results to the World class instead of MultiWorld #993

Merged
merged 120 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
24471ce
map option objects to a `World.options` dict
alwaysintreble Sep 2, 2022
220571f
convert RoR2 to options dict system for testing
alwaysintreble Sep 2, 2022
643205c
add temp behavior for lttp with notes
alwaysintreble Sep 2, 2022
695c94c
copy/paste bad
alwaysintreble Sep 25, 2022
caaf051
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Sep 25, 2022
d481eed
convert `set_default_common_options` to a namespace property
alwaysintreble Sep 29, 2022
f9a8bb2
reorganize test call order
alwaysintreble Sep 29, 2022
cded105
have fill_restrictive use the new options system
alwaysintreble Sep 29, 2022
be3fa3a
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Oct 18, 2022
52290df
update world api
alwaysintreble Oct 18, 2022
5896e6c
update soe tests
alwaysintreble Oct 18, 2022
cdcd06c
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Oct 29, 2022
2581d57
fix world api
alwaysintreble Oct 29, 2022
121152b
core: auto initialize a dataclass on the World class with the option …
el-u Jan 9, 2023
82ff125
core: auto initialize a dataclass on the World class with the option …
el-u Jan 9, 2023
ad2f59e
Merge pull request #14 from el-u/options_dict
alwaysintreble Jan 9, 2023
43353de
add `as_dict` method to the options dataclass
alwaysintreble Jan 9, 2023
af5647d
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Jan 9, 2023
76833d5
fix namespace issues with tests
alwaysintreble Jan 9, 2023
d85fb69
have current option updates use `.value` instead of changing the option
alwaysintreble Feb 12, 2023
42c1abb
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Feb 12, 2023
cfdc0b1
update ror2 to use the new options system again
alwaysintreble Feb 12, 2023
eaadb6e
revert the junk pool dict since it's cased differently
alwaysintreble Feb 12, 2023
d890de4
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Feb 14, 2023
0658a5b
fix begin_with_loop typo
alwaysintreble Feb 14, 2023
effbca0
write new and old options to spoiler
alwaysintreble Feb 14, 2023
b78b7d3
change factorio option behavior back
alwaysintreble Feb 14, 2023
94d18dc
fix comparisons
alwaysintreble Feb 14, 2023
0c0663b
move common and per_game_common options to new system
alwaysintreble Feb 14, 2023
a638582
core: automatically create missing options_dataclass from legacy opti…
el-u Feb 14, 2023
11214aa
Merge pull request #15 from el-u/options_dict
alwaysintreble Feb 14, 2023
fe679fc
remove spoiler special casing and add back the Factorio option changi…
alwaysintreble Feb 14, 2023
c5684bb
give ArchipIDLE the default options_dataclass so its options get gene…
alwaysintreble Feb 15, 2023
cecd3f7
reimplement `inspect.get_annotations`
alwaysintreble Feb 17, 2023
1fbc1a4
move option info generation for webhost to new system
alwaysintreble Feb 17, 2023
c3ad00b
need to include Common and PerGame common since __annotations__ doesn…
alwaysintreble Feb 17, 2023
1730eaf
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Feb 17, 2023
1b1ee31
use get_type_hints for the options dictionary
alwaysintreble Feb 21, 2023
85e98a0
typing.get_type_hints returns the bases too.
alwaysintreble Feb 21, 2023
a24bb2e
forgot to sweep through generate
alwaysintreble Feb 21, 2023
9df025d
sweep through all the tests
alwaysintreble Feb 21, 2023
337133c
swap to a metaclass property
alwaysintreble Feb 22, 2023
aadbd56
move remaining usages from get_type_hints to metaclass property
el-u Feb 25, 2023
2584535
move remaining usages from __annotations__ to metaclass property
el-u Feb 25, 2023
0ae2acc
move remaining usages from legacy dictionaries to metaclass property
el-u Feb 25, 2023
a147aae
remove legacy dictionaries
el-u Feb 25, 2023
88db4f7
cache the metaclass property
el-u Feb 25, 2023
01374e0
clarify inheritance in world api
el-u Feb 25, 2023
9d4ab5b
Merge pull request #16 from el-u/options_dict
alwaysintreble Feb 25, 2023
069328c
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Mar 6, 2023
b831bac
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Mar 13, 2023
ac123db
move the messenger to new options system
alwaysintreble Mar 13, 2023
e6806ed
add an assert for my dumb
alwaysintreble Mar 13, 2023
7c7a49f
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Mar 14, 2023
2c8afbc
update the doc
alwaysintreble Mar 14, 2023
f8ba777
rename o to options
alwaysintreble Mar 14, 2023
984d659
missed a spot
alwaysintreble Mar 14, 2023
61b82f1
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Apr 1, 2023
e959c49
update new messenger options
alwaysintreble Apr 1, 2023
ec8c75b
comment spacing
alwaysintreble Apr 1, 2023
5f32194
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble May 21, 2023
2b46533
fix tests
alwaysintreble May 21, 2023
e6424e2
fix missing import
alwaysintreble May 21, 2023
f189f5d
make the documentation definition more accurate
alwaysintreble May 25, 2023
73e5875
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble May 31, 2023
2ba7464
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Jun 28, 2023
3e1be1e
use options system for loc creation
alwaysintreble Jun 28, 2023
fc93f97
type cast MessengerWorld
alwaysintreble Jun 28, 2023
0b9959e
fix typo and use quotes for cast
alwaysintreble Jun 28, 2023
996697f
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Jul 19, 2023
266acd2
LTTP: set random seed in tests
alwaysintreble Jul 19, 2023
c39081a
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Jul 23, 2023
4596be9
ArchipIdle: remove change here as it's default on AutoWorld
alwaysintreble Jul 23, 2023
41ed545
Stardew: Need to set state because `set_default_common_options` used to
alwaysintreble Jul 23, 2023
26976b8
The Messenger: update shop rando and helpers to new system; optimize …
alwaysintreble Jul 23, 2023
7a114d4
Add a kwarg to `as_dict` to do the casing for you
alwaysintreble Jul 23, 2023
bb06b3a
RoR2: use new kwarg for less code
alwaysintreble Jul 23, 2023
8c8adbf
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Sep 1, 2023
f5da39e
RoR2: revert some accidental reverts
alwaysintreble Sep 2, 2023
9cf454b
The Messenger: remove an unnecessary variable
alwaysintreble Sep 2, 2023
37f6d8b
remove TypeVar that isn't used
beauxq Sep 2, 2023
d381d1d
CommonOptions not abstract
beauxq Sep 2, 2023
6d418f9
Docs: fix mistake in options api.md
alwaysintreble Sep 2, 2023
c02be73
remove unused TypeVar
alwaysintreble Sep 2, 2023
2e30f07
create options for item link worlds
alwaysintreble Sep 3, 2023
8583c2a
revert accidental doc removals
alwaysintreble Sep 3, 2023
c58f4a5
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Sep 26, 2023
c3a666f
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Sep 27, 2023
833f09c
Item Links: set default options on group
alwaysintreble Sep 27, 2023
06ba9ba
change Zillion to new options dataclass
beauxq Sep 28, 2023
7d09402
remove unused parameter to function
beauxq Sep 28, 2023
ddb630b
use TypeGuard for Literal narrowing
beauxq Oct 1, 2023
de98a33
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Oct 3, 2023
cf0e267
Merge remote-tracking branch 'Main/main' into options_dict
alwaysintreble Oct 6, 2023
dc041df
Merge branch 'main' into options_dict
black-sliver Oct 7, 2023
366a069
Merge branch 'options_dict' into treble/options_dict
beauxq Oct 7, 2023
668d598
move dlc quest to new api
alwaysintreble Oct 7, 2023
b952aaa
move overcooked 2 to new api
alwaysintreble Oct 7, 2023
555ac4c
Merge remote-tracking branch 'TrebleAP/options_dict' into options_dict
alwaysintreble Oct 7, 2023
75e2c6a
Zillion: move to new options dataclass
alwaysintreble Oct 7, 2023
8a5c157
fixed some missed code in oc2
alwaysintreble Oct 7, 2023
4a9e222
Merge remote-tracking branch 'TrebleAP/options_dict' into options_dict
alwaysintreble Oct 7, 2023
bcec62e
- Tried to be compliant with 993 (WIP?)
agilbert1412 Oct 7, 2023
0c1b3b2
- I think it all works now
agilbert1412 Oct 8, 2023
db38f11
- Removed last trace of me touching core
agilbert1412 Oct 8, 2023
5eb17a1
typo
alwaysintreble Oct 8, 2023
16ae3ad
It now passes all tests!
agilbert1412 Oct 8, 2023
228dfaa
Improve options, fix all issues I hope
agilbert1412 Oct 9, 2023
92f08a7
- Fixed init options
agilbert1412 Oct 9, 2023
095195a
dlcquest: fix bad imports
alwaysintreble Oct 9, 2023
f5c0e23
missed a file
alwaysintreble Oct 9, 2023
c38cce9
- Reduce code duplication
agilbert1412 Oct 9, 2023
4876639
add as_dict documentation
alwaysintreble Oct 9, 2023
b0f7671
- Use .items(), get option name more directly, fix slot data content
agilbert1412 Oct 10, 2023
82ae9df
- Remove generic options from the slot data
agilbert1412 Oct 10, 2023
db21617
Make Stardew Valley compliant
alwaysintreble Oct 10, 2023
86e956b
resolve conflicts
alwaysintreble Oct 10, 2023
130da25
improve slot data documentation
alwaysintreble Oct 10, 2023
d8fab8e
remove `CommonOptions.get_value` (#21)
beauxq Oct 10, 2023
1e707c7
better slot data description
alwaysintreble Oct 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions BaseClasses.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import copy
import itertools
from argparse import Namespace
from enum import unique, IntEnum, IntFlag
import logging
import json
Expand Down Expand Up @@ -201,18 +203,16 @@ def set_seed(self, seed: Optional[int] = None, secure: bool = False, name: Optio
range(1, self.players + 1)}

def set_options(self, args):
for option_key in Options.common_options:
setattr(self, option_key, getattr(args, option_key, {}))
for option_key in Options.per_game_common_options:
setattr(self, option_key, getattr(args, option_key, {}))

for player in self.player_ids:
self.custom_data[player] = {}
world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]]
for option_key in world_type.option_definitions:
setattr(self, option_key, getattr(args, option_key, {}))

self.worlds[player] = world_type(self, player)
for option_key in itertools.chain(Options.common_options, Options.per_game_common_options,
world_type.option_definitions):
option_values = getattr(args, option_key, {})
setattr(self, option_key, option_values)
if player in option_values:
self.worlds[player].options[option_key] = option_values[player]

def set_item_links(self):
item_links = {}
Expand Down Expand Up @@ -267,12 +267,13 @@ def set_item_links(self):
group["non_local_items"] = item_link["non_local_items"]

# intended for unittests
def set_default_common_options(self):
for option_key, option in Options.common_options.items():
setattr(self, option_key, {player_id: option(option.default) for player_id in self.player_ids})
for option_key, option in Options.per_game_common_options.items():
setattr(self, option_key, {player_id: option(option.default) for player_id in self.player_ids})
@property
def default_common_options(self) -> Namespace:
self.state = CollectionState(self)
alwaysintreble marked this conversation as resolved.
Show resolved Hide resolved
args = Namespace()
for option_key, option in itertools.chain(Options.common_options.items(), Options.per_game_common_options.items()):
setattr(args, option_key, {player_id: option.from_any(option.default) for player_id in self.player_ids})
return args

def secure(self):
self.random = secrets.SystemRandom()
Expand Down
3 changes: 2 additions & 1 deletion Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections import Counter, deque

from BaseClasses import CollectionState, Location, LocationProgressType, MultiWorld, Item, ItemClassification
from Options import Accessibility

from worlds.AutoWorld import call_all
from worlds.generic.Rules import add_item_rule
Expand Down Expand Up @@ -54,7 +55,7 @@ def fill_restrictive(world: MultiWorld, base_state: CollectionState, locations:
spot_to_fill: typing.Optional[Location] = None

# if minimal accessibility, only check whether location is reachable if game not beatable
if world.accessibility[item_to_place.player] == 'minimal':
if world.worlds[item_to_place.player].options["accessibility"] == Accessibility.option_minimal:
perform_access_check = not world.has_beaten_game(maximum_exploration_state,
item_to_place.player) \
if single_player_placement else not has_beaten_game
Expand Down
9 changes: 5 additions & 4 deletions docs/world api.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ inside a World object.
### Player Options

Players provide customized settings for their World in the form of yamls.
Those are accessible through `self.world.<option_name>[self.player]`. A dict
Those are accessible through `self.world.options["<option_name>"]`. A dict
alwaysintreble marked this conversation as resolved.
Show resolved Hide resolved
of valid options has to be provided in `self.option_definitions`. Options are automatically
added to the `World` object for easy access.

Expand Down Expand Up @@ -210,7 +210,7 @@ AP will only import the `__init__.py`. Depending on code size it makes sense to
use multiple files and use relative imports to access them.

e.g. `from .Options import mygame_options` from your `__init__.py` will load
`world/[world_name]/Options.py` and make its `mygame_options` accesible.
`world/[world_name]/Options.py` and make its `mygame_options` accessible.

When imported names pile up it may be easier to use `from . import Options`
and access the variable as `Options.mygame_options`.
Expand Down Expand Up @@ -262,7 +262,8 @@ to describe it and a `display_name` property for display on the website and in
spoiler logs.

The actual name as used in the yaml is defined in a `dict[str, Option]`, that is
assigned to the world under `self.option_definitions`.
assigned to the world under `self.option_definitions`. By convention, the string
that defines your option should be in `snake_case`.

Common option types are `Toggle`, `DefaultOnToggle`, `Choice`, `Range`.
For more see `Options.py` in AP's base directory.
Expand Down Expand Up @@ -455,7 +456,7 @@ In addition, the following methods can be implemented and attributes can be set
```python
def generate_early(self) -> None:
# read player settings to world instance
self.final_boss_hp = self.world.final_boss_hp[self.player].value
self.final_boss_hp = self.world.options["final_boss_hp"].value
alwaysintreble marked this conversation as resolved.
Show resolved Hide resolved
```

#### create_item
Expand Down
3 changes: 1 addition & 2 deletions test/dungeons/TestDungeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
class TestDungeon(unittest.TestCase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.starting_regions = [] # Where to start exploring
self.remove_exits = [] # Block dungeon exits
self.world.difficulty_requirements[1] = difficulties['normal']
Expand Down
13 changes: 11 additions & 2 deletions test/general/TestFill.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import itertools
from typing import List, Iterable
import unittest

import Options
from Options import Accessibility
from worlds.AutoWorld import World
from Fill import FillError, balance_multiworld_progression, fill_restrictive, distribute_items_restrictive
from BaseClasses import Entrance, LocationProgressType, MultiWorld, Region, RegionType, Item, Location, \
Expand All @@ -10,6 +14,7 @@
def generate_multi_world(players: int = 1) -> MultiWorld:
multi_world = MultiWorld(players)
multi_world.player_name = {}
args = multi_world.default_common_options
for i in range(players):
player_id = i+1
world = World(multi_world, player_id)
Expand All @@ -20,8 +25,12 @@ def generate_multi_world(players: int = 1) -> MultiWorld:
"Menu Region Hint", player_id, multi_world)
multi_world.regions.append(region)

for option_key in itertools.chain(Options.common_options, Options.per_game_common_options):
option_value = getattr(args, option_key, {})
setattr(multi_world, option_key, option_value)
multi_world.worlds[player_id].options[option_key] = option_value[player_id]

alwaysintreble marked this conversation as resolved.
Show resolved Hide resolved
multi_world.set_seed(0)
multi_world.set_default_common_options()

return multi_world

Expand Down Expand Up @@ -187,7 +196,7 @@ def test_minimal_fill(self):
items = player1.prog_items
locations = player1.locations

multi_world.accessibility[player1.id].value = multi_world.accessibility[player1.id].option_minimal
multi_world.worlds[player1.id].options["accessibility"] = Accessibility.from_any(Accessibility.option_minimal)
multi_world.completion_condition[player1.id] = lambda state: state.has(
items[1].name, player1.id)
set_rule(locations[1], lambda state: state.has(
Expand Down
3 changes: 1 addition & 2 deletions test/general/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ def setup_default_world(world_type) -> MultiWorld:
world.game[1] = world_type.game
world.player_name = {1: "Tester"}
world.set_seed()
args = Namespace()
args = world.default_common_options
for name, option in world_type.option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
world.set_options(args)
world.set_default_common_options()
for step in gen_steps:
call_all(world, step)
return world
3 changes: 1 addition & 2 deletions test/inverted/TestInverted.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
class TestInverted(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.difficulty_requirements[1] = difficulties['normal']
self.world.mode[1] = "inverted"
create_inverted_regions(self.world, 1)
Expand Down
3 changes: 1 addition & 2 deletions test/inverted/TestInvertedBombRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class TestInvertedBombRules(unittest.TestCase):
def setUp(self):
self.world = MultiWorld(1)
self.world.mode[1] = "inverted"
args = Namespace
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.difficulty_requirements[1] = difficulties['normal']
create_inverted_regions(self.world, 1)
create_dungeons(self.world, 1)
Expand Down
3 changes: 1 addition & 2 deletions test/inverted_minor_glitches/TestInvertedMinor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
class TestInvertedMinor(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.mode[1] = "inverted"
self.world.logic[1] = "minorglitches"
self.world.difficulty_requirements[1] = difficulties['normal']
Expand Down
3 changes: 1 addition & 2 deletions test/inverted_owg/TestInvertedOWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
class TestInvertedOWG(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.logic[1] = "owglitches"
self.world.mode[1] = "inverted"
self.world.difficulty_requirements[1] = difficulties['normal']
Expand Down
3 changes: 1 addition & 2 deletions test/minor_glitches/TestMinor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
class TestMinor(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.logic[1] = "minorglitches"
self.world.difficulty_requirements[1] = difficulties['normal']
self.world.worlds[1].er_seed = 0
Expand Down
3 changes: 1 addition & 2 deletions test/owg/TestVanillaOWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
class TestVanillaOWG(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.difficulty_requirements[1] = difficulties['normal']
self.world.logic[1] = "owglitches"
self.world.worlds[1].er_seed = 0
Expand Down
3 changes: 1 addition & 2 deletions test/soe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ def setUp(self):
self.world.game[1] = self.game
self.world.player_name = {1: "Tester"}
self.world.set_seed()
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types[self.game].option_definitions.items():
setattr(args, name, {1: option.from_any(self.options.get(name, option.default))})
self.world.set_options(args)
self.world.set_default_common_options()
for step in gen_steps:
call_all(self.world, step)

Expand Down
3 changes: 1 addition & 2 deletions test/vanilla/TestVanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
class TestVanilla(TestBase):
def setUp(self):
self.world = MultiWorld(1)
args = Namespace()
args = self.world.default_common_options
for name, option in AutoWorld.AutoWorldRegister.world_types["A Link to the Past"].option_definitions.items():
setattr(args, name, {1: option.from_any(option.default)})
self.world.set_options(args)
self.world.set_default_common_options()
self.world.logic[1] = "noglitches"
self.world.difficulty_requirements[1] = difficulties['normal']
self.world.worlds[1].er_seed = 0
Expand Down
4 changes: 3 additions & 1 deletion worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pathlib
from typing import Dict, FrozenSet, Set, Tuple, List, Optional, TextIO, Any, Callable, Type, Union, TYPE_CHECKING

from Options import AssembleOptions
from Options import AssembleOptions, Option
from BaseClasses import CollectionState

if TYPE_CHECKING:
Expand Down Expand Up @@ -121,6 +121,7 @@ class World(metaclass=AutoWorldRegister):
A Game should have its own subclass of World in which it defines the required data structures."""

option_definitions: Dict[str, AssembleOptions] = {} # link your Options mapping
options: Dict[str, Option[Any]] # automatically populated option names to resulting option object
game: str # name the game
topology_present: bool = False # indicate if world type has any meaningful layout/pathing

Expand Down Expand Up @@ -188,6 +189,7 @@ class World(metaclass=AutoWorldRegister):
def __init__(self, world: "MultiWorld", player: int):
self.world = world
self.player = player
self.options = {}

# overridable methods that get called by Main.py, sorted by execution order
# can also be implemented as a classmethod and called "stage_<original_name>",
Expand Down
Loading