catsethecat / vrmod-module

openvr module for garry's mod
zlib License
114 stars 32 forks source link

Add initialization checks #12

Open jorjic opened 2 years ago

jorjic commented 2 years ago

Fixes https://github.com/catsethecat/vrmod-module/issues/11

Swap out g_pSystem null checks with a new boolean value g_vrInitialized. Sets the boolean value to true during Init and sets it to false during Shutdown. Adds a new Lua function vrmod.IsInitialized(). Adds checks to every relevant Lua function checking for initialization and throwing an error instead of crashing the game. Compiled and tested with the vrmod addon from the workshop and found no problems.