private void doHijack() { Debug.Log("[AirlockPlus] INFO: hijacking CrewHatchDialog for airlock " + airlock.gameObject.name + " on part " + airlockPart.partInfo.name + " of " + airlockPart.vessel.vesselName); // TextHeader chd.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = Localizer.Format("#autoLOC_AirlockPlus00000"); // Content transform of Scroll View Transform listContainer = chd.GetComponentInChildren <ContentSizeFitter>().transform; // Wipe the slate clean for (int i = listContainer.childCount - 1; i > 0; i--) { listContainer.GetChild(i).gameObject.SetActive(false); } // EmptyModuleText if (airlockPart.vessel.GetCrewCount() == 0) { listContainer.GetChild(0).gameObject.SetActive(true); chd = null; return; } listContainer.GetChild(0).gameObject.SetActive(false); // Crew in airlock part addCrewToList(listContainer, airlockPart); if (useCLS) { // Crew in other parts ICLSSpace clsSpace = CLSClient.GetCLS().getCLSVessel(airlockPart.vessel).Parts.Find(x => x.Part == airlockPart).Space; foreach (ICLSPart p in clsSpace.Parts) { if (p.Part != airlockPart) { addCrewToList(listContainer.transform, p.Part); } } // TextModuleCrew chd.transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = Localizer.Format("#autoLOC_AirlockPlusAP001", clsSpace.Crew.Count, clsSpace.MaxCrew); } else { // Crew in other parts foreach (Part p in airlockPart.vessel.parts) { if (p != airlockPart) { addCrewToList(listContainer.transform, p); } } // TextModuleCrew chd.transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = Localizer.Format("#autoLOC_AirlockPlusAP001", airlockPart.vessel.GetCrewCount(), airlockPart.vessel.GetCrewCapacity()); } chd = null; }
private void CLSBoardManualListParts() { Part p; foreach (ICLSPart clsp in CLSClient.GetCLS().getCLSVessel(tgtAirlockPart.vessel).Parts.Find(x => x.Part == tgtAirlockPart).Space.Parts) { p = clsp.Part; if (p.CrewCapacity > 0) { highlightParts.Add(p.flightID, p); p.Highlight(false); p.SetHighlightType(Part.HighlightType.Disabled); p.highlighter.ConstantOn(SpaceAvail(p) ? COLOR_AVAIL : COLOR_FULL); } } }
private void CLSBoardAuto() { Debug.Log("[AirlockPlus|BoardingPass] INFO: " + vessel.vesselName + " auto boarding " + tgtAirlockPart.vessel.vesselName + " via " + tgtAirlockPart.partInfo.name); ICLSSpace clsSpace = CLSClient.GetCLS().getCLSVessel(tgtAirlockPart.vessel).Parts.Find(x => x.Part == tgtAirlockPart).Space; // check in case of full vessel first if (clsSpace.Crew.Count >= clsSpace.MaxCrew) { Debug.Log("[AirlockPlus|BoardingPass] INFO: Auto boarding failed - CLS space full"); ScreenMessages.PostScreenMessage(scrmsgVesFull); // HACK: temporarily disable KerbalEVA for one update frame to prevent stock boarding from being registered alongside auto boarding // this prevents "spurious" stock "Cannot board a full module" message appearing alongside our auto boarding "Cannot board a full vessel" keva.enabled = false; autoBoardingFull = true; return; } // find part to board Part dest = null; if (SpaceAvail(tgtAirlockPart)) { // board the part itself if possible dest = tgtAirlockPart; } else { foreach (ICLSPart p in clsSpace.Parts) { if (SpaceAvail(p.Part)) { dest = p.Part; break; } } } if (dest == null) { Debug.Log("[AirlockPlus|BoardingPass] ERROR: Auto boarding target vessel at " + clsSpace.Crew.Count + "/" + clsSpace.MaxCrew + "of CLS space capacity, but somehow unable to find a part with space?!"); return; } keva.BoardPart(dest); }