Subnautica: move code to be a better example

This commit is contained in:
Fabian Dill 2023-02-16 20:22:14 +01:00 committed by Fabian Dill
parent a85ca9cc87
commit 18c4b4b1fe
1 changed files with 12 additions and 15 deletions

View File

@ -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]