Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CBT achievement #786

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Assets/Scripts/Gamestate/MatchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private IEnumerator DisplayWinScreenAndRestart(PlayerIdentity winner)
{
globalHUDController.DisplayWinScreen(winner);

// TODO extract to achievement class
// TODO extract to achievement class?
var isNotCustomGamemode = MatchRules.Current.GameMode is not GameModeVariant.Custom;
var winnerIsLocalPlayer = Peer2PeerTransport.PlayerDetails.Any(p => p.id == winner.id && p.type is PlayerType.Local);
if (isNotCustomGamemode && winnerIsLocalPlayer)
Expand All @@ -301,6 +301,11 @@ private IEnumerator DisplayWinScreenAndRestart(PlayerIdentity winner)
});
}

var isWinnerInAllRoundsAndHasNotDied =
rounds.All(r => r.Winner == winner.id && !r.Kills.Values.Any(k => k.Contains(winner.id)));
if (isNotCustomGamemode && winnerIsLocalPlayer && isWinnerInAllRoundsAndHasNotDied)
SteamManager.Singleton.UnlockAchievement(AchievementType.CogAndBoltTinkering);

yield return new WaitForSecondsRealtime(matchEndDelay);

ReturnToMainMenu();
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/Utils/SteamManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public enum AchievementType
AllIn,
Clutch,
MatchPoint,
CogAndBoltTinkering,
}

public class Lobby
Expand Down Expand Up @@ -205,6 +206,7 @@ private void RequestStats()
{ AchievementType.SitThroughCredits, "ACHIEVEMENT_CREDITS" },
{ AchievementType.Clutch, "ACHIEVEMENT_CLUTCH" },
{ AchievementType.MatchPoint, "ACHIEVEMENT_MATCH_POINT" },
{ AchievementType.CogAndBoltTinkering, "ACHIEVEMENT_CBT" },
};

public void UnlockAchievement(SecretCombinationType type)
Expand Down