Exemple #1
0
 public SosigScript()
 {
     //Set Console log
     Console = BepInEx.Logging.Logger.CreateLogSource("SosigScript");
     Logger.LogInfo("Initialising SosigScript");
     //Start up MoonSharp so scripts load faster
     Logger.LogDebug("Warming up scripts");
     Script.WarmUp();
     //Give it standard platform settings
     Logger.LogDebug("Setting Platform accessors");
     Script.GlobalOptions.Platform = new StandardPlatformAccessor();
     //Make a new manual log source specifically for checking if MoonSharp is initialised
     Logger.LogDebug("Setting DebugPrint logsource");
     Script.DefaultOptions.DebugPrint = message => { BepInEx.Logging.Logger.CreateLogSource("SosigScript (INITIALISATION)").LogInfo(message); };
     //Run a print command!
     Script.RunString("print('SosigScript initialised! Hello from Lua!')");
     //We set the "Soft Sandbox" so user has more options in their scripts
     ScriptLoader  = new Script(CoreModules.Preset_SoftSandbox);
     Libraries     = new LibraryLoader();
     ActiveScripts = new List <Executioner>();
 }