From a1ab1616c56589507af45e5674ee32ee360b14f0 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Mon, 17 Oct 2022 10:34:29 -0500 Subject: [PATCH] Added VScript functions for checking the platform the server/client is using --- .../shared/mapbase/vscript_funcs_shared.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sp/src/game/shared/mapbase/vscript_funcs_shared.cpp b/sp/src/game/shared/mapbase/vscript_funcs_shared.cpp index 76934119..4c6d4817 100644 --- a/sp/src/game/shared/mapbase/vscript_funcs_shared.cpp +++ b/sp/src/game/shared/mapbase/vscript_funcs_shared.cpp @@ -938,6 +938,26 @@ bool ScriptIsClient() #endif } +bool ScriptIsWindows() +{ + return IsWindows(); +} + +bool ScriptIsLinux() +{ + return IsLinux(); +} + +bool ScriptIsOSX() +{ + return IsOSX(); +} + +bool ScriptIsPosix() +{ + return IsPosix(); +} + // Notification printing on the right edge of the screen void NPrint( int pos, const char* fmt ) { @@ -1077,5 +1097,10 @@ void RegisterSharedScriptFunctions() ScriptRegisterFunction( g_pScriptVM, GetFrameCount, "Absolute frame counter" ); //ScriptRegisterFunction( g_pScriptVM, GetTickCount, "Simulation ticks" ); + ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsWindows, "IsWindows", "Returns true if the game is being run on a Windows machine." ); + ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsLinux, "IsLinux", "Returns true if the game is being run on a Linux machine." ); + ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsOSX, "IsOSX", "Returns true if the game is being run on an OSX machine." ); + ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsPosix, "IsPosix", "Returns true if the game is being run on a Posix machine." ); + RegisterScriptSingletons(); }