Skip to content

Commit

Permalink
Add 'HintGame' tag, for projects like BKSudoku/APSudoku/HintMachine
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 committed Feb 24, 2024
1 parent 4c7ba36 commit 4854d5c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ async def on_client_joined(ctx: Context, client: Client):
update_client_status(ctx, client, ClientStatus.CLIENT_CONNECTED)
version_str = '.'.join(str(x) for x in client.version)

verbs = {"Tracker": "tracking", "TextOnly": "viewing"}
verbs = {"HintGame": "hinting", "Tracker": "tracking", "TextOnly": "viewing"}
for tag, verb in verbs.items():
if tag in client.tags:
final_verb = verb
Expand Down Expand Up @@ -833,7 +833,7 @@ async def on_client_left(ctx: Context, client: Client):

version_str = '.'.join(str(x) for x in client.version)

verbs = {"Tracker": "stopped tracking", "TextOnly": "stopped viewing"}
verbs = {"HintGame": "stopped hinting", "Tracker": "stopped tracking", "TextOnly": "stopped viewing"}
for tag, verb in verbs.items():
if tag in client.tags:
final_verb = verb
Expand Down Expand Up @@ -1629,7 +1629,14 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
else:
team, slot = ctx.connect_names[args['name']]
game = ctx.games[slot]
ignore_game = ("TextOnly" in args["tags"] or "Tracker" in args["tags"]) and not args.get("game")

ignore_game = False
if not args.get("game"):
for tag in args["tags"]:
if tag in {"HintGame", "TextOnly", "Tracker"}:
ignore_game = True
break

if not ignore_game and args['game'] != game:
errors.add('InvalidGame')
minver = min_client_version if ignore_game else ctx.minimum_client_versions[slot]
Expand Down

0 comments on commit 4854d5c

Please sign in to comment.