public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { SuitLocker suitLocker = go.AddOrGet <SuitLocker>(); suitLocker.OutfitTags = new Tag[1] { GameTags.JetSuit }; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Gas; conduitConsumer.consumptionRate = 1f; conduitConsumer.capacityTag = ElementLoader.FindElementByHash(SimHashes.Oxygen).tag; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; conduitConsumer.forceAlwaysSatisfied = true; conduitConsumer.capacityKG = 200f; JetSuitLocker jetSuitLocker = go.AddComponent <JetSuitLocker>(); jetSuitLocker.portInfo = secondaryInputPort; AnimTileable animTileable = go.AddOrGet <AnimTileable>(); animTileable.tags = new Tag[2] { new Tag("JetSuitLocker"), new Tag("JetSuitMarker") }; Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 500f; Prioritizable.AddRef(go); }
/// <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; } }
private static void Prefix(SuitLocker __instance, Equipment equipment) { var assignable = equipment?.GetAssignable(Db.Get().AssignableSlots.Suit); var storage = __instance?.GetComponent <Storage>(); if (ShouldTransfer(assignable, equipment)) { Transfer(assignable, storage); } }
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); } }