예제 #1
0
        /// <summary>
        /// Checks the status of a suit locker to see if the suit can be used.
        /// </summary>
        /// <param name="locker">The suit dock to check.</param>
        /// <param name="fullyCharged">Will contain with the suit if fully charged.</param>
        /// <param name="partiallyCharged">Will contain the suit if partially charged.</param>
        /// <param name="any">Will contain any suit inside.</param>
        /// <returns>true if the locker is vacant, or false if it is occupied.</returns>
        internal static bool GetSuitStatus(SuitLocker locker, out KPrefabID fullyCharged,
                                           out KPrefabID partiallyCharged, out KPrefabID any)
        {
            var   smi       = locker.smi;
            bool  vacant    = false;
            float minCharge = TUNING.EQUIPMENT.SUITS.MINIMUM_USABLE_SUIT_CHARGE;

            any = locker.GetStoredOutfit();
            // CanDropOffSuit calls GetStoredOutfit again, avoid!
            if (any == null)
            {
                if (smi.sm.isConfigured.Get(locker.smi) && !smi.sm.isWaitingForSuit.Get(
                        locker.smi))
                {
                    vacant = true;
                }
                fullyCharged     = null;
                partiallyCharged = null;
            }
            else if (any.TryGetComponent(out SuitTank tank) && tank.PercentFull() >=
                     minCharge)
            {
                // Check for jet suit tank of petroleum
                if (any.TryGetComponent(out JetSuitTank petroTank))
                {
                    fullyCharged     = (tank.IsFull() && petroTank.IsFull()) ? any : null;
                    partiallyCharged = (petroTank.PercentFull() >= minCharge) ? any : null;
                }
                else
                {
                    fullyCharged     = tank.IsFull() ? any : null;
                    partiallyCharged = any;
                }
            }
예제 #2
0
            public static bool Prefix(SuitLocker __instance)
            {
                if (OxygenNotNeededConfigChecker.ForceLoad || CustomGameSettings.Instance.GetCurrentQualitySetting(OxygenNotNeededPatches.WorldRequiresOxygen).id == "Enabled")
                {
                    KPrefabID storedOutfit = __instance.GetStoredOutfit();
                    if ((UnityEngine.Object)storedOutfit == (UnityEngine.Object)null)
                    {
                        return(false);
                    }

                    SuitTank component = storedOutfit.GetComponent <SuitTank>();
                    component.amount = component.capacity;
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
 public KPrefabID GetStoredOutfit()
 {
     return(suit_locker.GetStoredOutfit());
 }