Skip to content

Commit

Permalink
Zillion: remove test detection hack (ArchipelagoMW#2287)
Browse files Browse the repository at this point in the history
  • Loading branch information
beauxq authored and Jouramie committed Feb 28, 2024
1 parent c686c1f commit 02ec140
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions worlds/zillion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from zilliandomizer.logic_components.items import RESCUE, items as zz_items, Item as ZzItem
from zilliandomizer.logic_components.locations import Location as ZzLocation, Req
from zilliandomizer.options import Chars
from zilliandomizer.patch import detect_test

from ..AutoWorld import World, WebWorld

Expand Down Expand Up @@ -151,9 +150,7 @@ def generate_early(self) -> None:

self._item_counts = item_counts

rom_dir_name = "" if detect_test() else os.path.dirname(get_base_rom_path())
with redirect_stdout(self.lsi): # type: ignore
self.zz_system.make_patcher(rom_dir_name)
self.zz_system.make_randomizer(zz_op)

self.zz_system.seed(self.multiworld.seed)
Expand Down Expand Up @@ -323,6 +320,8 @@ def finalize_item_locations(self) -> None:
"""
sync zilliandomizer item locations with AP item locations
"""
rom_dir_name = os.path.dirname(get_base_rom_path())
self.zz_system.make_patcher(rom_dir_name)
assert self.zz_system.randomizer and self.zz_system.patcher, "generate_early hasn't been called"
zz_options = self.zz_system.randomizer.options

Expand Down Expand Up @@ -373,7 +372,9 @@ def finalize_item_locations(self) -> None:
zz_options.start_char,
self.zz_system.randomizer.loc_name_2_pretty)
self.slot_data_ready.set()
zz_patcher.all_fixes_and_options(zz_options)
rm = self.zz_system.resource_managers
assert rm, "missing resource_managers from generate_early"
zz_patcher.all_fixes_and_options(zz_options, rm)
zz_patcher.set_external_item_interface(zz_options.start_char, zz_options.max_level)
zz_patcher.set_multiworld_items(multi_items)
game_id = self.multiworld.player_name[self.player].encode() + b'\x00' + self.multiworld.seed_name[-6:].encode()
Expand All @@ -384,7 +385,7 @@ def generate_output(self, output_directory: str) -> None:
If you need any last-second randomization, use MultiWorld.per_slot_randoms[slot] instead."""
self.finalize_item_locations()

assert self.zz_system.patcher, "didn't get patcher from generate_early"
assert self.zz_system.patcher, "didn't get patcher from finalize_item_locations"
# original_rom_bytes = self.zz_patcher.rom
patched_rom_bytes = self.zz_system.patcher.get_patched_bytes()

Expand Down Expand Up @@ -415,12 +416,12 @@ def fill_slot_data(self) -> Dict[str, Any]: # json of WebHostLib.models.Slot
# TODO: tell client which canisters are keywords
# so it can open and get those when restoring doors

zz_patcher = self.zz_system.patcher
assert zz_patcher, "didn't get patcher from generate_early"
assert self.zz_system.randomizer, "didn't get randomizer from generate_early"

rescues: Dict[str, Any] = {}
self.slot_data_ready.wait()
zz_patcher = self.zz_system.patcher
assert zz_patcher, "didn't get patcher from generate_output"
for i in (0, 1):
if i in zz_patcher.rescue_locations:
ri = zz_patcher.rescue_locations[i]
Expand Down
2 changes: 1 addition & 1 deletion worlds/zillion/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
zilliandomizer @ git+https://github.com/beauxq/zilliandomizer@d7122bcbeda40da5db26d60fad06246a1331706f#0.5.4
zilliandomizer @ git+https://github.com/beauxq/zilliandomizer@ae00a4b186be897c7cfaf429a0e0ff83c4ecf28c#0.6.0
typing-extensions>=4.7, <5

0 comments on commit 02ec140

Please sign in to comment.