mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: create the per world random object in the world constructor (#2083)
* Core: create the per world random object in the world constructor * remove the check that multiworld exists * add a deprecation warning to per_slot_randoms * move random import and fix conflicts * assert worlds don't exist before setting the multiworld seed * fix the dlcq and sdv tests * actually use the seed
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import hashlib
|
||||
import logging
|
||||
import pathlib
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -299,6 +300,8 @@ class World(metaclass=AutoWorldRegister):
|
||||
assert multiworld is not None
|
||||
self.multiworld = multiworld
|
||||
self.player = player
|
||||
self.random = random.Random(multiworld.random.getrandbits(64))
|
||||
multiworld.per_slot_randoms[player] = self.random
|
||||
|
||||
def __getattr__(self, item: str) -> Any:
|
||||
if item == "settings":
|
||||
|
||||
@@ -37,8 +37,7 @@ def setup_dlc_quest_solo_multiworld(test_options=None, seed=None, _cache: Dict[F
|
||||
if frozen_options in _cache:
|
||||
return _cache[frozen_options]
|
||||
|
||||
multiworld = setup_base_solo_multiworld(DLCqworld, ())
|
||||
multiworld.set_seed(seed)
|
||||
multiworld = setup_base_solo_multiworld(DLCqworld, (), seed=seed)
|
||||
# print(f"Seed: {multiworld.seed}") # Uncomment to print the seed for every test
|
||||
args = Namespace()
|
||||
for name, option in DLCqworld.options_dataclass.type_hints.items():
|
||||
|
||||
@@ -124,8 +124,7 @@ def setup_solo_multiworld(test_options=None, seed=None,
|
||||
if frozen_options in _cache:
|
||||
return _cache[frozen_options]
|
||||
|
||||
multiworld = setup_base_solo_multiworld(StardewValleyWorld, ())
|
||||
multiworld.set_seed(seed)
|
||||
multiworld = setup_base_solo_multiworld(StardewValleyWorld, (), seed=seed)
|
||||
# print(f"Seed: {multiworld.seed}") # Uncomment to print the seed for every test
|
||||
args = Namespace()
|
||||
for name, option in StardewValleyWorld.options_dataclass.type_hints.items():
|
||||
|
||||
Reference in New Issue
Block a user