add seed_name to multidata and RoomInfo
This commit is contained in:
parent
764e6e7926
commit
2df7e4e537
4
Main.py
4
Main.py
|
@ -417,7 +417,8 @@ def main(args, seed=None):
|
|||
for player in world.alttp_player_ids:
|
||||
rom_futures.append(pool.submit(_gen_rom, team, player))
|
||||
for player in world.factorio_player_ids:
|
||||
mod_futures.append(pool.submit(generate_mod, world, player))
|
||||
mod_futures.append(pool.submit(generate_mod, world, player,
|
||||
str(args.outputname if args.outputname else world.seed)))
|
||||
|
||||
def get_entrance_to_region(region: Region):
|
||||
for entrance in region.entrances:
|
||||
|
@ -524,6 +525,7 @@ def main(args, seed=None):
|
|||
"version": tuple(_version_tuple),
|
||||
"tags": ["AP"],
|
||||
"minimum_versions": minimum_versions,
|
||||
"seed_name": str(args.outputname if args.outputname else world.seed)
|
||||
}), 9)
|
||||
|
||||
with open(output_path('%s.archipelago' % outfilebase), 'wb') as f:
|
||||
|
|
|
@ -112,6 +112,7 @@ class Context(Node):
|
|||
self.tags = ['AP']
|
||||
self.games = {}
|
||||
self.minimum_client_versions: typing.Dict[int, Utils.Version] = {}
|
||||
self.seed_name = ""
|
||||
|
||||
def load(self, multidatapath: str, use_embedded_server_options: bool = False):
|
||||
with open(multidatapath, 'rb') as f:
|
||||
|
@ -141,7 +142,7 @@ class Context(Node):
|
|||
for team, names in enumerate(decoded_obj['names']):
|
||||
for player, name in enumerate(names, 1):
|
||||
self.player_names[(team, player)] = name
|
||||
|
||||
self.seed_name = decoded_obj["seed_name"]
|
||||
self.connect_names = decoded_obj['connect_names']
|
||||
self.remote_items = decoded_obj['remote_items']
|
||||
self.locations = decoded_obj['locations']
|
||||
|
@ -152,6 +153,7 @@ class Context(Node):
|
|||
server_options = decoded_obj.get("server_options", {})
|
||||
self._set_options(server_options)
|
||||
|
||||
|
||||
def get_players_package(self):
|
||||
return [NetworkPlayer(t, p, self.get_aliased_name(t, p), n) for (t, p), n in self.player_names.items()]
|
||||
|
||||
|
@ -367,7 +369,8 @@ async def on_client_connected(ctx: Context, client: Client):
|
|||
'remaining_mode': ctx.remaining_mode,
|
||||
'hint_cost': ctx.hint_cost,
|
||||
'location_check_points': ctx.location_check_points,
|
||||
'datapackage_version': network_data_package["version"]
|
||||
'datapackage_version': network_data_package["version"],
|
||||
'seed_name': ctx.seed_name
|
||||
}])
|
||||
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ def main(args=None, callback=ERmain):
|
|||
seed = get_seed(args.seed)
|
||||
random.seed(seed)
|
||||
|
||||
seedname = "M" + (f"{random.randint(0, pow(10, seeddigits) - 1)}".zfill(seeddigits))
|
||||
print(f"Generating mystery for {args.multi} player{'s' if args.multi > 1 else ''}, {seedname} Seed {seed}")
|
||||
seedname = f"{random.randint(0, pow(10, seeddigits) - 1)}".zfill(seeddigits)
|
||||
print(f"Generating for {args.multi} player{'s' if args.multi > 1 else ''}, {seedname} Seed {seed}")
|
||||
|
||||
if args.race:
|
||||
random.seed() # reset to time-based random source
|
||||
|
|
2
Utils.py
2
Utils.py
|
@ -12,7 +12,7 @@ class Version(typing.NamedTuple):
|
|||
minor: int
|
||||
build: int
|
||||
|
||||
__version__ = "0.0.3"
|
||||
__version__ = "0.0.4"
|
||||
_version_tuple = tuplize_version(__version__)
|
||||
|
||||
import builtins
|
||||
|
|
|
@ -27,7 +27,7 @@ base_info = {
|
|||
"factorio_version": "1.1"
|
||||
}
|
||||
|
||||
def generate_mod(world: MultiWorld, player: int):
|
||||
def generate_mod(world: MultiWorld, player: int, seedname: str):
|
||||
global template, locale_template
|
||||
with template_load_lock:
|
||||
if not template:
|
||||
|
@ -41,7 +41,7 @@ def generate_mod(world: MultiWorld, player: int):
|
|||
for location in world.get_filled_locations(player):
|
||||
if not location.name.startswith("recipe-"): # introduce this as a new location property?
|
||||
locations.append((location.name, location.item.name, location.item.player))
|
||||
mod_name = f"archipelago-client-{world.seed}-{player}"
|
||||
mod_name = f"archipelago-client-{seedname}-{player}"
|
||||
tech_cost = {0: 0.1,
|
||||
1: 0.25,
|
||||
2: 0.5,
|
||||
|
|
|
@ -76,9 +76,6 @@ def get_shapes(world: MultiWorld, player: int) -> Dict[str, List[str]]:
|
|||
# https://www.wolframalpha.com/input/?i=x+=+1/2+(n++++1)+(2++++n)+solve+for+n
|
||||
import math
|
||||
slice_size = int(0.5*(math.sqrt(8*len(tech_names)+1)-3))
|
||||
|
||||
import logging
|
||||
logging.info(slice_size)
|
||||
tech_names.sort()
|
||||
world.random.shuffle(tech_names)
|
||||
tech_names.sort(key=lambda tech_name: len(technology_table[tech_name].ingredients))
|
||||
|
|
Loading…
Reference in New Issue