Added clientside VScript functions for getting view position/direction

This commit is contained in:
Blixibon 2021-11-07 00:47:52 -05:00
parent 9ab5cb13e2
commit e30bde782a

View File

@ -15,11 +15,12 @@
#include "gamerules.h" #include "gamerules.h"
#include "vscript_client.nut" #include "vscript_client.nut"
#ifdef MAPBASE_VSCRIPT #ifdef MAPBASE_VSCRIPT
#include "mapbase/matchers.h" #include "view.h"
#include "c_world.h" #include "c_world.h"
#include "proxyentity.h" #include "proxyentity.h"
#include "materialsystem/imaterial.h" #include "materialsystem/imaterial.h"
#include "materialsystem/imaterialvar.h" #include "materialsystem/imaterialvar.h"
#include "mapbase/matchers.h"
#include "mapbase/vscript_singletons.h" #include "mapbase/vscript_singletons.h"
#endif #endif
@ -662,6 +663,20 @@ bool VScriptClientInit()
ScriptRegisterFunction( g_pScriptVM, IsWindowedMode, "" ); ScriptRegisterFunction( g_pScriptVM, IsWindowedMode, "" );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptScreenTransform, "ScreenTransform", "Get the x & y positions of a world position in screen space. Returns true if it's onscreen" ); ScriptRegisterFunctionNamed( g_pScriptVM, ScriptScreenTransform, "ScreenTransform", "Get the x & y positions of a world position in screen space. Returns true if it's onscreen" );
ScriptRegisterFunction( g_pScriptVM, MainViewOrigin, "" );
ScriptRegisterFunction( g_pScriptVM, MainViewAngles, "" );
ScriptRegisterFunction( g_pScriptVM, PrevMainViewOrigin, "" );
ScriptRegisterFunction( g_pScriptVM, PrevMainViewAngles, "" );
ScriptRegisterFunction( g_pScriptVM, MainViewForward, "" );
ScriptRegisterFunction( g_pScriptVM, MainViewRight, "" );
ScriptRegisterFunction( g_pScriptVM, MainViewUp, "" );
ScriptRegisterFunction( g_pScriptVM, CurrentViewOrigin, "" );
ScriptRegisterFunction( g_pScriptVM, CurrentViewAngles, "" );
ScriptRegisterFunction( g_pScriptVM, CurrentViewForward, "" );
ScriptRegisterFunction( g_pScriptVM, CurrentViewRight, "" );
ScriptRegisterFunction( g_pScriptVM, CurrentViewUp, "" );
ScriptRegisterFunction( g_pScriptVM, CreateProp, "Create an animating prop" ); ScriptRegisterFunction( g_pScriptVM, CreateProp, "Create an animating prop" );
#endif #endif