Options: allow yaml access to Priority Locations
This commit is contained in:
parent
2361f8f9d3
commit
0f20888563
|
@ -918,6 +918,7 @@ class LocationProgressType(Enum):
|
||||||
PRIORITY = 2
|
PRIORITY = 2
|
||||||
EXCLUDED = 3
|
EXCLUDED = 3
|
||||||
|
|
||||||
|
|
||||||
class Location():
|
class Location():
|
||||||
# If given as integer, then this is the shop's inventory index
|
# If given as integer, then this is the shop's inventory index
|
||||||
shop_slot: Optional[int] = None
|
shop_slot: Optional[int] = None
|
||||||
|
@ -927,7 +928,6 @@ class Location():
|
||||||
spot_type = 'Location'
|
spot_type = 'Location'
|
||||||
game: str = "Generic"
|
game: str = "Generic"
|
||||||
show_in_spoiler: bool = True
|
show_in_spoiler: bool = True
|
||||||
excluded: bool = False
|
|
||||||
crystal: bool = False
|
crystal: bool = False
|
||||||
progress_type: LocationProgressType = LocationProgressType.DEFAULT
|
progress_type: LocationProgressType = LocationProgressType.DEFAULT
|
||||||
always_allow = staticmethod(lambda item, state: False)
|
always_allow = staticmethod(lambda item, state: False)
|
||||||
|
|
5
Main.py
5
Main.py
|
@ -9,7 +9,7 @@ import tempfile
|
||||||
import zipfile
|
import zipfile
|
||||||
from typing import Dict, Tuple, Optional
|
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.Items import item_name_groups
|
||||||
from worlds.alttp.Regions import lookup_vanilla_location_to_entrance
|
from worlds.alttp.Regions import lookup_vanilla_location_to_entrance
|
||||||
from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned
|
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:
|
for player in world.player_ids:
|
||||||
exclusion_rules(world, player, world.exclude_locations[player].value)
|
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")
|
AutoWorld.call_all(world, "generate_basic")
|
||||||
|
|
||||||
|
|
|
@ -428,6 +428,12 @@ class ExcludeLocations(OptionSet):
|
||||||
verify_location_name = True
|
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):
|
class DeathLink(Toggle):
|
||||||
"""When you die, everyone dies. Of course the reverse is true too."""
|
"""When you die, everyone dies. Of course the reverse is true too."""
|
||||||
displayname = "Death Link"
|
displayname = "Death Link"
|
||||||
|
@ -440,7 +446,8 @@ per_game_common_options = {
|
||||||
"start_inventory": StartInventory,
|
"start_inventory": StartInventory,
|
||||||
"start_hints": StartHints,
|
"start_hints": StartHints,
|
||||||
"start_location_hints": StartLocationHints,
|
"start_location_hints": StartLocationHints,
|
||||||
"exclude_locations": ExcludeLocations
|
"exclude_locations": ExcludeLocations,
|
||||||
|
"priority_locations": PriorityLocations,
|
||||||
}
|
}
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -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
|
raise Exception(f"Unable to exclude location {loc_name} in player {player}'s world.") from e
|
||||||
else:
|
else:
|
||||||
add_item_rule(location, lambda i: not (i.advancement or i.never_exclude))
|
add_item_rule(location, lambda i: not (i.advancement or i.never_exclude))
|
||||||
location.excluded = True
|
|
||||||
location.progress_type = LocationProgressType.EXCLUDED
|
location.progress_type = LocationProgressType.EXCLUDED
|
||||||
|
|
||||||
|
|
||||||
def set_rule(spot, rule: CollectionRule):
|
def set_rule(spot, rule: CollectionRule):
|
||||||
spot.access_rule = rule
|
spot.access_rule = rule
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from BaseClasses import LocationProgressType
|
||||||
|
|
||||||
# Abbreviations
|
# Abbreviations
|
||||||
# DMC Death Mountain Crater
|
# DMC Death Mountain Crater
|
||||||
# DMT Death Mountain Trail
|
# DMT Death Mountain Trail
|
||||||
|
@ -1257,7 +1259,7 @@ def hintExclusions(world, clear_cache=False):
|
||||||
world.hint_exclusions = []
|
world.hint_exclusions = []
|
||||||
|
|
||||||
for location in world.get_locations():
|
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.hint_exclusions.append(location.name)
|
||||||
|
|
||||||
world_location_names = [
|
world_location_names = [
|
||||||
|
|
Loading…
Reference in New Issue