diff --git a/Game.Shared/GarrysMod/LuaPlayer.cs b/Game.Shared/GarrysMod/LuaPlayer.cs index a28d8ef0..c4686f71 100644 --- a/Game.Shared/GarrysMod/LuaPlayer.cs +++ b/Game.Shared/GarrysMod/LuaPlayer.cs @@ -130,6 +130,13 @@ static int Player__AccountID(ILuaInterface lua) { return 1; } + [LuaMethod] + static int Player__IsListenServerHost(ILuaInterface lua) { + BasePlayer player = Get_Player(1, false)!; + lua.PushBool(!engine.IsDedicatedServer() && player.EntIndex() == 1); + return 1; + } + #if GAME_DLL [LuaMethod] static int Player__OwnerSteamID64(ILuaInterface lua) { diff --git a/Source.Common/Steam/Steamworks.cs b/Source.Common/Steam/Steamworks.cs index b9f66969..d036ac1d 100644 --- a/Source.Common/Steam/Steamworks.cs +++ b/Source.Common/Steam/Steamworks.cs @@ -10,8 +10,14 @@ namespace Source.Common.Steam; // I am very annoyed public class SteamworksDotNetBoasts100PercentCoverageOfTheNativeSteamworksAPIAcrossAllInterfaces { - [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern void SteamGameServer_RunCallbacks(); - [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern void SteamAPI_SetBreakpadAppID(uint unAppID); +#if WIN32 + const string SteamApiLibrary = "steam_api64"; +#else + const string SteamApiLibrary = "steam_api"; +#endif + + [DllImport(SteamApiLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern void SteamGameServer_RunCallbacks(); + [DllImport(SteamApiLibrary, CallingConvention = CallingConvention.Cdecl)] public static extern void SteamAPI_SetBreakpadAppID(uint unAppID); } // These are some hacks to access the internal pointers for steamclient