public override void DoPostConfigureComplete(GameObject go)
    {
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg       = 2700f;
        storage.allowSublimation = false;
        storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier>
        {
            Storage.StoredItemModifier.Hide,
            Storage.StoredItemModifier.Seal,
            Storage.StoredItemModifier.Insulate
        });
        OxidizerTank oxidizerTank = go.AddOrGet <OxidizerTank>();

        oxidizerTank.storage = storage;
        go.AddOrGet <DropToUserCapacity>();
        ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

        conduitConsumer.conduitType          = ConduitType.Liquid;
        conduitConsumer.consumptionRate      = 10f;
        conduitConsumer.capacityTag          = ElementLoader.FindElementByHash(SimHashes.LiquidOxygen).tag;
        conduitConsumer.capacityKG           = storage.capacityKg;
        conduitConsumer.forceAlwaysSatisfied = true;
        conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;
        RocketModule rocketModule = go.AddOrGet <RocketModule>();

        rocketModule.SetBGKAnim(Assets.GetAnim("rocket_oxidizer_tank_liquid_bg_kanim"));
        EntityTemplates.ExtendBuildingToRocketModule(go);
    }
    public float GetWetMass()
    {
        float num = 0f;

        foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>()))
        {
            RocketModule component = item.GetComponent <RocketModule>();
            if ((Object)component != (Object)null)
            {
                FuelTank     component2 = component.GetComponent <FuelTank>();
                OxidizerTank component3 = component.GetComponent <OxidizerTank>();
                SolidBooster component4 = component.GetComponent <SolidBooster>();
                if ((Object)component2 != (Object)null)
                {
                    num += component2.MassStored();
                }
                if ((Object)component3 != (Object)null)
                {
                    num += component3.MassStored();
                }
                if ((Object)component4 != (Object)null)
                {
                    num += component4.fuelStorage.MassStored();
                }
            }
        }
        return(num);
    }
예제 #3
0
    public override void DoPostConfigureComplete(GameObject go)
    {
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg       = 2700f;
        storage.allowSublimation = false;
        storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier>
        {
            Storage.StoredItemModifier.Hide,
            Storage.StoredItemModifier.Seal,
            Storage.StoredItemModifier.Insulate
        });
        OxidizerTank oxidizerTank = go.AddOrGet <OxidizerTank>();

        oxidizerTank.storage = storage;
        go.AddOrGet <DropToUserCapacity>();
        ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>();

        manualDeliveryKG.SetStorage(storage);
        manualDeliveryKG.requestedItemTag       = ElementLoader.FindElementByHash(SimHashes.OxyRock).tag;
        manualDeliveryKG.refillMass             = storage.capacityKg;
        manualDeliveryKG.capacity               = storage.capacityKg;
        manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.None;
        manualDeliveryKG.choreTypeIDHash        = Db.Get().ChoreTypes.MachineFetch.IdHash;
        RocketModule rocketModule = go.AddOrGet <RocketModule>();

        rocketModule.SetBGKAnim(Assets.GetAnim("rocket_oxidizer_tank_bg_kanim"));
        EntityTemplates.ExtendBuildingToRocketModule(go);
    }
예제 #4
0
            /// <summary>
            /// Applied after the setter runs.
            /// </summary>
            internal static void Postfix(OxidizerTank __instance)
            {
                var obj = __instance.gameObject;

                if (obj != null)
                {
                    obj.GetComponent <Storage>()?.Trigger((int)GameHashes.OnStorageChange, obj);
                }
            }
예제 #5
0
        /// <summary>
        /// Applied after the setter runs.
        /// </summary>
        internal static void Postfix(OxidizerTank __instance)
        {
            var obj = __instance.gameObject;

            if (obj != null && obj.TryGetComponent(out Storage storage))
            {
                storage.Trigger((int)GameHashes.OnStorageChange, obj);
            }
        }
예제 #6
0
            /// <summary>
            /// Applied after OnSpawn runs.
            /// </summary>
            internal static void Postfix(OxidizerTank __instance)
            {
                var storage = __instance.storage;

                __instance.gameObject.Subscribe((int)GameHashes.LaunchRocket, (_) => {
                    // Clear the contents
                    foreach (var item in storage.items)
                    {
                        Util.KDestroyGameObject(item);
                    }
                    storage.items.Clear();
                });
            }
    public float GetAverageOxidizerEfficiency()
    {
        Dictionary <Tag, float> dictionary = new Dictionary <Tag, float>();

        dictionary[SimHashes.LiquidOxygen.CreateTag()] = 0f;
        dictionary[SimHashes.OxyRock.CreateTag()]      = 0f;
        foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>()))
        {
            OxidizerTank component = item.GetComponent <OxidizerTank>();
            if ((Object)component != (Object)null)
            {
                Dictionary <Tag, float> oxidizersAvailable = component.GetOxidizersAvailable();
                foreach (KeyValuePair <Tag, float> item2 in oxidizersAvailable)
                {
                    if (dictionary.ContainsKey(item2.Key))
                    {
                        Dictionary <Tag, float> dictionary2;
                        Tag key;
                        (dictionary2 = dictionary)[key = item2.Key] = dictionary2[key] + item2.Value;
                    }
                }
            }
        }
        float num  = 0f;
        float num2 = 0f;

        foreach (KeyValuePair <Tag, float> item3 in dictionary)
        {
            num  += item3.Value * oxidizerEfficiencies[item3.Key];
            num2 += item3.Value;
        }
        if (num2 == 0f)
        {
            return(0f);
        }
        float num3 = num / num2;

        return(num3 * 100f);
    }
    public float GetTotalOxidizer(bool includeBoosters = false)
    {
        float num = 0f;

        foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>()))
        {
            OxidizerTank component = item.GetComponent <OxidizerTank>();
            if ((Object)component != (Object)null)
            {
                num += component.GetTotalOxidizerAvailable();
            }
            if (includeBoosters)
            {
                SolidBooster component2 = item.GetComponent <SolidBooster>();
                if ((Object)component2 != (Object)null)
                {
                    num += component2.fuelStorage.GetAmountAvailable(GameTags.OxyRock);
                }
            }
        }
        return(num);
    }
예제 #9
0
        public void GetOxidizerAmounts(out float oxyrock, out float lox)
        {
            oxyrock = 0;
            lox     = 0;

            foreach (GameObject gameObject in BuildingNetworkEnumerable())
            {
                OxidizerTank component = gameObject.GetComponent <OxidizerTank>();
                if (component != null)
                {
                    foreach (KeyValuePair <Tag, float> oxidizer in component.GetOxidizersAvailable())
                    {
                        if (oxidizer.Key == SimHashes.LiquidOxygen.CreateTag())
                        {
                            lox += oxidizer.Value;
                        }
                        else if (oxidizer.Key == SimHashes.OxyRock.CreateTag())
                        {
                            oxyrock += oxidizer.Value;
                        }
                    }
                }
            }
        }