public static void FlightAssistMods(GameObject vehicle) { flightAssist = vehicle.GetComponentInChildren <FlightAssist>(); //flightAssist.gLimit = 99999999f; /*if (glimit) * { * Debug.Log("enabled GLIM"); * flightAssist.pitchGLimiter = true; * flightAssist.gLimit = 10f; * flightAssist.assistEnabled = true; * * } * else * { * Debug.Log("disabled GLIM"); * * flightAssist.pitchGLimiter = false; * flightAssist.gLimit = 99999999f; * flightAssist.assistEnabled = false ; * }*/ }
public IEnumerator main() { while (VTMapManager.fetch == null || !VTMapManager.fetch.scenarioReady || FlightSceneManager.instance.switchingScene) { yield return(null); } buttonMade = false; Debug.Log("AAAAAAAA"); wm = VTOLAPI.GetPlayersVehicleGameObject().GetComponent <WeaponManager>(); flightAssist = VTOLAPI.GetPlayersVehicleGameObject().GetComponentInChildren <FlightAssist>(); Main.flightAssist.assistEnabled = false; { Main.MFDP = wm.gameObject.GetComponentInChildren <MFDPortalManager>(); MFDPStoresManagement MFDP = (MFDPStoresManagement)Main.MFDP.gameObject.GetComponentInChildren <MFDPortalManager>().pages[5]; Debug.Log("got MFPD"); GameObject toCopy = null; foreach (var resource in Resources.FindObjectsOfTypeAll <VRInteractable>()) { if (resource.interactableName == "Weapon Bay Door Overrides") { toCopy = resource.gameObject; break; } } if (toCopy == null) { Debug.LogError("To copy is null"); } //THANK YOU TEMPERZ87 FOR BUTTON CODE //create button object GameObject emptyButton = Instantiate(toCopy, MFDP.displayObj.gameObject.transform); //get transform object (position) RectTransform rt = emptyButton.GetComponent <RectTransform>(); Main.text1 = emptyButton.gameObject.GetComponentInChildren <Text>(); rt.localPosition = new Vector3(rt.localPosition.x - 50, rt.localPosition.y, rt.localPosition.z); rt.localScale = new Vector3(rt.localScale.x * 0.85f, rt.localScale.y * 0.85f, rt.localScale.z * 0.85f); rt.GetComponentInChildren <Image>().color = Color.black; Debug.Log("instantiate"); VRInteractable interactable = emptyButton.GetComponentInChildren <VRInteractable>(); Debug.Log("vr interactable"); Text text = emptyButton.GetComponentInChildren <Text>(); Debug.Log("text"); text.text = "FltAst"; Debug.Log("flightassist"); interactable.OnInteract = new UnityEvent(); Debug.Log("new UnityEvent()"); interactable.interactableName = "Toggle Flight Assist"; Debug.Log("toggle Flight Assist"); interactable.OnInteract.AddListener(new UnityAction(() => { Main.flightAssist.assistEnabled = !Main.flightAssist.assistEnabled; Main.MFDP.PlayInputSound(); Main.text1.color = Main.flightAssist.assistEnabled ? Color.green : Color.red; })); Debug.Log("listener"); Main.text1.color = Main.flightAssist.assistEnabled ? Color.green : Color.red; GameObject emptyButton2 = Instantiate(toCopy, MFDP.displayObj.gameObject.transform); RectTransform rt2 = emptyButton2.GetComponent <RectTransform>(); rt2.localPosition = new Vector3(rt2.localPosition.x - 85, rt.localPosition.y, rt.localPosition.z); rt2.localScale = new Vector3(rt2.localScale.x * 0.85f, rt2.localScale.y * 0.85f, rt2.localScale.z * 0.85f); rt2.GetComponentInChildren <Image>().color = Color.black; Debug.Log("instantiate"); VRInteractable interactable2 = emptyButton2.GetComponentInChildren <VRInteractable>(); Debug.Log("vr interactable"); text2 = emptyButton2.GetComponentInChildren <Text>(); Debug.Log("text"); text2.text = "Thrust"; Debug.Log("Thrust Event"); interactable2.OnInteract = new UnityEvent(); Debug.Log("new UnityEvent()"); interactable2.interactableName = "Toggle Ultra Thrust"; Debug.Log("Create Thrust Listener"); interactable2.OnInteract.AddListener(new UnityAction(() => { enableSuperThrust = !enableSuperThrust; Main.MFDP.PlayInputSound(); Main.text2.color = enableSuperThrust ? Color.green : Color.red; })); Main.text2.color = enableSuperThrust ? Color.green : Color.red; } }
void RepairAircraft() { FlightAssist flightAssist = GetComponentInChildren <FlightAssist>(); if (flightAssist != null) { flightAssist.assistEnabled = true; } else { Debug.Log("Could not fix flight assists"); } RCSController rcsController = GetComponentInChildren <RCSController>(); if (rcsController != null) { Traverse.Create(rcsController).Field("alive").SetValue(true); } else { Debug.Log("Could not fix rcs controller"); } Battery battery = GetComponentInChildren <Battery>(); if (battery != null) { Traverse.Create(battery).Field("isAlive").SetValue(true); battery.Connect(); } else { Debug.Log("Could not fix battery"); } GameObject hud = GameObject.Find("CollimatedHud"); if (hud != null) { hud.SetActive(true); } else { Debug.Log("Could not fix hud"); } GameObject hudWaypoint = GameObject.Find("WaypointLead"); if (hudWaypoint != null) { hudWaypoint.SetActive(true); } else { Debug.Log("Could not fix hudWaypoint"); } VRJoystick joystick = GetComponentInChildren <VRJoystick>(); if (joystick != null) { joystick.sendEvents = true; } else { Debug.Log("Could not fix joystick"); } VRInteractable[] levers = GetComponentsInChildren <VRInteractable>(); foreach (VRInteractable lever in levers) { lever.enabled = true; } Debug.Log("Fixed " + levers.Length + " levers"); }