diff --git a/audio/Menu/vox/aaron/adminop_False.wav b/audio/Menu/vox/aaron/adminop_False.wav new file mode 100644 index 00000000..5aa6473d Binary files /dev/null and b/audio/Menu/vox/aaron/adminop_False.wav differ diff --git a/audio/Menu/vox/aaron/adminop_True.wav b/audio/Menu/vox/aaron/adminop_True.wav new file mode 100644 index 00000000..8d3f244b Binary files /dev/null and b/audio/Menu/vox/aaron/adminop_True.wav differ diff --git a/audio/Menu/vox/aaron/adminop_force_all_start.wav b/audio/Menu/vox/aaron/adminop_force_all_start.wav new file mode 100644 index 00000000..e70d68b4 Binary files /dev/null and b/audio/Menu/vox/aaron/adminop_force_all_start.wav differ diff --git a/audio/Menu/vox/ivy/adminop_False.wav b/audio/Menu/vox/ivy/adminop_False.wav new file mode 100644 index 00000000..5aa6473d Binary files /dev/null and b/audio/Menu/vox/ivy/adminop_False.wav differ diff --git a/audio/Menu/vox/ivy/adminop_True.wav b/audio/Menu/vox/ivy/adminop_True.wav new file mode 100644 index 00000000..8d3f244b Binary files /dev/null and b/audio/Menu/vox/ivy/adminop_True.wav differ diff --git a/audio/Menu/vox/ivy/adminop_force_all_start.wav b/audio/Menu/vox/ivy/adminop_force_all_start.wav new file mode 100644 index 00000000..e70d68b4 Binary files /dev/null and b/audio/Menu/vox/ivy/adminop_force_all_start.wav differ diff --git a/colors.py b/colors.py index 23d11e41..2551ceff 100644 --- a/colors.py +++ b/colors.py @@ -32,7 +32,10 @@ def generate_team_colors(num_teams, color_lock=False, color_lock_choices=None): team2 = random.choice(tri_teams[team1]) allowed = tri_teams[team1] + tri_teams[team2] team3_allowed = [x for x in allowed if x in tri_teams[team1] and x in tri_teams[team2]] - team3 = random.choice(team3_allowed) + if team3_allowed: + team3 = random.choice(team3_allowed) + else: + team3 = Colors.White return [team1,team2,team3] elif num_teams == 4: team_a = random.choice([Colors.Orange,Colors.Yellow]) diff --git a/piparty.py b/piparty.py index 24a1cabc..79dfc5f6 100644 --- a/piparty.py +++ b/piparty.py @@ -265,7 +265,7 @@ def __init__(self): self.initialize_settings() self.update_settings_file() - self.admin_options = ["random_team_size"] + self.admin_options = ["random_team_size","force_all_start"] self.admin_control_option = 0 #check for update @@ -283,6 +283,8 @@ def __init__(self): self.moves = [psmove.PSMove(x) for x in range(psmove.count_connected())] self.admin_move = None #move controllers that have been taken out of play + #I think we can probably get rid of this since out_moves are just turning off the controller now + #needs testing self.out_moves = {} self.random_added = [] self.rand_game_list = [] @@ -661,6 +663,8 @@ def check_admin_controls(self): self.admin_control_option = (self.admin_control_option + 1) % len(self.admin_options) if(self.admin_options[self.admin_control_option] == 'random_team_size'): Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/adminop_random_team_size.wav').start_effect() + elif(self.admin_options[self.admin_control_option] == 'force_all_start'): + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/adminop_force_all_start.wav').start_effect() if admin_opt[Opts.selection.value] == Selections.change_mode_forward.value: admin_opt[Opts.selection.value] = Selections.nothing.value @@ -669,6 +673,9 @@ def check_admin_controls(self): if (self.ns.settings['random_team_size'] < 2): self.update_setting('random_team_size', 2) Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['random_team_size'])).start_effect() + elif(self.admin_options[self.admin_control_option] == 'force_all_start'): + self.update_setting('force_all_start', not self.ns.settings['force_all_start'] ) + Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['force_all_start'])).start_effect() if admin_opt[Opts.selection.value] == Selections.change_mode_backward.value: admin_opt[Opts.selection.value] = Selections.nothing.value @@ -677,6 +684,9 @@ def check_admin_controls(self): if (self.ns.settings['random_team_size'] < 2): self.update_setting('random_team_size', RANDOM_TEAM_SIZES) Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['random_team_size'])).start_effect() + elif(self.admin_options[self.admin_control_option] == 'force_all_start'): + self.update_setting('force_all_start', not self.ns.settings['force_all_start'] ) + Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['force_all_start'])).start_effect() #to play instructions or not if admin_opt[Opts.selection.value] == Selections.change_instructions.value: @@ -756,6 +766,7 @@ def initialize_settings(self): 'random_teams': True, 'color_lock': False, 'random_team_size': 4, + 'force_all_start':False, 'color_lock_choices':{ 2: ['Magenta','Green'], 3: ['Orange','Turquoise','Purple'], @@ -908,8 +919,14 @@ def play_random_instructions(self): def start_game(self, random_mode=False): self.enable_bt_scanning(False) time.sleep(1) - self.teams = {serial: self.move_opts[serial][Opts.team.value] for serial in self.tracked_moves.keys() if self.out_moves[serial] == Alive.on.value} - game_moves = [move.get_serial() for move in self.moves if self.out_moves[move.get_serial()] == Alive.on.value and (self.move_opts[move.get_serial()])[Opts.random_start.value] == Alive.off.value ] + if(not self.ns.settings['force_all_start']): + #start with only controllers that have pushed trigger + self.teams = {serial: self.move_opts[serial][Opts.team.value] for serial in self.tracked_moves.keys() if self.out_moves[serial] == Alive.on.value} + game_moves = [move.get_serial() for move in self.moves if self.out_moves[move.get_serial()] == Alive.on.value and (self.move_opts[move.get_serial()])[Opts.random_start.value] == Alive.off.value ] + else: + #start with all controllers (even ones who have not pushed trigger) + self.teams = {serial: self.move_opts[serial][Opts.team.value] for serial in self.tracked_moves.keys() if self.out_moves[serial] == Alive.on.value} + game_moves = [move.get_serial() for move in self.moves if self.out_moves[move.get_serial()] == Alive.on.value] if len(game_moves) < self.game_mode.minimum_players and self.ns.settings['enforce_minimum']: Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/notenoughplayers.wav').start_effect() self.reset_controller_game_state() diff --git a/templates/settings.html b/templates/settings.html index 22a1ae09..5a034ee8 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -78,6 +78,12 @@
+{{ form.force_all_start }} {{form.force_all_start.label}} +
++{{ form.random_team_size }} {{form.random_team_size.label}} +
+
Random Mode Game Selection
{% for item in form.random_modes %}
@@ -103,4 +109,4 @@ Admin Settings
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/webui.py b/webui.py
index 9afdbe7c..9e90b764 100644
--- a/webui.py
+++ b/webui.py
@@ -31,6 +31,8 @@ class SettingsForm(Form):
color_choices = [(color.name,color.name) for color in colors.team_color_list]
color_lock_choices = FieldList(SelectField('',choices=color_choices,coerce=str),min_entries=9)
random_teams = BooleanField('Randomize teams each round')
+ force_all_start = BooleanField('When force starting start with all or only those who pushed trigger')
+ random_team_size = SelectField('size of random teams',choices=[(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6')],coerce=int)
class WebUI():
def __init__(self, command_queue=Queue(), ns=None):
@@ -44,7 +46,9 @@ def __init__(self, command_queue=Queue(), ns=None):
self.ns.status = dict()
self.ns.settings = {
'sensitivity':1,
- 'red_on_kill':False,
+ 'red_on_kill':False,
+ 'random_team_size':3,
+ 'force_all_start':False,
'color_lock_choices':{
2: ['Magenta','Green'],
3: ['Orange','Turquoise','Purple'],
@@ -141,6 +145,8 @@ def settings(self):
settingsForm = SettingsForm(
sensitivity = self.ns.settings['sensitivity'],
red_on_kill = self.ns.settings['red_on_kill'],
+ random_team_size = self.ns.settings['random_team_size'],
+ force_all_start = self.ns.settings['force_all_start'],
color_lock_choices = temp_colors
)
return render_template('settings.html', form=settingsForm, settings=self.ns.settings)