public void Unload(Vessel vessel, bool delete) { if (!vessel.isEVA) { OrXchaseDebug.DebugWarning("Tried unloading a non eva."); return; } OrXchaseDebug.DebugLog("Unload(" + vessel.name + ")"); foreach (var item in collection) { if (item.flightID == vessel.id) { if (delete) { item.status = Status.Removed; } //unload the vessel here. item.Unload(); OrXchaseSettings.SaveEva(item); OrXchaseDebug.DebugLog("Remove EVA: (" + vessel.name + ")"); collection.Remove(item); break; } } }
public void VesselDestroyed(Vessel report) { OrXchaseDebug.DebugLog("VesselDestroyed()"); if (report.isEVA) { Unload(report, true); } }
/// <summary> /// Runs when the EVA is killed. /// </summary> /// <param name="report"></param> public void OnCrewKilled(EventReport report) { OrXchaseDebug.DebugLog("OnCrewKilled()"); KerbalRoster boboo = new KerbalRoster(Game.Modes.SANDBOX); print(boboo[report.sender].name); //MonoBehaviour.print(report.origin); //MonoBehaviour.print(report.origin.vessel); Unload(report.origin.vessel, true); }
public bool Contains(Guid id) { OrXchaseDebug.DebugLog("Contains()"); for (int i = 0; i < collection.Count; i++) { if (collection[i].flightID == id) { return(true); } } return(false); }
public void Awake() { OrXchaseDebug.DebugLog("Loaded AddOrXchase."); ConfigNode EVA = new ConfigNode("MODULE"); EVA.AddValue("name", "OrXchaseModule"); try { PartLoader.getPartInfoByName("kerbalEVA").partPrefab.AddModule(EVA); } catch { } EVA = new ConfigNode("MODULE"); EVA.AddValue("name", "OrXchaseModule"); try { PartLoader.getPartInfoByName("kerbalEVAfemale").partPrefab.AddModule(EVA); } catch { } /* * EVA = new ConfigNode("MODULE"); * EVA.AddValue("name", "OrXchaseModule"); * * try * { * PartLoader.getPartInfoByName("OrX_OrxBonusBall").partPrefab.AddModule(EVA); * } * catch * { * * } * * EVA = new ConfigNode("MODULE"); * EVA.AddValue("name", "OrXchaseModule"); * * try * { * PartLoader.getPartInfoByName("OrX_OrxBonusBall2").partPrefab.AddModule(EVA); * } * catch * { * * } */ }
public void FromSave(string OrXchaseSettings) { OrXchaseTokenReader reader = new OrXchaseTokenReader(OrXchaseSettings); try { string sflightID = reader.NextTokenEnd(','); string sName = reader.NextTokenEnd(','); string mode = reader.NextTokenEnd(','); string status = reader.NextTokenEnd(','); string selected = reader.NextTokenEnd(','); string showHelmet = reader.NextTokenEnd(','); string formation = reader.NextToken('(', ')'); reader.Consume(); string patrol = reader.NextToken('(', ')'); reader.Consume(); string order = reader.NextToken('(', ')'); reader.Consume(); string wanderer = reader.NextToken('(', ')'); this.Name = sName; this.mode = (Mode)Enum.Parse(typeof(Mode), mode); this.status = (Status)Enum.Parse(typeof(Status), status); this.selected = bool.Parse(selected); this.showHelmet = bool.Parse(showHelmet); this.formation.FromSave(formation); this.patrol.FromSave(patrol); this.order.FromSave(order); this.wanderer.FromSave(wanderer); OrXchaseDebug.DebugLog("Loaded: " + mode); OrXchaseDebug.DebugLog("name: " + sName); OrXchaseDebug.DebugLog("status: " + status); OrXchaseDebug.DebugLog("selected: " + selected); if (this.showHelmet == false) { eva.ShowHelmet(this.showHelmet); } } catch { throw new Exception("[OrX Chase] FromSave Failed."); } }
private static void LoadFile() { string fileName = String.Format("Evas-{0}.txt", HighLogic.CurrentGame.Title); if (FileExcist(fileName)) { KSP.IO.TextReader tr = KSP.IO.TextReader.CreateForType <OrXchaseSettings>(fileName); string file = tr.ReadToEnd(); tr.Close(); OrXchaseTokenReader reader = new OrXchaseTokenReader(file); OrXchaseDebug.DebugLog("Size KeySize: " + collection.Count); //read every eva. while (!reader.EOF) { //Load all the eva's in the list. LoadEva(reader.NextToken('[', ']')); } } }
/// <summary> /// Runs when the kerbal goes on EVA. /// </summary> /// <param name="e"></param> public void OnCrewOnEva(GameEvents.FromToAction <Part, Part> e) { //add new kerbal OrXchaseDebug.DebugLog("OnCrewOnEva()"); Load(e.to.vessel); }
/// <summary> /// Load the list /// </summary> private void onFlightReadyCallback() { //Load the eva list. OrXchaseDebug.DebugLog("onFlightReadyCallback()"); OrXchaseSettings.Load(); }
/// <summary> /// Runs when the EVA goes onboard a vessel. /// </summary> /// <param name="e"></param> public void OnCrewBoardVessel(GameEvents.FromToAction <Part, Part> e) { //remove kerbal OrXchaseDebug.DebugLog("OnCrewBoardVessel()"); Unload(e.from.vessel, true); }