* Game end detection - Detect if the player finished their game, and announce it accordingly.
* Add a client side /slow_mode option. (allows to delay receiving items when a massive amount of them come in, like from a forfeit.)
This commit is contained in:
caitsith2
2020-04-24 20:07:28 -07:00
parent 37b79294be
commit b3c7789596
2 changed files with 60 additions and 3 deletions

View File

@@ -83,6 +83,7 @@ class Context:
self.item_cheat = item_cheat
self.running = True
self.client_activity_timers = {}
self.client_finished_game = {}
self.commandprocessor = ServerCommandProcessor(self)
def get_save(self) -> dict:
@@ -737,6 +738,13 @@ async def process_client_cmd(ctx: Context, client: Client, cmd, args):
return
client.tags = args
elif cmd == 'GameFinished':
if (client.team, client.slot) not in ctx.client_finished_game:
notify_all(ctx, client.name + ' has finished the game.')
print(client.name + ' has finished the game.')
ctx.client_finished_game[client.team, client.slot] = True
# TODO: Add auto-forfeit code here
if cmd == 'Say':
if type(args) is not str or not args.isprintable():
await send_msgs(client, [['InvalidArguments', 'Say']])