def end_warmup(self): '''Ends the current Warmup Round''' # Is Warmup Round currently active? if not info.name in PriorityAddon: # If not, there is no need to end the Warmup Round return # Send stop command to repeat loop self.repeat.stop() # Send hudhint to players that Warmup has ended hudhint('#human', self.message) # Remove Priority Addons self.priorities.clear() # Reset the number of extensions self.extensions = 0 # Reset mp_freezetime mp_freezetime.set(self.freezetime) # Execute the End Warmup Round cfg file es.mexec('gungame51/' + str(warmup_end_file)) # Restart the game es.server.queuecmd('mp_restartgame 1') # Set all living players godmode value to True self.set_all_players_godmode(True) # After a 1 second delay, clean up this Warmup Round delayed(1, self.clean_up)
def end_warmup(self): """Ends the current Warmup Round""" # Is Warmup Round currently active? if not info.name in PriorityAddon: # If not, there is no need to end the Warmup Round return # Send stop command to repeat loop self.repeat.stop() # Send hudhint to players that Warmup has ended hudhint("#human", self.message) # Remove Priority Addons self.priorities.clear() # Reset the number of extensions self.extensions = 0 # Reset mp_freezetime mp_freezetime.set(self.freezetime) # Execute the End Warmup Round cfg file es.mexec("gungame51/" + str(warmup_end_file)) # Restart the game es.server.queuecmd("mp_restartgame 1") # Set all living players godmode value to True self.set_all_players_godmode(True) # After a 1 second delay, clean up this Warmup Round delayed(1, self.clean_up)
def voteCountDown(): ggRepeat = repeat.find('gg_map_vote') if not ggRepeat: return timeleft = ggRepeat['remaining'] # Stop the vote ? if timeleft == 0: voteEnd() return votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values())) voteInfo = "" mapsAdded = 0 # For the map with the most votes to the least sortItems = [] for map in mapVoteOptions.items(): sortItems.append((map[0], len(map[1]))) for map in sorted(sortItems, key=itemgetter(1), reverse=True): # Add up to three maps voteInfo += langstring('MapVotes', tokens={ 'map': map[0], 'votes': map[1] }) mapsAdded += 1 if mapsAdded >= 3: break # Should we play the countdown beep if timeleft <= 5: for userid in getUseridList('#human'): Player(userid).playsound('countDownBeep') # Show the singular hudhint and stop here if timeleft == 1: hudhint( '#human', 'Countdown_Singular', { 'time': timeleft, 'voteInfo': voteInfo, 'votes': votes, 'totalVotes': len(voteUserids) }) return # Show the normal hudhint hudhint( '#human', 'Countdown_Plural', { 'time': timeleft, 'voteInfo': voteInfo, 'votes': votes, 'totalVotes': len(voteUserids) })
def voteCountDown(): ggRepeat = repeat.find("gg_map_vote") if not ggRepeat: return timeleft = ggRepeat["remaining"] # Stop the vote ? if timeleft == 0: voteEnd() return votes = len(reduce(lambda a, b: a + b, mapVoteOptions.values())) voteInfo = "" mapsAdded = 0 # For the map with the most votes to the least sortItems = [] for map in mapVoteOptions.items(): sortItems.append((map[0], len(map[1]))) for map in sorted(sortItems, key=itemgetter(1), reverse=True): # Add up to three maps voteInfo += langstring("MapVotes", tokens={"map": map[0], "votes": map[1]}) mapsAdded += 1 if mapsAdded >= 3: break # Should we play the countdown beep if timeleft <= 5: for userid in getUseridList("#human"): Player(userid).playsound("countDownBeep") # Show the singular hudhint and stop here if timeleft == 1: hudhint( "#human", "Countdown_Singular", {"time": timeleft, "voteInfo": voteInfo, "votes": votes, "totalVotes": len(voteUserids)}, ) return # Show the normal hudhint hudhint( "#human", "Countdown_Plural", {"time": timeleft, "voteInfo": voteInfo, "votes": votes, "totalVotes": len(voteUserids)}, )
def count_down(self): ''' Finds how many seconds are left and how many human players are active, then determines whether to extend, end, or continue the count down. ''' # Get the time remaining remaining = self.repeat.timeleft # Is the countdown over? if remaining == 0: # End Warmup self.end_warmup() # No need to go any further return # Get the number of human players on teams players = self.get_human_players # Are there enough players to start the game? if players >= int(warmup_round_min_players): # Get the players reached value players_reached = int(warmup_round_players_reached) # Does the warmup need to end now? if players_reached == 2 or (self.extensions and players_reached == 1): # Set the message to be sent on # Warmup End to Players_Reached self.message = 'Players_Reached' # Reduce the Warmup Round to end in 1 second self.repeat.end_warmup_time() # No need to go any further return # Is the timer at 1? if remaining == 1: # Does the count down need extended? if self.extensions < int(warmup_round_max_extensions): # Increase extensions used self.extensions += 1 # Send message to players that Warmup has been extended hudhint('#human', 'Timer_Extended') # Extend the count down self.repeat.extend_warmup_time() # No need to go any further return # Send hudhint message to all players hudhint('#human', 'Timer_Singular') # Is there more than 1 second left? else: # Send hudhint message to all players hudhint('#human', 'Timer_Plural', {'time': int(remaining)}) # Does a beep sound need to be played? if remaining <= 5: # Play the beep self.play_beep()
def count_down(self): """ Finds how many seconds are left and how many human players are active, then determines whether to extend, end, or continue the count down. """ # Get the time remaining remaining = self.repeat.timeleft # Is the countdown over? if remaining == 0: # End Warmup self.end_warmup() # No need to go any further return # Get the number of human players on teams players = self.get_human_players # Are there enough players to start the game? if players >= int(warmup_round_min_players): # Get the players reached value players_reached = int(warmup_round_players_reached) # Does the warmup need to end now? if players_reached == 2 or (self.extensions and players_reached == 1): # Set the message to be sent on # Warmup End to Players_Reached self.message = "Players_Reached" # Reduce the Warmup Round to end in 1 second self.repeat.end_warmup_time() # No need to go any further return # Is the timer at 1? if remaining == 1: # Does the count down need extended? if self.extensions < int(warmup_round_max_extensions): # Increase extensions used self.extensions += 1 # Send message to players that Warmup has been extended hudhint("#human", "Timer_Extended") # Extend the count down self.repeat.extend_warmup_time() # No need to go any further return # Send hudhint message to all players hudhint("#human", "Timer_Singular") # Is there more than 1 second left? else: # Send hudhint message to all players hudhint("#human", "Timer_Plural", {"time": int(remaining)}) # Does a beep sound need to be played? if remaining <= 5: # Play the beep self.play_beep()