mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Subnautica: cleanup pass (#2293)
This commit is contained in:
@@ -6,12 +6,12 @@ from typing import List, Dict, Any, cast
|
||||
|
||||
from BaseClasses import Region, Entrance, Location, Item, Tutorial, ItemClassification
|
||||
from worlds.AutoWorld import World, WebWorld
|
||||
from . import Items
|
||||
from . import Locations
|
||||
from . import Creatures
|
||||
from . import Options
|
||||
from .Items import item_table, group_items, items_by_type, ItemType
|
||||
from .Rules import set_rules
|
||||
from . import items
|
||||
from . import locations
|
||||
from . import creatures
|
||||
from . import options
|
||||
from .items import item_table, group_items, items_by_type, ItemType
|
||||
from .rules import set_rules
|
||||
|
||||
logger = logging.getLogger("Subnautica")
|
||||
|
||||
@@ -27,8 +27,8 @@ class SubnaticaWeb(WebWorld):
|
||||
)]
|
||||
|
||||
|
||||
all_locations = {data["name"]: loc_id for loc_id, data in Locations.location_table.items()}
|
||||
all_locations.update(Creatures.creature_locations)
|
||||
all_locations = {data["name"]: loc_id for loc_id, data in locations.location_table.items()}
|
||||
all_locations.update(creatures.creature_locations)
|
||||
|
||||
|
||||
class SubnauticaWorld(World):
|
||||
@@ -40,9 +40,9 @@ class SubnauticaWorld(World):
|
||||
game = "Subnautica"
|
||||
web = SubnaticaWeb()
|
||||
|
||||
item_name_to_id = {data.name: item_id for item_id, data in Items.item_table.items()}
|
||||
item_name_to_id = {data.name: item_id for item_id, data in items.item_table.items()}
|
||||
location_name_to_id = all_locations
|
||||
option_definitions = Options.options
|
||||
option_definitions = options.option_definitions
|
||||
|
||||
data_version = 10
|
||||
required_client_version = (0, 4, 1)
|
||||
@@ -50,37 +50,37 @@ class SubnauticaWorld(World):
|
||||
creatures_to_scan: List[str]
|
||||
|
||||
def generate_early(self) -> None:
|
||||
if self.multiworld.early_seaglide[self.player]:
|
||||
if self.options.early_seaglide:
|
||||
self.multiworld.local_early_items[self.player]["Seaglide Fragment"] = 2
|
||||
|
||||
scan_option: Options.AggressiveScanLogic = self.multiworld.creature_scan_logic[self.player]
|
||||
scan_option: options.AggressiveScanLogic = self.options.creature_scan_logic
|
||||
creature_pool = scan_option.get_pool()
|
||||
|
||||
self.multiworld.creature_scans[self.player].value = min(
|
||||
self.options.creature_scans.value = min(
|
||||
len(creature_pool),
|
||||
self.multiworld.creature_scans[self.player].value
|
||||
self.options.creature_scans.value
|
||||
)
|
||||
|
||||
self.creatures_to_scan = self.multiworld.random.sample(
|
||||
creature_pool, self.multiworld.creature_scans[self.player].value)
|
||||
self.creatures_to_scan = self.random.sample(
|
||||
creature_pool, self.options.creature_scans.value)
|
||||
|
||||
def create_regions(self):
|
||||
self.multiworld.regions += [
|
||||
self.create_region("Menu", None, ["Lifepod 5"]),
|
||||
self.create_region("Planet 4546B",
|
||||
Locations.events +
|
||||
[location["name"] for location in Locations.location_table.values()] +
|
||||
[creature+Creatures.suffix for creature in self.creatures_to_scan])
|
||||
locations.events +
|
||||
[location["name"] for location in locations.location_table.values()] +
|
||||
[creature + creatures.suffix for creature in self.creatures_to_scan])
|
||||
]
|
||||
|
||||
# Link regions
|
||||
self.multiworld.get_entrance("Lifepod 5", self.player).connect(self.multiworld.get_region("Planet 4546B", self.player))
|
||||
|
||||
for event in Locations.events:
|
||||
for event in locations.events:
|
||||
self.multiworld.get_location(event, self.player).place_locked_item(
|
||||
SubnauticaItem(event, ItemClassification.progression, None, player=self.player))
|
||||
# make the goal event the victory "item"
|
||||
self.multiworld.get_location(self.multiworld.goal[self.player].get_event_name(), self.player).item.name = "Victory"
|
||||
self.multiworld.get_location(self.options.goal.get_event_name(), self.player).item.name = "Victory"
|
||||
|
||||
# refer to Rules.py
|
||||
set_rules = set_rules
|
||||
@@ -88,7 +88,7 @@ class SubnauticaWorld(World):
|
||||
def create_items(self):
|
||||
# Generate item pool
|
||||
pool: List[SubnauticaItem] = []
|
||||
extras = self.multiworld.creature_scans[self.player].value
|
||||
extras = self.options.creature_scans.value
|
||||
|
||||
grouped = set(itertools.chain.from_iterable(group_items.values()))
|
||||
|
||||
@@ -139,17 +139,15 @@ class SubnauticaWorld(World):
|
||||
self.multiworld.itempool += pool
|
||||
|
||||
def fill_slot_data(self) -> Dict[str, Any]:
|
||||
goal: Options.Goal = self.multiworld.goal[self.player]
|
||||
swim_rule: Options.SwimRule = self.multiworld.swim_rule[self.player]
|
||||
vanilla_tech: List[str] = []
|
||||
|
||||
slot_data: Dict[str, Any] = {
|
||||
"goal": goal.current_key,
|
||||
"swim_rule": swim_rule.current_key,
|
||||
"goal": self.options.goal.current_key,
|
||||
"swim_rule": self.options.swim_rule.current_key,
|
||||
"vanilla_tech": vanilla_tech,
|
||||
"creatures_to_scan": self.creatures_to_scan,
|
||||
"death_link": self.multiworld.death_link[self.player].value,
|
||||
"free_samples": self.multiworld.free_samples[self.player].value,
|
||||
"death_link": self.options.death_link.value,
|
||||
"free_samples": self.options.free_samples.value,
|
||||
}
|
||||
|
||||
return slot_data
|
||||
@@ -161,10 +159,10 @@ class SubnauticaWorld(World):
|
||||
item_table[item_id].classification,
|
||||
item_id, player=self.player)
|
||||
|
||||
def create_region(self, name: str, locations=None, exits=None):
|
||||
def create_region(self, name: str, region_locations=None, exits=None):
|
||||
ret = Region(name, self.player, self.multiworld)
|
||||
if locations:
|
||||
for location in locations:
|
||||
if region_locations:
|
||||
for location in region_locations:
|
||||
loc_id = self.location_name_to_id.get(location, None)
|
||||
location = SubnauticaLocation(self.player, location, loc_id, ret)
|
||||
ret.locations.append(location)
|
||||
|
Reference in New Issue
Block a user