From 612e808702685a3cfe5a7db81921c8b60c32e7ff Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Fri, 11 Aug 2017 00:57:58 +0200 Subject: [PATCH] Add !mp start force, start game even for non-ready players, check if everyone is ready in !mp start --- constants/fokabotCommands.py | 11 ++++++++++- objects/match.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/constants/fokabotCommands.py b/constants/fokabotCommands.py index 4900508..5d0ee42 100644 --- a/constants/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -840,6 +840,7 @@ def multiplayer(fro, chan, message): def mpClearHost(): matchID = getMatchIDFromChannel(chan) glob.matches.matches[matchID].removeHost() + return "Host has been removed from this match" def mpStart(): def _start(): @@ -865,12 +866,20 @@ def multiplayer(fro, chan, message): else: startTime = int(message[1]) + force = False if len(message) < 3 else message[2].lower() == "force" _match = glob.matches.matches[getMatchIDFromChannel(chan)] # Force everyone to ready + someoneNotReady = False for i, slot in enumerate(_match.slots): if slot.status != slotStatuses.READY and slot.user is not None: - _match.toggleSlotReady(i) + someoneNotReady = True + if force: + _match.toggleSlotReady(i) + + if someoneNotReady and not force: + return "Some users aren't ready yet. Use '!mp start force' if you want to start the match, " \ + "even with non-ready players." if startTime == 0: _start() diff --git a/objects/match.py b/objects/match.py index 7df84fa..2737abe 100644 --- a/objects/match.py +++ b/objects/match.py @@ -739,7 +739,7 @@ class match: # Set playing to ready players and set load, skip and complete to False # Make clients join playing stream for i in range(0, 16): - if (self.slots[i].status & slotStatuses.READY) > 0 and self.slots[i].user in glob.tokens.tokens: + if self.slots[i].user in glob.tokens.tokens: self.slots[i].status = slotStatuses.PLAYING self.slots[i].loaded = False self.slots[i].skip = False