mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Changes
* 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:
@@ -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']])
|
||||
|
Reference in New Issue
Block a user