private void OffRailsHandler(Vessel v) { onRails = false; if (ControlLockerUtils.ShouldLock(vessel.Parts, true, out float _, out float _)) { DisableAutopilot(); } }
private void OffRailsHandler(Vessel v) { onRails = false; if (!CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(vessel.Parts, true, out float _, out float _)) { DisableAutopilot(); } }
private void OffRailsHandler(Vessel v) { _onRails = false; if (!CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(Vessel.Parts, true, out _, out _, out _) != ControlLockerUtils.LockLevel.Unlocked) { DisableAutopilot(); } }
private System.Collections.IEnumerator CheckLockCR() { while (HighLogic.LoadedSceneIsFlight) { yield return(new WaitForSeconds(updateFrequency)); cachedLockResult = !CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(vessel.Parts, true, out maxMass, out vesselMass); } }
public bool ShouldLock() { // if we have no active vessel, undo locks if (vessel is null) { return(cachedLockResult = false); } if (requested) { cachedLockResult = !CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(vessel.Parts, true, out maxMass, out vesselMass); } requested = false; return(cachedLockResult); }
public void Update() { deltaTime += Time.deltaTime; if (deltaTime > UPDATEINTERVAL) { deltaTime = 0; haveParts = false; isControlLocked = false; if (EditorLogic.fetch.ship?.Parts is List <Part> parts && parts.Count > 0) { isControlLocked = ControlLockerUtils.ShouldLock(parts, false, out maxMass, out vesselMass); haveParts = true; } } }
public void Update() { _deltaTime += Time.deltaTime; if (_deltaTime > UpdateInterval) { _deltaTime = 0; _haveParts = false; _isControlLocked = false; if (EditorLogic.fetch.ship?.Parts is List <Part> parts && parts.Count > 0) { _isControlLocked = ControlLockerUtils.ShouldLock(parts, false, out _maxMass, out _vesselMass); _haveParts = true; } } }
public bool ShouldLock() { if (vessel != FlightGlobals.ActiveVessel) { vParts = -1; vessel = FlightGlobals.ActiveVessel; } // if we have no active vessel, undo locks if ((object)vessel == null) { return(false); } // Do we need to update? if (vessel.Parts.Count != vParts) { vParts = vessel.Parts.Count; return(ControlLockerUtils.ShouldLock(vessel.Parts, true, out maxMass, out vesselMass)); } return(wasLocked); }
public void Update() { deltaTime += Time.deltaTime; if (deltaTime > UPDATEINTERVAL) { deltaTime = 0; haveParts = false; isControlLocked = false; List <Part> parts = null; if ((object)(EditorLogic.fetch.ship) != null) { parts = EditorLogic.fetch.ship.Parts; } if (parts != null) { if (parts.Count > 0) { isControlLocked = ControlLockerUtils.ShouldLock(parts, false, out maxMass, out vesselMass); haveParts = true; } } } }
public bool ShouldLock() { if (vessel != FlightGlobals.ActiveVessel) { vParts = -1; vessel = FlightGlobals.ActiveVessel; } // if we have no active vessel, undo locks if ((object)vessel == null) { return(false); } // Do we need to update? double cTime = Planetarium.GetUniversalTime(); if (vessel.Parts.Count != vParts || cTime > lastUT + updateFrequency) { lastUT = cTime; vParts = vessel.Parts.Count; return(ControlLockerUtils.ShouldLock(vessel.Parts, true, out maxMass, out vesselMass)); } return(wasLocked); }
public void Update() { // toggle visibility if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(key)) { if (guiEnabled && showOnlyWarning && !isControlLocked) { showOnlyWarning = false; } else { guiEnabled = !guiEnabled; } } deltaTime += TimeWarp.deltaTime; if (deltaTime > UPDATEINTERVAL) { deltaTime = 0; haveParts = false; isControlLocked = false; List <Part> parts = null; if ((object)(EditorLogic.fetch.ship) != null) { parts = EditorLogic.fetch.ship.Parts; } if (parts != null) { if (parts.Count > 0) { isControlLocked = ControlLockerUtils.ShouldLock(parts, false, out maxMass, out vesselMass); haveParts = true; } } } }
public bool ShouldLock() { if (vessel != FlightGlobals.ActiveVessel) { vessel = FlightGlobals.ActiveVessel; masterMechJeb = null; } // if we have no active vessel, undo locks if (vessel is null) { return(false); } // Do we need to update? double cTime = Planetarium.GetUniversalTime(); if (requested || cTime > lastUT + updateFrequency) { lastUT = cTime; requested = false; return(ControlLockerUtils.ShouldLock(vessel.Parts, true, out maxMass, out vesselMass)); } return(wasLocked); }
private IEnumerator CheckLockCR() { const int maxFramesWaited = 250; int i = 0; do { yield return(new WaitForFixedUpdate()); } while ((FlightGlobals.ActiveVessel == null || FlightGlobals.ActiveVessel.packed) && i++ < maxFramesWaited); while (HighLogic.LoadedSceneIsFlight) { yield return(new WaitForSeconds(UpdateFrequency)); _cachedLockResult = CheatOptions.InfiniteElectricity ? ControlLockerUtils.LockLevel.Unlocked : ControlLockerUtils.ShouldLock(Vessel.Parts, true, out _maxMass, out _vesselMass, out _isLimitedByNonInterplanetary); } }
public ControlLockerUtils.LockLevel ShouldLock() { // if we have no active vessel, undo locks if (Vessel is null) { return(_cachedLockResult = ControlLockerUtils.LockLevel.Unlocked); } if (_requested) { _cachedLockResult = CheatOptions.InfiniteElectricity ? ControlLockerUtils.LockLevel.Unlocked : ControlLockerUtils.ShouldLock(Vessel.Parts, true, out _maxMass, out _vesselMass, out _isLimitedByNonInterplanetary); } _requested = false; return(_cachedLockResult); }