Options: allow yaml access to Priority Locations

This commit is contained in:
Fabian Dill 2022-02-01 16:36:14 +01:00
parent 2361f8f9d3
commit 0f20888563
5 changed files with 17 additions and 5 deletions

View File

@ -918,6 +918,7 @@ class LocationProgressType(Enum):
PRIORITY = 2
EXCLUDED = 3
class Location():
# If given as integer, then this is the shop's inventory index
shop_slot: Optional[int] = None
@ -927,7 +928,6 @@ class Location():
spot_type = 'Location'
game: str = "Generic"
show_in_spoiler: bool = True
excluded: bool = False
crystal: bool = False
progress_type: LocationProgressType = LocationProgressType.DEFAULT
always_allow = staticmethod(lambda item, state: False)

View File

@ -9,7 +9,7 @@ import tempfile
import zipfile
from typing import Dict, Tuple, Optional
from BaseClasses import MultiWorld, CollectionState, Region, RegionType
from BaseClasses import MultiWorld, CollectionState, Region, RegionType, LocationProgressType
from worlds.alttp.Items import item_name_groups
from worlds.alttp.Regions import lookup_vanilla_location_to_entrance
from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned
@ -137,6 +137,9 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
for player in world.player_ids:
exclusion_rules(world, player, world.exclude_locations[player].value)
world.priority_locations[player].value -= world.exclude_locations[player].value
for location_name in world.priority_locations[player].value:
world.get_location(location_name, player).progress_type = LocationProgressType.PRIORITY
AutoWorld.call_all(world, "generate_basic")

View File

@ -428,6 +428,12 @@ class ExcludeLocations(OptionSet):
verify_location_name = True
class PriorityLocations(OptionSet):
"""Prevent these locations from having an unimportant item"""
displayname = "Priority Locations"
verify_location_name = True
class DeathLink(Toggle):
"""When you die, everyone dies. Of course the reverse is true too."""
displayname = "Death Link"
@ -440,7 +446,8 @@ per_game_common_options = {
"start_inventory": StartInventory,
"start_hints": StartHints,
"start_location_hints": StartLocationHints,
"exclude_locations": ExcludeLocations
"exclude_locations": ExcludeLocations,
"priority_locations": PriorityLocations,
}
if __name__ == "__main__":

View File

@ -32,9 +32,9 @@ def exclusion_rules(world, player: int, exclude_locations: typing.Set[str]):
raise Exception(f"Unable to exclude location {loc_name} in player {player}'s world.") from e
else:
add_item_rule(location, lambda i: not (i.advancement or i.never_exclude))
location.excluded = True
location.progress_type = LocationProgressType.EXCLUDED
def set_rule(spot, rule: CollectionRule):
spot.access_rule = rule

View File

@ -1,5 +1,7 @@
import random
from BaseClasses import LocationProgressType
# Abbreviations
# DMC Death Mountain Crater
# DMT Death Mountain Trail
@ -1257,7 +1259,7 @@ def hintExclusions(world, clear_cache=False):
world.hint_exclusions = []
for location in world.get_locations():
if (location.locked and (location.item.type != 'Song' or world.shuffle_song_items != 'song')) or location.excluded:
if (location.locked and (location.item.type != 'Song' or world.shuffle_song_items != 'song')) or location.progress_type == LocationProgressType.EXCLUDED:
world.hint_exclusions.append(location.name)
world_location_names = [