diff --git a/Facepunch.Steamworks/Client/Achievements.cs b/Facepunch.Steamworks/Client/Achievements.cs index 7e4137d..a661f13 100644 --- a/Facepunch.Steamworks/Client/Achievements.cs +++ b/Facepunch.Steamworks/Client/Achievements.cs @@ -44,11 +44,20 @@ namespace Facepunch.Steamworks } /// - /// Unlock an achievement by identifier + /// Unlock an achievement by identifier. If apply is true this will happen as expected + /// and the achievement overlay will popup etc. If it's false then you'll have to manually + /// call Stats.StoreStats() to actually trigger it. /// - public bool Trigger( string identifier ) + public bool Trigger( string identifier, bool apply = true ) { - return client.native.userstats.SetAchievement( identifier ); + var r = client.native.userstats.SetAchievement( identifier ); + + if ( apply ) + { + client.Stats.StoreStats(); + } + + return r; } /// @@ -148,12 +157,19 @@ namespace Facepunch.Steamworks /// /// Make this achievement earned /// - public bool Trigger() + public bool Trigger( bool apply = true ) { State = true; UnlockTime = DateTime.Now; - return client.native.userstats.SetAchievement( Id ); + var r = client.native.userstats.SetAchievement( Id ); + + if ( apply ) + { + client.Stats.StoreStats(); + } + + return r; } ///