public MechJebModuleAutom8(MechJebCore core) : base(core) { instance = this; luaEnv = LuaRuntime.CreateGlobalEnviroment(); mechjeb = new LuaTable(); core.registerLuaMembers(mechjeb); luaEnv.SetNameValue("mechjeb", mechjeb); luaEnv.SetNameValue("vessel", ObjectToLua.ToLuaValue(vesselState)); if (KSP.IO.File.Exists<MuMechJeb>("autorun.lua")) { try { LuaRuntime.GlobalEnvironment = luaEnv; LuaRuntime.RunFile("autorun.lua", luaEnv); } catch (Exception e) { A8Console.WriteLine(e.GetType().Name + ": " + e.Message); luaEnv.SetNameValue("lastError", ObjectToLua.ToLuaValue(e)); } } }
public MechJebModuleAutom8(MechJebCore core) : base(core) { instance = this; luaEnv = LuaRuntime.CreateGlobalEnviroment(); mechjeb = new LuaTable(); core.registerLuaMembers(mechjeb); luaEnv.SetNameValue("mechjeb", mechjeb); luaEnv.SetNameValue("vessel", ObjectToLua.ToLuaValue(vesselState)); if (KSP.IO.File.Exists <MuMechJeb>("autorun.lua")) { try { LuaRuntime.GlobalEnvironment = luaEnv; LuaRuntime.RunFile("autorun.lua", luaEnv); } catch (Exception e) { A8Console.WriteLine(e.GetType().Name + ": " + e.Message); luaEnv.SetNameValue("lastError", ObjectToLua.ToLuaValue(e)); } } }
public void onPartStart() { vesselState = new VesselState(); Version v = Assembly.GetAssembly(typeof(MechJebCore)).GetName().Version; version = v.Major.ToString() + "." + v.Minor.ToString() + "." + v.Build.ToString(); modules.Add(new MechJebModuleSmartASS(this)); modules.Add(new MechJebModuleTranslatron(this)); modules.Add(new MechJebModuleOrbitInfo(this)); modules.Add(new MechJebModuleSurfaceInfo(this)); modules.Add(new MechJebModuleVesselInfo(this)); modules.Add(new MechJebModuleLandingAutopilot(this)); modules.Add(new MechJebModuleAscentAutopilot(this)); modules.Add(new MechJebModuleOrbitOper(this)); modules.Add(new MechJebModuleRendezvous(this)); modules.Add(new MechJebModuleILS(this)); modules.Add(new MechJebModuleTablePhase(this)); //modules.Add(new MechJebModuleOrbitPlane(this)); //modules.Add(new MechJebModuleJoke(this)); //modules.Add(new MechJebModuleAscension(this)); autom8 = new MechJebModuleAutom8(this); modules.Add(autom8); foreach (ComputerModule module in modules) { module.onPartStart(); } part.Events.Add(new BaseEvent("MechJebLua", MechJebLua)); loadSettings(); }