From b73be0f0920d8511373475161a50e2afa49dc662 Mon Sep 17 00:00:00 2001 From: Pshy0 Date: Mon, 28 Aug 2023 16:26:17 +0200 Subject: [PATCH] added musics and made winners bigger --- lua/pshy/games/vs.lua | 1 + lua/pshy/teams/racingvs.lua | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lua/pshy/games/vs.lua b/lua/pshy/games/vs.lua index 410a04b0..4af8e7bd 100644 --- a/lua/pshy/games/vs.lua +++ b/lua/pshy/games/vs.lua @@ -55,4 +55,5 @@ system.disableChatCommandDisplay(nil, true) newgame.SetRotation("racing_vanilla") +tfm.exec.playMusic("casual", "musique", 70, true) tfm.exec.newGame("lobby") diff --git a/lua/pshy/teams/racingvs.lua b/lua/pshy/teams/racingvs.lua index 952ad47e..a7ab91e6 100644 --- a/lua/pshy/teams/racingvs.lua +++ b/lua/pshy/teams/racingvs.lua @@ -28,6 +28,10 @@ teams.rejoin = true -- players leaving a team will rejoin the same one +local pending_music_switch = true + + + --- Replace #ff0000 by the winner team color. local function ReplaceRedToWinningColor(xml) local winner_team = teams.teams[teams.winner_index] @@ -67,20 +71,37 @@ function eventNewGame() if teams.winner_index then if not teams.have_played_winner_round then -- winner round + tfm.exec.stopMusic("musique") teams.have_played_winner_round = true tfm.exec.setGameTime(13, true) local winner_team = teams.GetTeam(teams.winner_index) - for player_name, void in pairs(winner_team.player_names) do - tfm.exec.setVampirePlayer(player_name, true) + for player_name in pairs(tfm.get.room.playerList) do + if winner_team.player_names[player_name] then + tfm.exec.playSound("fortoresse/x_victoire", 80, nil, nil, player_name) + tfm.exec.changePlayerSize(player_name, 1.5) + else + tfm.exec.playSound("fortoresse/x_defaite", 80, nil, nil, player_name) + tfm.exec.changePlayerSize(player_name, 0.5) + end end newgame.SetNextMap("lobby") else - -- first round of new match + -- first round of new match / could be lobby + tfm.exec.playMusic("casual", "musique", 70, true) + for player_name in pairs(tfm.get.room.playerList) do + tfm.exec.changePlayerSize(player_name, 1) + end teams.winner_index = nil teams.have_played_winner_round = false teams.ResetScores() + pending_music_switch = true end end + if pending_music_switch and newgame.current_map_identifying_name ~= "lobby" then -- looks like a bug + print_debug("newgame.current_map_identifying_name %s", newgame.current_map_identifying_name) + tfm.exec.playMusic("fight", "musique", 70, true) + pending_music_switch = false + end utils_messages.Title(nil) end