diff --git a/Facepunch.Steamworks/Client/Overlay.cs b/Facepunch.Steamworks/Client/Overlay.cs index 73da7fd..aefae2d 100644 --- a/Facepunch.Steamworks/Client/Overlay.cs +++ b/Facepunch.Steamworks/Client/Overlay.cs @@ -25,9 +25,16 @@ namespace Facepunch.Steamworks { internal Client client; + /// + /// Returns true if the Steam Overlay is actually available, false if it was not injected properly. + /// Note that it may take some time after Steam_Init() until the overlay injection is complete. + /// Also note that the overlay will only work if the Steam API is initialized before the rendering device is initialized. That means that + /// for Unity3D games the overlay is only available if the game was launched directly through Steam. Calling Steam_Init() from Mono + /// code is too late. + /// public bool Enabled { - get { return client.native.utils.IsOverlayEnabled(); } + get { return client.native != null ? client.native.utils.IsOverlayEnabled() : false; } } public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); } diff --git a/Facepunch.Steamworks/Server/ServerInit.cs b/Facepunch.Steamworks/Server/ServerInit.cs index b4787a2..cb37dee 100644 --- a/Facepunch.Steamworks/Server/ServerInit.cs +++ b/Facepunch.Steamworks/Server/ServerInit.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Runtime.InteropServices; using System.Text; @@ -42,6 +43,31 @@ namespace Facepunch.Steamworks GameDescription = gameDesc; } + public ServerInit(IPAddress ip, string modDir, string gameDesc) + { + IpAddress = ip.IpToInt32(); + ModDir = modDir; + GameDescription = gameDesc; + } + + /// + /// set the server ip + /// + public ServerInit Ip(string ip) + { + IpAddress = IPAddress.Parse(ip).IpToInt32(); + return this; + } + + /// + /// set the server ip + /// + public ServerInit Ip(IPAddress ip) + { + IpAddress = ip.IpToInt32(); + return this; + } + /// /// Set the Steam quert port /// diff --git a/Facepunch.Steamworks/Server/Stats.cs b/Facepunch.Steamworks/Server/Stats.cs index 0a28aa4..22c25ec 100644 --- a/Facepunch.Steamworks/Server/Stats.cs +++ b/Facepunch.Steamworks/Server/Stats.cs @@ -111,5 +111,42 @@ namespace Facepunch.Steamworks return data; } + + /// + /// Resets the unlock state of an achievement for the given user. Useful mainly for testing purposes. + /// If the "set by" field says "Official GS", only a registerd server IP may do this. + /// You should have called Refresh for this userid - which downloads the stats from the backend. + /// If you didn't call it this will always return false. + /// + public bool ClearUserAchievement(ulong steamid, string name) + { + return server.native.gameServerStats.ClearUserAchievement(steamid, name); + } + + /// + /// Awards an achievement for the given user. The achievement must have been set up in the steam backand. + /// If the "set by" field says "Official GS", only a registerd server IP may do this. + /// You should have called Refresh for this userid - which downloads the stats from the backend. + /// If you didn't call it this will always return false. + /// + public bool SetUserAchievement(ulong steamid, string name) + { + return server.native.gameServerStats.SetUserAchievement(steamid, name); + } + + /// + /// Returns true if the given user has the given achievement unlocked. The achievement must have been set up in the steam backand. + /// You should have called Refresh for this userid - which downloads the stats from the backend. + /// If you didn't call it this will always return false. + /// + public bool GetUserAchievement(ulong steamid, string name) + { + bool result = false; + if(!server.native.gameServerStats.GetUserAchievement(steamid, name, ref result)) + return false; + + return result; + } + } }