public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
            PipedElectrolyzer electrolyzer = go.AddOrGet <PipedElectrolyzer>();

            electrolyzer.maxMass  = 1.8f;
            electrolyzer.hasMeter = true;

            ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

            conduitConsumer.conduitType        = ConduitType.Liquid;
            conduitConsumer.consumptionRate    = 1f;
            conduitConsumer.capacityTag        = ElementLoader.FindElementByHash(SimHashes.Water).tag;
            conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump;

            Storage storage = go.AddOrGet <Storage>();

            storage.capacityKg = 2f;
            storage.showInUI   = true;

            ConduitDispenser dispenser = go.AddOrGet <ConduitDispenser>();

            dispenser.conduitType         = ConduitType.Gas;
            dispenser.invertElementFilter = false;
            dispenser.elementFilter       = new SimHashes[1]
            {
                SimHashes.Oxygen
            };

            ElementConverter elementConverter = go.AddOrGet <ElementConverter>();

            elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
            {
                new ElementConverter.ConsumedElement(new Tag("Water"), 1f)
            };

            elementConverter.outputElements = new ElementConverter.OutputElement[2]
            {
                new ElementConverter.OutputElement(WATER2OXYGEN_RATIO, SimHashes.Oxygen, OXYGEN_TEMPERATURE, false, true, 0f, 1f, 1f, byte.MaxValue, 0),
                new ElementConverter.OutputElement(1 - WATER2OXYGEN_RATIO, SimHashes.Hydrogen, OXYGEN_TEMPERATURE, false, false, 0f, 1f, 1f, byte.MaxValue, 0)
            };

            Prioritizable.AddRef(go);
        }
Esempio n. 2
0
 private static bool OverPressure(int cell, PipedElectrolyzer electrolyzer)
 {
     return(Grid.Mass[cell] > electrolyzer.maxMass);
 }