示例#1
0
 private void OffRailsHandler(Vessel v)
 {
     onRails = false;
     if (ControlLockerUtils.ShouldLock(vessel.Parts, true, out float _, out float _))
     {
         DisableAutopilot();
     }
 }
示例#2
0
 private void OffRailsHandler(Vessel v)
 {
     onRails = false;
     if (!CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(vessel.Parts, true, out float _, out float _))
     {
         DisableAutopilot();
     }
 }
示例#3
0
 private void OffRailsHandler(Vessel v)
 {
     _onRails = false;
     if (!CheatOptions.InfiniteElectricity && ControlLockerUtils.ShouldLock(Vessel.Parts, true, out _, out _, out _) != ControlLockerUtils.LockLevel.Unlocked)
     {
         DisableAutopilot();
     }
 }
示例#4
0
        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);
            }
        }
示例#5
0
 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);
 }
示例#6
0
 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;
         }
     }
 }
示例#7
0
 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;
         }
     }
 }
示例#8
0
        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);
        }
示例#9
0
文件: AvionicsGUI.cs 项目: yump/RP-0
 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;
             }
         }
     }
 }
示例#10
0
        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);
        }
示例#11
0
        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;
                    }
                }
            }
        }
示例#12
0
        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);
        }
示例#13
0
        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);
            }
        }
示例#14
0
 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);
 }