Settings: add requires
This commit is contained in:
parent
a5bf3a8407
commit
a08d7bb1b2
|
@ -76,7 +76,7 @@ class FactorioContext(CommonContext):
|
||||||
await super(FactorioContext, self).server_auth(password_requested)
|
await super(FactorioContext, self).server_auth(password_requested)
|
||||||
|
|
||||||
await self.send_msgs([{"cmd": 'Connect',
|
await self.send_msgs([{"cmd": 'Connect',
|
||||||
'password': self.password, 'name': self.auth, 'version': Utils._version_tuple,
|
'password': self.password, 'name': self.auth, 'version': Utils.version_tuple,
|
||||||
'tags': ['AP'],
|
'tags': ['AP'],
|
||||||
'uuid': Utils.get_unique_identifier(), 'game': "Factorio"
|
'uuid': Utils.get_unique_identifier(), 'game': "Factorio"
|
||||||
}])
|
}])
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Context(CommonContext):
|
||||||
self.auth = self.rom
|
self.auth = self.rom
|
||||||
auth = base64.b64encode(self.rom).decode()
|
auth = base64.b64encode(self.rom).decode()
|
||||||
await self.send_msgs([{"cmd": 'Connect',
|
await self.send_msgs([{"cmd": 'Connect',
|
||||||
'password': self.password, 'name': auth, 'version': Utils._version_tuple,
|
'password': self.password, 'name': auth, 'version': Utils.version_tuple,
|
||||||
'tags': get_tags(self),
|
'tags': get_tags(self),
|
||||||
'uuid': Utils.get_unique_identifier(), 'game': "A Link to the Past"
|
'uuid': Utils.get_unique_identifier(), 'game': "A Link to the Past"
|
||||||
}])
|
}])
|
||||||
|
|
4
Main.py
4
Main.py
|
@ -20,7 +20,7 @@ from worlds.alttp.Dungeons import create_dungeons, fill_dungeons, fill_dungeons_
|
||||||
from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned
|
from Fill import distribute_items_restrictive, flood_items, balance_multiworld_progression, distribute_planned
|
||||||
from worlds.alttp.Shops import create_shops, ShopSlotFill, SHOP_ID_START, total_shop_slots, FillDisabledShopSlots
|
from worlds.alttp.Shops import create_shops, ShopSlotFill, SHOP_ID_START, total_shop_slots, FillDisabledShopSlots
|
||||||
from worlds.alttp.ItemPool import generate_itempool, difficulties, fill_prizes
|
from worlds.alttp.ItemPool import generate_itempool, difficulties, fill_prizes
|
||||||
from Utils import output_path, parse_player_names, get_options, __version__, _version_tuple
|
from Utils import output_path, parse_player_names, get_options, __version__, version_tuple
|
||||||
from worlds.hk import gen_hollow
|
from worlds.hk import gen_hollow
|
||||||
from worlds.hk import create_regions as hk_create_regions
|
from worlds.hk import create_regions as hk_create_regions
|
||||||
from worlds.minecraft import gen_minecraft, fill_minecraft_slot_data, generate_mc_data
|
from worlds.minecraft import gen_minecraft, fill_minecraft_slot_data, generate_mc_data
|
||||||
|
@ -557,7 +557,7 @@ def main(args, seed=None):
|
||||||
"er_hint_data": er_hint_data,
|
"er_hint_data": er_hint_data,
|
||||||
"precollected_items": precollected_items,
|
"precollected_items": precollected_items,
|
||||||
"precollected_hints": precollected_hints,
|
"precollected_hints": precollected_hints,
|
||||||
"version": tuple(_version_tuple),
|
"version": tuple(version_tuple),
|
||||||
"tags": ["AP"],
|
"tags": ["AP"],
|
||||||
"minimum_versions": minimum_versions,
|
"minimum_versions": minimum_versions,
|
||||||
"seed_name": world.seed_name
|
"seed_name": world.seed_name
|
||||||
|
|
|
@ -30,7 +30,7 @@ from worlds import network_data_package, lookup_any_item_id_to_name, lookup_any_
|
||||||
lookup_any_location_id_to_name, lookup_any_location_name_to_id
|
lookup_any_location_id_to_name, lookup_any_location_name_to_id
|
||||||
import Utils
|
import Utils
|
||||||
from Utils import get_item_name_from_id, get_location_name_from_id, \
|
from Utils import get_item_name_from_id, get_location_name_from_id, \
|
||||||
_version_tuple, restricted_loads, Version
|
version_tuple, restricted_loads, Version
|
||||||
from NetUtils import Node, Endpoint, ClientStatus, NetworkItem, decode, NetworkPlayer
|
from NetUtils import Node, Endpoint, ClientStatus, NetworkItem, decode, NetworkPlayer
|
||||||
|
|
||||||
colorama.init()
|
colorama.init()
|
||||||
|
@ -136,9 +136,9 @@ class Context(Node):
|
||||||
def _load(self, decoded_obj: dict, use_embedded_server_options: bool):
|
def _load(self, decoded_obj: dict, use_embedded_server_options: bool):
|
||||||
|
|
||||||
mdata_ver = decoded_obj["minimum_versions"]["server"]
|
mdata_ver = decoded_obj["minimum_versions"]["server"]
|
||||||
if mdata_ver > Utils._version_tuple:
|
if mdata_ver > Utils.version_tuple:
|
||||||
raise RuntimeError(f"Supplied Multidata (.archipelago) requires a server of at least version {mdata_ver},"
|
raise RuntimeError(f"Supplied Multidata (.archipelago) requires a server of at least version {mdata_ver},"
|
||||||
f"however this server is of version {Utils._version_tuple}")
|
f"however this server is of version {Utils.version_tuple}")
|
||||||
clients_ver = decoded_obj["minimum_versions"].get("clients", {})
|
clients_ver = decoded_obj["minimum_versions"].get("clients", {})
|
||||||
self.minimum_client_versions = {}
|
self.minimum_client_versions = {}
|
||||||
for player, version in clients_ver.items():
|
for player, version in clients_ver.items():
|
||||||
|
@ -379,7 +379,7 @@ async def on_client_connected(ctx: Context, client: Client):
|
||||||
# tags are for additional features in the communication.
|
# tags are for additional features in the communication.
|
||||||
# Name them by feature or fork, as you feel is appropriate.
|
# Name them by feature or fork, as you feel is appropriate.
|
||||||
'tags': ctx.tags,
|
'tags': ctx.tags,
|
||||||
'version': Utils._version_tuple,
|
'version': Utils.version_tuple,
|
||||||
'forfeit_mode': ctx.forfeit_mode,
|
'forfeit_mode': ctx.forfeit_mode,
|
||||||
'remaining_mode': ctx.remaining_mode,
|
'remaining_mode': ctx.remaining_mode,
|
||||||
'hint_cost': ctx.hint_cost,
|
'hint_cost': ctx.hint_cost,
|
||||||
|
@ -1011,7 +1011,7 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
|
||||||
errors.add('IncompatibleVersion')
|
errors.add('IncompatibleVersion')
|
||||||
|
|
||||||
# only exact version match allowed
|
# only exact version match allowed
|
||||||
if ctx.compatibility == 0 and args['version'] != _version_tuple:
|
if ctx.compatibility == 0 and args['version'] != version_tuple:
|
||||||
errors.add('IncompatibleVersion')
|
errors.add('IncompatibleVersion')
|
||||||
if errors:
|
if errors:
|
||||||
logging.info(f"A client connection was refused due to: {errors}")
|
logging.info(f"A client connection was refused due to: {errors}")
|
||||||
|
|
18
Mystery.py
18
Mystery.py
|
@ -13,7 +13,7 @@ from worlds.generic import PlandoItem, PlandoConnection
|
||||||
|
|
||||||
ModuleUpdate.update()
|
ModuleUpdate.update()
|
||||||
|
|
||||||
from Utils import parse_yaml
|
from Utils import parse_yaml, version_tuple, __version__, tuplize_version
|
||||||
from worlds.alttp.EntranceRandomizer import parse_arguments
|
from worlds.alttp.EntranceRandomizer import parse_arguments
|
||||||
from Main import main as ERmain
|
from Main import main as ERmain
|
||||||
from Main import get_seed, seeddigits
|
from Main import get_seed, seeddigits
|
||||||
|
@ -453,6 +453,22 @@ def get_plando_bosses(boss_shuffle: str, plando_options: typing.Set[str]) -> str
|
||||||
|
|
||||||
|
|
||||||
def roll_settings(weights: dict, plando_options: typing.Set[str] = frozenset(("bosses",))):
|
def roll_settings(weights: dict, plando_options: typing.Set[str] = frozenset(("bosses",))):
|
||||||
|
requirements = weights.get("requires", {})
|
||||||
|
if requirements:
|
||||||
|
version = requirements.get("version", __version__)
|
||||||
|
if tuplize_version(version) > version_tuple:
|
||||||
|
raise Exception(f"Settings reports required version of generator is at least {version}, "
|
||||||
|
f"however generator is of version {__version__}")
|
||||||
|
required_plando_options = requirements.get("plando", "")
|
||||||
|
required_plando_options = set(option.strip() for option in required_plando_options.split(","))
|
||||||
|
required_plando_options -= plando_options
|
||||||
|
if required_plando_options:
|
||||||
|
if len(required_plando_options) == 1:
|
||||||
|
raise Exception(f"Settings reports required plando module {', '.join(required_plando_options)}, "
|
||||||
|
f"which is not enabled.")
|
||||||
|
else:
|
||||||
|
raise Exception(f"Settings reports required plando modules {', '.join(required_plando_options)}, "
|
||||||
|
f"which are not enabled.")
|
||||||
if "pre_rolled" in weights:
|
if "pre_rolled" in weights:
|
||||||
pre_rolled = weights["pre_rolled"]
|
pre_rolled = weights["pre_rolled"]
|
||||||
|
|
||||||
|
|
4
Utils.py
4
Utils.py
|
@ -12,8 +12,8 @@ class Version(typing.NamedTuple):
|
||||||
minor: int
|
minor: int
|
||||||
build: int
|
build: int
|
||||||
|
|
||||||
__version__ = "0.1.2"
|
__version__ = "0.1.3"
|
||||||
_version_tuple = tuplize_version(__version__)
|
version_tuple = tuplize_version(__version__)
|
||||||
|
|
||||||
import builtins
|
import builtins
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -27,6 +27,8 @@ game:
|
||||||
A Link to the Past: 1
|
A Link to the Past: 1
|
||||||
Factorio: 1
|
Factorio: 1
|
||||||
Minecraft: 1
|
Minecraft: 1
|
||||||
|
requires:
|
||||||
|
version: 0.1.3 # Version of Archipelago required for this yaml to work as expected.
|
||||||
# Shared Options supported by all games:
|
# Shared Options supported by all games:
|
||||||
accessibility:
|
accessibility:
|
||||||
items: 0 # Guarantees you will be able to acquire all items, but you may not be able to access all locations
|
items: 0 # Guarantees you will be able to acquire all items, but you may not be able to access all locations
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -48,10 +48,10 @@ def manifest_creation(folder):
|
||||||
path = os.path.join(dirpath, filename)
|
path = os.path.join(dirpath, filename)
|
||||||
hashes[os.path.relpath(path, start=folder)] = pool.submit(_threaded_hash, path)
|
hashes[os.path.relpath(path, start=folder)] = pool.submit(_threaded_hash, path)
|
||||||
import json
|
import json
|
||||||
from Utils import _version_tuple
|
from Utils import version_tuple
|
||||||
manifest = {"buildtime": buildtime.isoformat(sep=" ", timespec="seconds"),
|
manifest = {"buildtime": buildtime.isoformat(sep=" ", timespec="seconds"),
|
||||||
"hashes": {path: hash.result() for path, hash in hashes.items()},
|
"hashes": {path: hash.result() for path, hash in hashes.items()},
|
||||||
"version": _version_tuple}
|
"version": version_tuple}
|
||||||
json.dump(manifest, open(manifestpath, "wt"), indent=4)
|
json.dump(manifest, open(manifestpath, "wt"), indent=4)
|
||||||
print("Created Manifest")
|
print("Created Manifest")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue