Skip to content

Commit

Permalink
Docs: Mention explicit_indirect_conditions & "Menu" -> origin_region_…
Browse files Browse the repository at this point in the history
…name (ArchipelagoMW#3887)

* Docs: Mention explicit_indirect_conditions

ArchipelagoMW#3682

* Update world api.md

* Docs: "Menu" -> origin_region_name

ArchipelagoMW#3682

* Update docs/world api.md

Co-authored-by: Nicholas Saylor <[email protected]>

* Update world api.md

* I just didn't do this one and then Medic approved it anyway LMAO

* Update world api.md

---------

Co-authored-by: Nicholas Saylor <[email protected]>
  • Loading branch information
2 people authored and AustinSumigray committed Jan 4, 2025
1 parent c000fd9 commit 1967a04
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/world api.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ like entrance randomization in logic.

Regions have a list called `exits`, containing `Entrance` objects representing transitions to other regions.

There must be one special region, "Menu", from which the logic unfolds. AP assumes that a player will always be able to
return to the "Menu" region by resetting the game ("Save and quit").
There must be one special region (Called "Menu" by default, but configurable using [origin_region_name](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/AutoWorld.py#L295-L296)),
from which the logic unfolds. AP assumes that a player will always be able to return to this starting region by resetting the game ("Save and quit").

### Entrances

Expand Down Expand Up @@ -328,6 +328,9 @@ Even doing `state.can_reach_location` or `state.can_reach_entrance` is problemat
You can use `multiworld.register_indirect_condition(region, entrance)` to explicitly tell the generator that, when a given region becomes accessible, it is necessary to re-check a specific entrance.
You **must** use `multiworld.register_indirect_condition` if you perform this kind of `can_reach` from an entrance access rule, unless you have a **very** good technical understanding of the relevant code and can reason why it will never lead to problems in your case.

Alternatively, you can set [world.explicit_indirect_conditions = False](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/AutoWorld.py#L298-L301),
avoiding the need for indirect conditions at the expense of performance.

### Item Rules

An item rule is a function that returns `True` or `False` for a `Location` based on a single item. It can be used to
Expand Down Expand Up @@ -463,7 +466,7 @@ The world has to provide the following things for generation:

* the properties mentioned above
* additions to the item pool
* additions to the regions list: at least one called "Menu"
* additions to the regions list: at least one named after the world class's origin_region_name ("Menu" by default)
* locations placed inside those regions
* a `def create_item(self, item: str) -> MyGameItem` to create any item on demand
* applying `self.multiworld.push_precollected` for world-defined start inventory
Expand Down Expand Up @@ -516,7 +519,7 @@ def generate_early(self) -> None:

```python
def create_regions(self) -> None:
# Add regions to the multiworld. "Menu" is the required starting point.
# Add regions to the multiworld. One of them must use the origin_region_name as its name ("Menu" by default).
# Arguments to Region() are name, player, multiworld, and optionally hint_text
menu_region = Region("Menu", self.player, self.multiworld)
self.multiworld.regions.append(menu_region) # or use += [menu_region...]
Expand Down

0 comments on commit 1967a04

Please sign in to comment.