WebHost, Core: Move item and location descriptions to WebWorld responsibilities. (#2508)

Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
This commit is contained in:
Zach Parks
2024-05-23 02:08:08 -05:00
committed by GitHub
parent 8b6eae0a14
commit e1ff5073b5
7 changed files with 83 additions and 124 deletions

View File

@@ -121,6 +121,53 @@ class RLWeb(WebWorld):
# ...
```
* `location_descriptions` (optional) WebWorlds can provide a map that contains human-friendly descriptions of locations
or location groups.
```python
# locations.py
location_descriptions = {
"Red Potion #6": "In a secret destructible block under the second stairway",
"L2 Spaceship": """
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 Spaceship Key.
"""
}
# __init__.py
from worlds.AutoWorld import WebWorld
from .locations import location_descriptions
class MyGameWeb(WebWorld):
location_descriptions = location_descriptions
```
* `item_descriptions` (optional) WebWorlds can provide a map that contains human-friendly descriptions of items or item
groups.
```python
# items.py
item_descriptions = {
"Red Potion": "A standard health potion",
"Spaceship Key": """
The key to the spaceship in Level 2.
This is necessary to get to the Star Realm.
""",
}
# __init__.py
from worlds.AutoWorld import WebWorld
from .items import item_descriptions
class MyGameWeb(WebWorld):
item_descriptions = item_descriptions
```
### MultiWorld Object
The `MultiWorld` object references the whole multiworld (all items and locations for all players) and is accessible
@@ -178,36 +225,6 @@ Classification is one of `LocationProgressType.DEFAULT`, `PRIORITY` or `EXCLUDED
The Fill algorithm will force progression items to be placed at priority locations, giving a higher chance of them being
required, and will prevent progression and useful items from being placed at excluded locations.
#### Documenting Locations
Worlds can optionally provide a `location_descriptions` map which contains human-friendly descriptions of locations and
location groups. These descriptions will show up in location-selection options on the options pages.
```python
# locations.py
location_descriptions = {
"Red Potion #6": "In a secret destructible block under the second stairway",
"L2 Spaceship":
"""
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 Spaceship Key.
"""
}
```
```python
# __init__.py
from worlds.AutoWorld import World
from .locations import location_descriptions
class MyGameWorld(World):
location_descriptions = location_descriptions
```
### Items
Items are all things that can "drop" for your game. This may be RPG items like weapons, or technologies you normally
@@ -232,36 +249,6 @@ Other classifications include:
* `progression_skip_balancing`: the combination of `progression` and `skip_balancing`, i.e., a progression item that
will not be moved around by progression balancing; used, e.g., for currency or tokens, to not flood early spheres
#### Documenting Items
Worlds can optionally provide an `item_descriptions` map which contains human-friendly descriptions of items and item
groups. These descriptions will show up in item-selection options on the options pages.
```python
# items.py
item_descriptions = {
"Red Potion": "A standard health potion",
"Spaceship Key":
"""
The key to the spaceship in Level 2.
This is necessary to get to the Star Realm.
"""
}
```
```python
# __init__.py
from worlds.AutoWorld import World
from .items import item_descriptions
class MyGameWorld(World):
item_descriptions = item_descriptions
```
### Events
An Event is a special combination of a Location and an Item, with both having an `id` of `None`. These can be used to