From baa4fdb9183dfd642f052f6bf30d1c86a23febbd Mon Sep 17 00:00:00 2001 From: Aaron Angert Date: Sat, 24 Aug 2019 23:54:42 -0500 Subject: [PATCH] changed from common.VOX to joustsettings.yaml --- common.py | 6 ++-- games/commander.py | 19 ++++++----- games/fight_club.py | 16 +++++---- games/speed_bomb.py | 10 +++--- games/swapper.py | 24 ++++++------- games/zombie.py | 18 +++++----- joust.py | 42 +++++++++++------------ piparty.py | 83 +++++++++++++++++++++++---------------------- update.py | 14 ++++---- 9 files changed, 119 insertions(+), 113 deletions(-) diff --git a/common.py b/common.py index 5dddd078..1143a9cb 100644 --- a/common.py +++ b/common.py @@ -188,8 +188,6 @@ def __str__(self): 'color_lock', 'color_lock_choices', 'red_on_kill', -'random_teams' +'random_teams', +'menu_voice', ] - -VOX = 'ivy' -# VOX = 'aaron' \ No newline at end of file diff --git a/games/commander.py b/games/commander.py index 8e2c35d7..61ae4e4a 100644 --- a/games/commander.py +++ b/games/commander.py @@ -229,6 +229,7 @@ def __init__(self, moves, command_queue, ns, music, dead_moves, commander_intro, self.command_queue = command_queue self.ns = ns + self.voice = self.ns.settings['menu_voice'] self.sensitivity = self.ns.settings['sensitivity'] self.random_teams = self.ns.settings['random_teams'] @@ -404,9 +405,9 @@ def end_game(self): def end_game_sound(self, winning_team): #if self.game_mode == common.Games.JoustTeams: if winning_team == Team.alpha.value: - team_win = Audio('audio/Commander/vox/' + common.VOX + '/red winner.wav') + team_win = Audio('audio/Commander/vox/' + self.voice + '/red winner.wav') if winning_team == Team.bravo.value: - team_win = Audio('audio/Commander/vox/' + common.VOX + '/blue winner.wav') + team_win = Audio('audio/Commander/vox/' + self.voice + '/blue winner.wav') team_win.start_effect() def check_commander_select(self): @@ -446,14 +447,14 @@ def update_team_powers(self): if self.powers[Team.alpha.value].value >= 1.0: self.powers_active[Team.alpha.value] = True Audio('audio/Commander/sounds/power ready.wav').start_effect() - Audio('audio/Commander/vox/' + common.VOX + '/red power ready.wav').start_effect() + Audio('audio/Commander/vox/' + self.voice + '/red power ready.wav').start_effect() if self.powers_active[Team.bravo.value] == False: if self.powers[Team.bravo.value].value >= 1.0: self.powers_active[Team.bravo.value] = True Audio('audio/Commander/sounds/power ready.wav').start_effect() - Audio('audio/Commander/vox/' + common.VOX + '/blue power ready.wav').start_effect() + Audio('audio/Commander/vox/' + self.voice + '/blue power ready.wav').start_effect() def overdrive(self, team): @@ -461,11 +462,11 @@ def overdrive(self, team): if team == Team.alpha.value: self.alpha_overdrive.value = 1 self.activated_overdrive[Team.alpha.value] = time.time() + 10 - Audio('audio/Commander/vox/' + common.VOX + '/red overdrive.wav').start_effect() + Audio('audio/Commander/vox/' + self.voice + '/red overdrive.wav').start_effect() else: self.bravo_overdrive.value = 1 self.activated_overdrive[Team.bravo.value] = time.time() + 10 - Audio('audio/Commander/vox/' + common.VOX + '/blue overdrive.wav').start_effect() + Audio('audio/Commander/vox/' + self.voice + '/blue overdrive.wav').start_effect() @@ -503,7 +504,7 @@ def check_everyone_in(self): def commander_intro_audio(self): - intro_sound = Audio('audio/Commander/vox/' + common.VOX + '/commander intro.wav') + intro_sound = Audio('audio/Commander/vox/' + self.voice + '/commander intro.wav') intro_sound.start_effect() #need while loop here play_last_one = True @@ -516,7 +517,7 @@ def commander_intro_audio(self): if time.time() > battle_ready_time and play_last_one: play_last_one = False - Audio('audio/Commander/vox/' + common.VOX + '/10 seconds begins.wav').start_effect() + Audio('audio/Commander/vox/' + self.voice + '/10 seconds begins.wav').start_effect() intro_sound.stop_effect() if self.current_commander[Team.alpha.value] == '': @@ -525,7 +526,7 @@ def commander_intro_audio(self): self.change_random_commander(Team.bravo.value) - Audio('audio/Commander/vox/' + common.VOX + '/commanders chosen.wav').start_effect_and_wait() + Audio('audio/Commander/vox/' + self.voice + '/commanders chosen.wav').start_effect_and_wait() self.reset_power(Team.alpha.value) self.reset_power(Team.bravo.value) self.commander_intro.value = 0 diff --git a/games/fight_club.py b/games/fight_club.py index 9236393d..de343dad 100644 --- a/games/fight_club.py +++ b/games/fight_club.py @@ -151,6 +151,8 @@ def __init__(self, moves, command_queue, ns, music, show_team_colors, music_spee self.command_queue = command_queue self.ns = ns + + self.voice = self.ns.settings['menu_voice'] self.sensitivity = self.ns.settings['sensitivity'] self.play_audio = self.ns.settings['play_audio'] @@ -345,7 +347,7 @@ def alive_move_count(self): #more than one tied winner, have them face off def face_off(self): - Audio('audio/Fight_Club/vox/' + common.VOX + '/tie_game.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/tie_game.wav').start_effect() for move in self.move_serials: self.dead_moves[move].value = 0 for move in self.winning_moves: @@ -391,9 +393,9 @@ def check_end_game(self): if self.round_counter >= self.round_num: self.check_winner() if self.round_counter == self.round_num - 5: - Audio('audio/Fight_Club/vox/' + common.VOX + '/5_rounds.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/5_rounds.wav').start_effect() if self.round_counter == self.round_num - 1: - Audio('audio/Fight_Club/vox/' + common.VOX + '/last_round.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/last_round.wav').start_effect() def stop_tracking_moves(self): @@ -406,7 +408,7 @@ def end_game(self): h_value = 0 for move in self.move_serials: self.dead_moves[move].value = 0 - Audio('audio/Fight_Club/vox/' + common.VOX + '/game_over.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/game_over.wav').start_effect() #os.popen('espeak -ven -p 70 -a 200 "winner"') while (time.time() < end_time): @@ -504,11 +506,11 @@ def reset_round_timer(self): self.current_winner = self.chosen_defender saying = random.randint(0,2) if saying == 0: - Audio('audio/Fight_Club/vox/' + common.VOX + '/defender_lead.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/defender_lead.wav').start_effect() elif saying == 1: - Audio('audio/Fight_Club/vox/' + common.VOX + '/defender_winning.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/defender_winning.wav').start_effect() elif saying == 2: - Audio('audio/Fight_Club/vox/' + common.VOX + '/Defender_high_score.wav').start_effect() + Audio('audio/Fight_Club/vox/' + self.voice + '/Defender_high_score.wav').start_effect() self.check_end_game() diff --git a/games/speed_bomb.py b/games/speed_bomb.py index 9770d064..bc2fcfce 100644 --- a/games/speed_bomb.py +++ b/games/speed_bomb.py @@ -174,6 +174,8 @@ def __init__(self, moves, command_queue, ns, music, bomb_color, game_start, five self.command_queue = command_queue self.ns = ns + + self.voice = self.ns.settings['menu_voice'] self.play_audio = self.ns.settings['play_audio'] self.move_serials = moves @@ -211,11 +213,11 @@ def __init__(self, moves, command_queue, ns, music, bomb_color, game_start, five self.start_beep = Audio('audio/Joust/sounds/start.wav') self.start_game = Audio('audio/Joust/sounds/start3.wav') self.explosion = Audio('audio/Joust/sounds/Explosion34.wav') - self.fakedout = Audio('audio/Joust/vox/' + common.VOX + '/Fakedout.wav') + self.fakedout = Audio('audio/Joust/vox/' + self.voice + '/Fakedout.wav') self.explosion40 = Audio('audio/Joust/sounds/Explosion40.wav') - self.countered = Audio('audio/Joust/vox/' + common.VOX + '/countered.wav') - self.Fakecountered = Audio('audio/Joust/vox/' + common.VOX + '/FakedoutCounter.wav') - self.explosiondeath = Audio('audio/Joust/vox/' + common.VOX + '/explosiondeath.wav') + self.countered = Audio('audio/Joust/vox/' + self.voice + '/countered.wav') + self.Fakecountered = Audio('audio/Joust/vox/' + self.voice + '/FakedoutCounter.wav') + self.explosiondeath = Audio('audio/Joust/vox/' + self.voice + '/explosiondeath.wav') end = False try: diff --git a/games/swapper.py b/games/swapper.py index e0ac5a14..2b467ada 100644 --- a/games/swapper.py +++ b/games/swapper.py @@ -181,7 +181,7 @@ def __init__(self, moves, command_queue, ns, music, controller_colors, dead_move self.command_queue = command_queue self.ns = ns - + self.voice = self.ns.settings['menu_voice'] #save locally in case settings change from web self.play_audio = self.ns.settings['play_audio'] self.sensitivity = self.ns.settings['sensitivity'] @@ -333,30 +333,30 @@ def end_game(self): def end_game_sound(self, winning_team): win_team_name = self.team_colors[winning_team].name if win_team_name == 'Pink': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Pink Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/pink team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/pink team win.wav') if win_team_name == 'Magenta': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/magenta team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/magenta team win.wav') if win_team_name == 'Orange': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Orange Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/orange team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/orange team win.wav') if win_team_name == 'Yellow': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/yellow team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/yellow team win.wav') if win_team_name == 'Green': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/green team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/green team win.wav') if win_team_name == 'Turquoise': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/cyan team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/cyan team win.wav') if win_team_name == 'Blue': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/blue team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/blue team win.wav') if win_team_name == 'Purple': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Purple Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/purple team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/purple team win.wav') team_win.start_effect() def game_loop(self): diff --git a/games/zombie.py b/games/zombie.py index 9181ddc0..834ceb20 100644 --- a/games/zombie.py +++ b/games/zombie.py @@ -199,7 +199,7 @@ def __init__(self, cont_alive, command_queue, ns, music,restart, zombie_opts): self.command_queue = command_queue self.ns = ns - + self.voice = self.ns.settings['menu_voice'] self.sensitivity = self.ns.settings['sensitivity'] self.play_audio = self.ns.settings['play_audio'] @@ -258,19 +258,19 @@ def reward(self, random_bullet_chance): def audio_cue(self): if self.win_time - (time.time() - self.start_time) <= 10 and self.effect_cue <= 4: - Audio('audio/Zombie/vox/' + common.VOX + '/10 seconds left.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/10 seconds left.wav').start_effect() self.effect_cue = 5 elif self.win_time - (time.time() - self.start_time) <= 30 and self.effect_cue <= 3: - Audio('audio/Zombie/vox/' + common.VOX + '/30 seconds.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/30 seconds.wav').start_effect() self.effect_cue = 4 elif self.win_time - (time.time() - self.start_time) <= 1*60 and self.effect_cue <= 2: - Audio('audio/Zombie/vox/' + common.VOX + '/1 minute.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/1 minute.wav').start_effect() self.effect_cue = 3 elif self.win_time - (time.time() - self.start_time) <= 3*60 and self.effect_cue <= 1: - Audio('audio/Zombie/vox/' + common.VOX + '/3 minutes.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/3 minutes.wav').start_effect() self.effect_cue = 2 #elif self.win_time - (time.time() - self.start_time) <= 5*60 and self.effect_cue <= 0: - # Audio('audio/Zombie/vox/' + common.VOX + '/5 minutes.wav').start_effect() + # Audio('audio/Zombie/vox/' + self.voice + '/5 minutes.wav').start_effect() # self.effect_cue = 1 @@ -298,9 +298,9 @@ def Start(self): self.restart.value = 0 print("started the controllers") if self.play_audio: - human_victory = Audio('audio/Zombie/vox/' + common.VOX + '/human_victory.wav') - zombie_victory = Audio('audio/Zombie/vox/' + common.VOX + '/zombie_victory.wav') - death = Audio('audio/Zombie/vox/' + common.VOX + '/zombie_death.wav') + human_victory = Audio('audio/Zombie/vox/' + self.voice + '/human_victory.wav') + zombie_victory = Audio('audio/Zombie/vox/' + self.voice + '/zombie_victory.wav') + death = Audio('audio/Zombie/vox/' + self.voice + '/zombie_death.wav') pistol = Audio('audio/Zombie/sounds/pistol.wav') shotgun = Audio('audio/Zombie/sounds/shotgun.wav') molotov = Audio('audio/Zombie/sounds/molotov.wav') diff --git a/joust.py b/joust.py index 834c0882..30955d07 100644 --- a/joust.py +++ b/joust.py @@ -193,7 +193,7 @@ class Joust(): def __init__(self, moves, command_queue, ns, music, teams, game_mode,controller_teams, controller_colors, dead_moves, force_move_colors,music_speed,werewolf_reveal, show_team_colors, red_on_kill, restart): self.command_queue = command_queue self.ns = ns - + self.voice = self.ns.settings['menu_voice'] print(self.ns.settings) self.game_mode = game_mode @@ -415,13 +415,13 @@ def reveal(self): def werewolf_audio_cue(self): if self.game_mode == common.Games.WereJoust: if self.werewolf_timer - (time.time() - self.start_timer) <= 30 and self.audio_cue == 0: - Audio('audio/Joust/vox/' + common.VOX + '/30 werewolf.wav').start_effect() + Audio('audio/Joust/vox/' + self.voice + '/30 werewolf.wav').start_effect() self.audio_cue = 1 if self.werewolf_timer - (time.time() - self.start_timer) <= 10 and self.audio_cue == 1: - Audio('audio/Joust/vox/' + common.VOX + '/10 werewolf.wav').start_effect() + Audio('audio/Joust/vox/' + self.voice + '/10 werewolf.wav').start_effect() self.audio_cue = 2 if self.werewolf_timer - (time.time() - self.start_timer) <= 0 and self.audio_cue == 2: - Audio('audio/Joust/vox/' + common.VOX + '/werewolf reveal 2.wav').start_effect() + Audio('audio/Joust/vox/' + self.voice + '/werewolf reveal 2.wav').start_effect() self.reveal() self.audio_cue = 3 self.change_time = time.time()-0.001 @@ -455,10 +455,10 @@ def check_end_game(self): if self.game_mode == common.Games.NonStop: if self.audio_cue == 0 and time.time() > self.non_stop_time - 60: - Audio('audio/Zombie/vox/' + common.VOX + '/1 minute.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/1 minute.wav').start_effect() self.audio_cue += 1 if self.audio_cue == 1 and time.time() > self.non_stop_time - 30: - Audio('audio/Zombie/vox/' + common.VOX + '/30 seconds.wav').start_effect() + Audio('audio/Zombie/vox/' + self.voice + '/30 seconds.wav').start_effect() self.audio_cue += 1 if time.time() > self.non_stop_time: lowest_score = 100000 @@ -506,40 +506,40 @@ def end_game(self): def end_game_sound(self, winning_team): if self.game_mode == common.Games.WereJoust: if winning_team == -1: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/werewolf win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/werewolf win.wav') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/human win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/human win.wav') team_win.start_effect() elif self.game_mode != common.Games.JoustFFA and self.game_mode != common.Games.NonStop: win_team_name = self.team_colors[winning_team].name if winning_team == -1: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/traitor win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/traitor win.wav') else: if win_team_name == 'Pink': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Pink Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/pink team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/pink team win.wav') if win_team_name == 'Magenta': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/magenta team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/magenta team win.wav') if win_team_name == 'Orange': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Orange Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/orange team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/orange team win.wav') if win_team_name == 'Yellow': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/yellow team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/yellow team win.wav') if win_team_name == 'Green': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/green team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/green team win.wav') if win_team_name == 'Turquoise': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/cyan team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/cyan team win.wav') if win_team_name == 'Blue': - team_win = Audio('audio/Joust/vox/' + common.VOX + '/blue team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/blue team win.wav') if win_team_name == 'Purple': - if common.VOX == 'aaron': + if self.voice == 'aaron': os.popen('espeak -ven -p 70 -a 200 "And the winner is ...Purple Team') else: - team_win = Audio('audio/Joust/vox/' + common.VOX + '/purple team win.wav') + team_win = Audio('audio/Joust/vox/' + self.voice + '/purple team win.wav') try: team_win.start_effect() except: @@ -547,7 +547,7 @@ def end_game_sound(self, winning_team): def werewolf_intro(self): #don't wait so colors change during prompts - Audio('audio/Joust/vox/' + common.VOX + '/werewolf intro.wav').start_effect() + Audio('audio/Joust/vox/' + self.voice + '/werewolf intro.wav').start_effect() time.sleep(3) self.change_all_move_colors(0,0,80) time.sleep(2) diff --git a/piparty.py b/piparty.py index 96542d6f..e96636ef 100644 --- a/piparty.py +++ b/piparty.py @@ -235,9 +235,7 @@ def track_move(serial, move_num, move, move_opts, force_color, battery, dead_cou class Menu(): def __init__(self): - if platform == "linux" or platform == "linux2": - self.big_update = update.check_for_update() - self.git_hash = update.run_command("git rev-parse HEAD")[:7] + self.command_queue = Queue() self.joust_manager = Manager() self.ns = self.joust_manager.Namespace() @@ -249,6 +247,12 @@ def __init__(self): self.command_from_web = '' self.initialize_settings() self.update_settings_file() + + #check for update + if platform == "linux" or platform == "linux2": + self.big_update = update.check_for_update(self.ns.settings['menu_voice']) + self.git_hash = update.run_command("git rev-parse HEAD")[:7] + #defined outside of ns.settings as it's a purely dev option self.experimental = False @@ -424,8 +428,6 @@ def pair_move(self, move, move_num): self.kill_controller_proc[move_serial] = kill_proc self.out_moves[move.get_serial()] = Alive.on.value - - self.exclude_out_moves() @@ -454,31 +456,31 @@ def remove_controller(self, move_serial): def game_mode_announcement(self): if self.game_mode == common.Games.JoustFFA: - Audio('audio/Menu/vox/' + common.VOX + '/menu Joust FFA.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Joust FFA.wav').start_effect() if self.game_mode == common.Games.JoustTeams: - Audio('audio/Menu/vox/' + common.VOX + '/menu Joust Teams.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Joust Teams.wav').start_effect() if self.game_mode == common.Games.JoustRandomTeams: - Audio('audio/Menu/vox/' + common.VOX + '/menu Joust Random Teams.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Joust Random Teams.wav').start_effect() if self.game_mode == common.Games.Traitor: - Audio('audio/Menu/vox/' + common.VOX + '/menu Traitor.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Traitor.wav').start_effect() if self.game_mode == common.Games.WereJoust: - Audio('audio/Menu/vox/' + common.VOX + '/menu Werewolves.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Werewolves.wav').start_effect() if self.game_mode == common.Games.Zombies: - Audio('audio/Menu/vox/' + common.VOX + '/menu Zombies.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Zombies.wav').start_effect() if self.game_mode == common.Games.Commander: - Audio('audio/Menu/vox/' + common.VOX + '/menu Commander.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Commander.wav').start_effect() if self.game_mode == common.Games.Swapper: - Audio('audio/Menu/vox/' + common.VOX + '/menu Swapper.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Swapper.wav').start_effect() if self.game_mode == common.Games.Tournament: - Audio('audio/Menu/vox/' + common.VOX + '/menu Tournament.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Tournament.wav').start_effect() if self.game_mode == common.Games.Ninja: - Audio('audio/Menu/vox/' + common.VOX + '/menu ninjabomb.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu ninjabomb.wav').start_effect() if self.game_mode == common.Games.Random: - Audio('audio/Menu/vox/' + common.VOX + '/menu Random.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu Random.wav').start_effect() if self.game_mode == common.Games.FightClub: - Audio('audio/Menu/vox/' + common.VOX + '/menu FightClub.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu FightClub.wav').start_effect() if self.game_mode == common.Games.NonStop: - Audio('audio/Menu/vox/' + common.VOX + '/menu NonStopJoust.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/menu NonStopJoust.wav').start_effect() def check_change_mode(self): change_mode = False @@ -547,7 +549,7 @@ def check_update(self): for move, move_opt in self.move_opts.items(): if move_opt[Opts.selection.value] == Selections.update.value: if self.big_update: - update.big_update() + update.big_update(self.ns.settings['menu_voice']) self.big_update = False def game_loop(self): @@ -627,9 +629,9 @@ def check_admin_controls(self): self.update_setting('play_instructions', not self.ns.settings['play_instructions']) if self.ns.settings['play_audio']: if self.ns.settings['play_instructions']: - Audio('audio/Menu/vox/' + common.VOX + '/instructions_on.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/instructions_on.wav').start_effect() else: - Audio('audio/Menu/vox/' + common.VOX + '/instructions_off.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/instructions_off.wav').start_effect() #change sensitivity if admin_opt[Opts.selection.value] == Selections.change_sensitivity.value: @@ -638,15 +640,15 @@ def check_admin_controls(self): self.update_setting('sensitivity', (self.ns.settings['sensitivity'] + 1) % SENSITIVITY_MODES) if self.ns.settings['play_audio']: if self.ns.settings['sensitivity'] == Sensitivity.ultra_slow.value: - Audio('audio/Menu/vox/' + common.VOX + '/ultra_high.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/ultra_high.wav').start_effect() elif self.ns.settings['sensitivity'] == Sensitivity.slow.value: - Audio('audio/Menu/vox/' + common.VOX + '/high.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/high.wav').start_effect() elif self.ns.settings['sensitivity'] == Sensitivity.mid.value: - Audio('audio/Menu/vox/' + common.VOX + '/medium.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/medium.wav').start_effect() elif self.ns.settings['sensitivity'] == Sensitivity.fast.value: - Audio('audio/Menu/vox/' + common.VOX + '/low.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/low.wav').start_effect() elif self.ns.settings['sensitivity'] == Sensitivity.ultra_fast.value: - Audio('audio/Menu/vox/' + common.VOX + '/ultra_low.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/ultra_low.wav').start_effect() #no admin colors in con custom teams mode if self.game_mode == common.Games.JoustTeams or self.game_mode == common.Games.Random: @@ -692,6 +694,7 @@ def initialize_settings(self): 'random_modes': [common.Games.JoustFFA.name,common.Games.JoustRandomTeams.name,common.Games.WereJoust.name,common.Games.Swapper.name], 'current_game': common.Games.JoustFFA.name, 'play_audio': True, + 'menu_voice': 'ivy', 'move_can_be_admin': True, 'enforce_minimum': True, 'red_on_kill': True, @@ -747,7 +750,7 @@ def update_settings_file(self): #option to make file editable by non-root #let's leave it as root only, people shouldn't #mess with the config file for now - #os.system('chmod 666 %s' % com mon.SETTINGSFILE) + os.system('chmod 666 %s' % common.SETTINGSFILE) def update_setting(self,key,val): temp_settings = self.ns.settings @@ -821,28 +824,28 @@ def check_start_game(self): def play_random_instructions(self): if self.game_mode == common.Games.JoustFFA: - Audio('audio/Menu/vox/' + common.VOX + '/FFA-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/FFA-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.JoustRandomTeams: - Audio('audio/Menu/vox/' + common.VOX + '/Teams-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Teams-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Traitor: - Audio('audio/Menu/vox/' + common.VOX + '/Traitor-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Traitor-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.WereJoust: - Audio('audio/Menu/vox/' + common.VOX + '/werewolf-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/werewolf-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Zombies: - Audio('audio/Menu/vox/' + common.VOX + '/zombie-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/zombie-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Commander: - Audio('audio/Menu/vox/' + common.VOX + '/commander-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/commander-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Ninja: - Audio('audio/Menu/vox/' + common.VOX + '/Ninjabomb-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Ninjabomb-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Swapper: - Audio('audio/Menu/vox/' + common.VOX + '/Swapper-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Swapper-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.Tournament: - Audio('audio/Menu/vox/' + common.VOX + '/Tournament-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Tournament-instructions.wav').start_effect_and_wait() if self.game_mode == common.Games.FightClub: - if common.VOX == 'aaron': + if self.ns.settings['menu_voice'] == 'aaron': os.popen('espeak -ven -p 70 -a 200 "Two players fight, the winner must defend their title, the player with the highest score wins') else: - Audio('audio/Menu/vox/' + common.VOX + '/Fightclub-instructions.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/Fightclub-instructions.wav').start_effect_and_wait() time.sleep(5) @@ -858,7 +861,7 @@ def start_game(self, random_mode=False): pass if len(game_moves) < self.game_mode.minimum_players and self.ns.settings['enforce_minimum']: - Audio('audio/Menu/vox/' + common.VOX + '/notenoughplayers.wav').start_effect() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/notenoughplayers.wav').start_effect() self.reset_controller_game_state() return self.menu.value = 0 @@ -937,7 +940,7 @@ def start_game(self, random_mode=False): self.game_mode = common.Games.Random if self.ns.settings['play_instructions']: if self.ns.settings['play_audio']: - Audio('audio/Menu/vox/' + common.VOX + '/tradeoff2.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/tradeoff2.wav').start_effect_and_wait() self.play_menu_music = True #reset music self.choose_new_music() diff --git a/update.py b/update.py index a3ac515f..8fdbd053 100644 --- a/update.py +++ b/update.py @@ -6,7 +6,7 @@ if __name__ == "__main__": InitAudio() - check_for_update() + check_for_update('ivy') def run_command(command): process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) @@ -22,8 +22,8 @@ def run_command(command): rc = process.poll() return outout -def big_update(): - Audio('audio/Menu/vox/' + common.VOX + '/update_started.wav').start_effect_and_wait() +def big_update(voice): + Audio('audio/Menu/vox/' + voice + '/update_started.wav').start_effect_and_wait() current_hash = run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git rev-parse HEAD'").strip() run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git checkout master'") run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git pull'") @@ -31,13 +31,13 @@ def big_update(): #it failed if it got this far time.sleep(3) run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git checkout {}'".format(current_hash)) - Audio('audio/Menu/vox/' + common.VOX + '/joustmania_failed.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + voice + '/joustmania_failed.wav').start_effect_and_wait() def tester(): current_hash = run_command("sudo runuser -l pi -c 'git rev-parse HEAD'").strip() print(current_hash) -def check_for_update(): +def check_for_update(voice): process = run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;pwd'") process = run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git fetch'") diff_files = run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git diff origin/master --name-only'").split() @@ -45,13 +45,13 @@ def check_for_update(): if('setup.sh' in diff_files): - Audio('audio/Menu/vox/' + common.VOX + '/large_update.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + voice + '/large_update.wav').start_effect_and_wait() return True elif (len(diff_files) >= 1): print("doing small pull") pull = run_command("sudo runuser -l pi -c 'cd /home/pi/JoustMania/;git pull'") - Audio('audio/Menu/vox/' + common.VOX + '/joustmania_updated.wav').start_effect_and_wait() + Audio('audio/Menu/vox/' + voice + '/joustmania_updated.wav').start_effect_and_wait() return False