Open Breaking changes

This commit is contained in:
Fabian Dill 2020-10-18 23:07:48 +02:00
parent 2ae5f316dc
commit 94dafa3c55
4 changed files with 7 additions and 11 deletions

View File

@ -916,7 +916,7 @@ async def process_server_cmd(ctx: Context, cmd, args):
def get_tags(ctx: Context):
tags = ['Berserker']
tags = ['AP']
if ctx.found_items:
tags.append('FoundItems')
return tags

View File

@ -102,7 +102,7 @@ class Context(Node):
self.auto_save_interval = 60 # in seconds
self.auto_saver_thread = None
self.save_dirty = False
self.tags = ['Berserker']
self.tags = ['AP']
def load(self, multidatapath: str, use_embedded_server_options: bool = False):
with open(multidatapath, 'rb') as f:
@ -302,14 +302,10 @@ def notify_hints(ctx: Context, team: int, hints: typing.List[Utils.Hint]):
texts = [['Print', format_hint(ctx, team, hint)] for hint in hints]
for _, text in texts:
logging.info("Notice (Team #%d): %s" % (team + 1, text))
texts = json.dumps(texts)
for client in ctx.endpoints:
if client.auth and client.team == team:
if "Berserker" in client.tags and client.version >= [2, 2, 1]:
payload = cmd
else:
payload = texts
asyncio.create_task(ctx.send_json_msgs(client, payload))
asyncio.create_task(ctx.send_json_msgs(client, cmd))
def update_aliases(ctx: Context, team: int, client: typing.Optional[Client] = None):
@ -979,7 +975,7 @@ async def process_client_cmd(ctx: Context, client: Client, cmd, args):
client.name = ctx.player_names[(team, slot)]
client.team = team
client.slot = slot
if ctx.compatibility == 1 and "Berserker" not in args.get('tags', Client.tags):
if "AP" not in args.get('tags', Client.tags):
errors.add('IncompatibleVersion')
elif ctx.compatibility == 0 and args.get('version', Client.version) != list(_version_tuple):
errors.add('IncompatibleVersion')

View File

@ -6,7 +6,7 @@ def tuplize_version(version: str) -> typing.Tuple[int, ...]:
return tuple(int(piece, 10) for piece in version.split("."))
__version__ = "3.2.1"
__version__ = "1.0.0"
_version_tuple = tuplize_version(__version__)
import os

View File

@ -50,7 +50,7 @@ class WebHostContext(Context):
super(WebHostContext, self).__init__("", 0, "", 1, 40, True, "enabled", "enabled", 0, 2)
self.main_loop = asyncio.get_running_loop()
self.video = {}
self.tags = ["Berserker", "WebHost"]
self.tags = ["AP", "WebHost"]
def listen_to_db_commands(self):
cmdprocessor = DBCommandProcessor(self)