From 18c4b4b1fe0f61a31a35230f2e687aeb8be4e803 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 16 Feb 2023 20:22:14 +0100 Subject: [PATCH] Subnautica: move code to be a better example --- worlds/subnautica/__init__.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/worlds/subnautica/__init__.py b/worlds/subnautica/__init__.py index b70e4acb..341af5a5 100644 --- a/worlds/subnautica/__init__.py +++ b/worlds/subnautica/__init__.py @@ -70,23 +70,29 @@ class SubnauticaWorld(World): [creature+Creatures.suffix for creature in self.creatures_to_scan]) ] - # refer to Rules.py - set_rules = set_rules - - def generate_basic(self): # Link regions self.multiworld.get_entrance("Lifepod 5", self.player).connect(self.multiworld.get_region("Planet 4546B", self.player)) + 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" + + # refer to Rules.py + set_rules = set_rules + + def create_items(self): # Generate item pool pool = [] - neptune_launch_platform = None extras = self.multiworld.creature_scans[self.player].value valuable = self.multiworld.item_pool[self.player] == Options.ItemPool.option_valuable for item in item_table.values(): for i in range(item["count"]): subnautica_item = self.create_item(item["name"]) if item["name"] == "Neptune Launch Platform": - neptune_launch_platform = subnautica_item + self.multiworld.get_location("Aurora - Captain Data Terminal", self.player).place_locked_item( + subnautica_item) elif valuable and ItemClassification.filler == item["classification"]: extras += 1 else: @@ -100,15 +106,6 @@ class SubnauticaWorld(World): self.multiworld.itempool += pool - # Victory item - self.multiworld.get_location("Aurora - Captain Data Terminal", self.player).place_locked_item( - neptune_launch_platform) - 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" - def fill_slot_data(self) -> Dict[str, Any]: goal: Options.Goal = self.multiworld.goal[self.player] item_pool: Options.ItemPool = self.multiworld.item_pool[self.player]