Prevent players in waitlist from being considered in votes #2780 #3020
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Battlecommand.GetRunPermissions()will now check if the player is in the waitlist, before considering the player as part of a vote.I added a function in
ServerBattle,public bool ServerBattle.IsInWaitlist(username), that takes in a player's username, and returns a boolean to check whether or not they are in the waitlist.The logic in this function is basically identical to the first few lines in
ServerBattle.StartGame(). As far as I can tell, this is how you determine if a player is in the waitlist.If a player is considered part of the waitlist, they will not be able to vote, and the bot will specify that players in the waitlist should not be able to vote.
Some thoughts / concerns:
Not sure if there should be any difference between spectator and waitlisted specified in the messages.
Not sure if im missing any logic or edge cases in
IsInWaitlist(). It seems to be fine, since its exactly the code that determines what players actually play or not when a game is started, but still.Not sure if its safe to call
battle.IsInWaitlist(); I dont know if battle can be null when a vote is caused, and if that will cause some crash.