public void PullCloser() { if (MaxDistance - WINCH_STEP_WIDTH > MIN_TETHER_LENGTH) { MaxDistance -= WINCH_STEP_WIDTH; } else { OSD.PostMessageLowerRightCorner("min tether length reached"); } }
public void IncreaseCableLength() { if (MaxDistance + WINCH_STEP_WIDTH < Config.Instance.MaxDistance) { MaxDistance += WINCH_STEP_WIDTH; } else { OSD.PostMessageLowerRightCorner("max tether length reached"); } }
private IEnumerator PreparePartForFreeAttach() { var newPart = PartFactory.SpawnPartInFlight("TetherHook", part, new Vector3(2, 2, 2), part.transform.rotation); OSD.PostMessageLowerRightCorner("waiting for Unity to catch up...", 1.5f); while (!newPart.rigidbody) { Debug.Log("[IRAS] rigidbody not ready - waiting"); try { DestroyImmediate(newPart.collider); } catch (Exception) { //sanity reason } try { newPart.transform.position = part.transform.position; } catch (NullReferenceException) { //sanity reason } try { newPart.mass = 0.000001f; newPart.maximum_drag = 0f; newPart.minimum_drag = 0f; } catch (NullReferenceException) { //sanity reason } yield return(new WaitForFixedUpdate()); } newPart.mass = 0.000001f; newPart.maximum_drag = 0f; newPart.minimum_drag = 0f; ActiveStrutsAddon.NewSpawnedPart = newPart; ActiveStrutsAddon.CurrentKerbalTargeter = this; ActiveStrutsAddon.Mode = AddonMode.AttachKerbalHook; }