From 7fd0f1a5bf33f3d053c461406d89be6407a9a309 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 1 Sep 2021 16:46:44 +0200 Subject: [PATCH] Subnautica: implement create_item and therefore start_inventory --- worlds/ror2/__init__.py | 4 ++-- worlds/subnautica/__init__.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/worlds/ror2/__init__.py b/worlds/ror2/__init__.py index 581ef5ed..d651018f 100644 --- a/worlds/ror2/__init__.py +++ b/worlds/ror2/__init__.py @@ -20,8 +20,8 @@ class RiskOfRainWorld(World): options = ror2_options topology_present = False - item_name_to_id = {name: data for name, data in item_table.items()} - location_name_to_id = {name: data for name, data in location_table.items()} + item_name_to_id = item_table + location_name_to_id = location_table data_version = 1 forced_auto_forfeit = True diff --git a/worlds/subnautica/__init__.py b/worlds/subnautica/__init__.py index 50376a37..fbcae848 100644 --- a/worlds/subnautica/__init__.py +++ b/worlds/subnautica/__init__.py @@ -4,7 +4,7 @@ from typing import Set logger = logging.getLogger("Subnautica") from .Locations import lookup_name_to_id as locations_lookup_name_to_id -from .Items import item_table +from .Items import item_table, lookup_name_to_item from .Items import lookup_name_to_id as items_lookup_name_to_id from .Regions import create_regions @@ -34,7 +34,7 @@ class SubnauticaWorld(World): neptune_launch_platform = None for item in item_table: for i in range(item["count"]): - subnautica_item = SubnauticaItem(item["name"], item["progression"], item["id"], player = self.player) + subnautica_item = self.create_item(item["name"]) if item["name"] == "Neptune Launch Platform": neptune_launch_platform = subnautica_item else: @@ -42,26 +42,28 @@ class SubnauticaWorld(World): self.world.itempool += pool # Victory item - self.world.get_location("Aurora - Captain Data Terminal", self.player).place_locked_item(neptune_launch_platform) - self.world.get_location("Neptune Launch", self.player).place_locked_item(SubnauticaItem("Victory", True, None, player = self.player)) - + self.world.get_location("Aurora - Captain Data Terminal", self.player).place_locked_item( + neptune_launch_platform) + self.world.get_location("Neptune Launch", self.player).place_locked_item( + SubnauticaItem("Victory", True, None, player=self.player)) def set_rules(self): set_rules(self.world, self.player) - def create_regions(self): create_regions(self.world, self.player) - def generate_output(self, output_directory: str): pass - def fill_slot_data(self): slot_data = {} return slot_data + def create_item(self, name: str) -> Item: + item = lookup_name_to_item[name] + return SubnauticaItem(name, item["progression"], item["id"], player=self.player) + def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None): ret = Region(name, None, name, player)