Skip to content

Commit

Permalink
Simplify WebWorld
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhar committed Dec 13, 2023
1 parent 5377f88 commit 1cc04e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 36 deletions.
1 change: 0 additions & 1 deletion WebHostLib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,3 @@ def get_html_doc(option_type: type(Options.Option)) -> str:

with open(os.path.join(target_folder, 'weighted-options.json'), "w") as f:
json.dump(weighted_options, f, indent=2, separators=(',', ': '))

2 changes: 1 addition & 1 deletion docs/world api.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ indentation and single newlines will be collapsed into spaces.
The group of all items in the spaceship in Level 2.
This doesn't include the item on the spaceship door, since it can be
accessed without the Spaeship Key.
accessed without the Spaceship Key.
"""
}

Expand Down
2 changes: 1 addition & 1 deletion test/webhost/test_descriptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from worlds import AutoWorldRegister
from worlds.AutoWorld import AutoWorldRegister


class TestWebDescriptions(unittest.TestCase):
Expand Down
37 changes: 4 additions & 33 deletions worlds/AutoWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,40 +184,11 @@ class WebWorld:
options_presets: Dict[str, Dict[str, Any]] = {}
"""A dictionary containing a collection of developer-defined game option presets."""

_location_descriptions: Dict[str, str] = {"Everywhere": "All possible locations in the entire game."}
_item_descriptions: Dict[str, str] = {"Everything": "All possible items in the entire game."}
location_descriptions: Dict[str, str] = {}
"""An optional map from location names (or location group names) to brief descriptions for users."""

@property
def location_descriptions(self):
"""An optional map from location names (or location group names) to brief descriptions for users.
Individual newlines and indentation will be collapsed into spaces before these descriptions are displayed.
This may cover only a subset of locations.
"""
return self._location_descriptions

@location_descriptions.setter
def location_descriptions(self, dct: Dict[str, str]):
self._location_descriptions = {
"Everywhere": "All possible locations in the entire game.",
**{key: inspect.cleandoc(value) for key, value in dct.items()}
}

@property
def item_descriptions(self):
"""An optional map from item names (or item group names) to brief descriptions for users.
Individual newlines and indentation will be collapsed into spaces before these descriptions are displayed.
This may cover only a subset of items.
"""
return self._item_descriptions

@item_descriptions.setter
def item_descriptions(self, dct: Dict[str, str]):
self._location_descriptions = {
"Everything": "All possible items in the entire game.",
**{key: inspect.cleandoc(value) for key, value in dct.items()}
}
item_descriptions: Dict[str, str] = {}
"""An optional map from item names (or item group names) to brief descriptions for users."""


class World(metaclass=AutoWorldRegister):
Expand Down

0 comments on commit 1cc04e6

Please sign in to comment.