Skip to content

Commit

Permalink
generate coordinates earlier so we can write them to the spoiler log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ixrec committed Feb 5, 2024
1 parent a97c43e commit c66f3f4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions worlds/outer_wilds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List
import json
from typing import List, TextIO

from BaseClasses import Tutorial
from worlds.AutoWorld import WebWorld, World
Expand Down Expand Up @@ -33,6 +34,12 @@ class OuterWildsWorld(World):
# but the server is allowed to be a little older
required_server_version = (0, 4, 3)

eotu_coordinates = 'vanilla'

def generate_early(self) -> None:
self.eotu_coordinates = generate_random_coordinates(self.random) \
if self.options.randomize_coordinates else "vanilla"

# members and methods implemented by Items.py and items.jsonc

item_name_to_id = all_non_event_items_table
Expand Down Expand Up @@ -87,9 +94,17 @@ def set_rules(self) -> None:

def fill_slot_data(self):
slot_data = self.options.as_dict("goal", "death_link", "logsanity")
slot_data["eotu_coordinates"] = generate_random_coordinates(self.random) \
if self.options.randomize_coordinates else "vanilla"
slot_data["eotu_coordinates"] = self.eotu_coordinates
# Archipelago does not yet have apworld versions (data_version is deprecated),
# so we have to roll our own with slot_data for the time being
slot_data["apworld_version"] = "0.2.0-dev"
return slot_data

def write_spoiler(self, spoiler_handle: TextIO) -> None:
if self.eotu_coordinates != 'vanilla':
spoiler_handle.write('\n\nRandomized Eye of the Universe Coordinates:'
'\n(0-5 are the points of the hexagon, starting at '
'the rightmost point and going counterclockwise)'
'\n\n%s\n%s\n%s\n\n' % (json.dumps(self.eotu_coordinates[0]),
json.dumps(self.eotu_coordinates[1]),
json.dumps(self.eotu_coordinates[2])))

0 comments on commit c66f3f4

Please sign in to comment.