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

            energyGenerator.formula = EnergyGenerator.CreateSimpleFormula(SimHashes.RefinedCarbon.CreateTag(), 1f, 600f,
                                                                          SimHashes.CarbonDioxide, 0.25f, true, CellOffset.none, 700f);
            energyGenerator.meterOffset = Meter.Offset.Behind;
            energyGenerator.SetSliderValue(50f, 0);
            energyGenerator.powerDistributionOrder = 9;
            var storage = go.AddOrGet <Storage>();

            storage.capacityKg = 600f;
            go.AddOrGet <LoopingSounds>();
            Prioritizable.AddRef(go);
            var manualDeliveryKg = go.AddOrGet <ManualDeliveryKG>();

            manualDeliveryKg.SetStorage(storage);
            manualDeliveryKg.requestedItemTag = SimHashes.RefinedCarbon.CreateTag();
            manualDeliveryKg.capacity         = storage.capacityKg;
            manualDeliveryKg.refillMass       = 100f;
            manualDeliveryKg.choreTypeIDHash  = Db.Get().ChoreTypes.PowerFetch.IdHash;
            Tinkerable.MakePowerTinkerable(go);

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

            conduitDispenser.conduitType         = ConduitType.Gas;
            conduitDispenser.invertElementFilter = false;
            conduitDispenser.elementFilter       = new []
            {
                SimHashes.CarbonDioxide
            };
        }
Exemple #2
0
            public override void DoPostConfigureComplete(GameObject go)
            {
                GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_N1_0);
                go.AddOrGet <LogicOperationalController>();
                go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
                go.AddOrGet <LoopingSounds>();
                go.AddOrGet <Storage>();
                ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

                conduitConsumer.conduitType          = ConduitType.Gas;
                conduitConsumer.consumptionRate      = 1f;
                conduitConsumer.capacityTag          = GameTagExtensions.Create(SimHashes.Hydrogen);
                conduitConsumer.capacityKG           = 2f;
                conduitConsumer.forceAlwaysSatisfied = true;
                conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;
                EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

                energyGenerator.formula = EnergyGenerator.CreateSimpleFormula(SimHashes.Hydrogen.CreateTag(), 0.1f, 2f, SimHashes.Void, 0f, true, default(CellOffset), 0f);
                energyGenerator.powerDistributionOrder     = 8;
                energyGenerator.ignoreBatteryRefillPercent = true;
                energyGenerator.meterOffset = Meter.Offset.Behind;

                Tinkerable.MakePowerTinkerable(go);
                go.AddOrGetDef <PoweredActiveController.Def>();
            }
Exemple #3
0
 public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
 {
     go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery);
     go.AddOrGet <LoopingSounds>();
     Prioritizable.AddRef(go);
     Tinkerable.MakePowerTinkerable(go);
 }
Exemple #4
0
        // сделать постройку улучшаемой
        internal static Tinkerable MakeMachineTinkerable(GameObject go)
        {
            var tinkerable = Tinkerable.MakePowerTinkerable(go);

            tinkerable.tinkerMaterialTag    = MechanicsStationConfig.TINKER_TOOLS;
            tinkerable.tinkerMaterialAmount = 1f;
            tinkerable.addedEffect          = MACHINE_TINKER_EFFECT_NAME;
            tinkerable.requiredSkillPerk    = REQUIRED_ROLE_PERK;
            tinkerable.SetWorkTime(MACHINE_TINKERABLE_WORKTIME);
            tinkerable.choreTypeTinker = Db.Get().ChoreTypes.MachineTinker.IdHash;
            tinkerable.choreTypeFetch  = Db.Get().ChoreTypes.MachineFetch.IdHash;
            // увеличение времени эффекта
            tinkerable.effectAttributeId = Db.Get().Attributes.Machinery.Id;
            tinkerable.effectMultiplier  = MACHINE_TINKER_EFFECT_DURATION_PER_SKILL;

            go.AddOrGet <RoomTracker>().requiredRoomType = Db.Get().RoomTypes.MachineShop.Id;
            // а это для корректного изменения времени работы после изменения в настройках
            go.GetComponent <KPrefabID>().prefabSpawnFn += delegate(GameObject prefab)
            {
                var _tinkerable = prefab.GetComponent <Tinkerable>();
                if (_tinkerable != null)
                {
                    _tinkerable.workTime          = MechanicsStationOptions.Instance.machine_tinkerable_worktime;
                    _tinkerable.WorkTimeRemaining = Mathf.Min(_tinkerable.WorkTimeRemaining, _tinkerable.workTime);
                    _tinkerable.effectMultiplier  = MechanicsStationOptions.Instance.machine_tinker_effect_duration_per_skill / 100;
                }
            };
            // если "Rooms Expanded" найден, добавляем в кухонные постройки компонент для работы в нескольких комнатах.
            if (RoomsExpandedFound && go.HasTag(KitchenBuildingTag))
            {
                var multiRoomTracker = go.AddOrGet <MultiRoomTracker>();
                multiRoomTracker.possibleRoomTypes = new string[] { Db.Get().RoomTypes.MachineShop.Id, KitchenRoom.Id };
            }
            return(tinkerable);
        }
        public override void DoPostConfigureComplete(GameObject go)
        {
            go.AddOrGet <LogicOperationalController>();
            var engine     = go.AddOrGet <StirlingEngine>();
            var tinkerable = Tinkerable.MakePowerTinkerable(go);

            tinkerable.SetWorkTime(120f);

            go.AddOrGetDef <PoweredActiveController.Def>();
        }
        public override void DoPostConfigureComplete(GameObject go)
        {
            go.AddOrGet <LogicOperationalController>();
            go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
            go.AddOrGet <LoopingSounds>();
            Prioritizable.AddRef(go);
            go.AddOrGet <SquirrelGenerator>().powerDistributionOrder = 10;
            var kBatchedAnimController = go.AddOrGet <KBatchedAnimController>();

            kBatchedAnimController.fgLayer     = Grid.SceneLayer.BuildingFront;
            kBatchedAnimController.initialAnim = "off";
            Tinkerable.MakePowerTinkerable(go);
        }
Exemple #7
0
    public override void DoPostConfigureComplete(GameObject go)
    {
        GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0);
        go.AddOrGet <LogicOperationalController>();
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        go.AddOrGet <LoopingSounds>();
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg = 50f;
        ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

        conduitConsumer.conduitType          = ConduitType.Gas;
        conduitConsumer.consumptionRate      = 0.900000036f;
        conduitConsumer.capacityTag          = GameTags.CombustibleGas;
        conduitConsumer.capacityKG           = 0.900000036f;
        conduitConsumer.forceAlwaysSatisfied = true;
        conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;
        EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

        energyGenerator.powerDistributionOrder     = 8;
        energyGenerator.ignoreBatteryRefillPercent = true;
        EnergyGenerator.Formula formula = default(EnergyGenerator.Formula);
        formula.inputs = new EnergyGenerator.InputItem[1]
        {
            new EnergyGenerator.InputItem(GameTags.CombustibleGas, 0.09f, 0.900000036f)
        };
        formula.outputs = new EnergyGenerator.OutputItem[2]
        {
            new EnergyGenerator.OutputItem(SimHashes.DirtyWater, 0.0675f, false, new CellOffset(1, 1), 313.15f),
            new EnergyGenerator.OutputItem(SimHashes.CarbonDioxide, 0.0225f, true, new CellOffset(0, 2), 383.15f)
        };
        energyGenerator.formula = formula;
        ConduitDispenser conduitDispenser = go.AddOrGet <ConduitDispenser>();

        conduitDispenser.conduitType         = ConduitType.Gas;
        conduitDispenser.invertElementFilter = true;
        conduitDispenser.elementFilter       = new SimHashes[2]
        {
            SimHashes.Methane,
            SimHashes.Syngas
        };
        Tinkerable.MakePowerTinkerable(go);
        go.AddOrGetDef <PoweredActiveController.Def>();
    }
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery);
            CoalEnergyGenerator energyGenerator = go.AddOrGet <CoalEnergyGenerator>();

            energyGenerator.formula = EnergyGenerator.CreateSimpleFormula(SimHashes.Carbon.CreateTag(), 1f, 600f, SimHashes.Void, 0f, true);
            energyGenerator.powerDistributionOrder = 9;
            Storage storage = go.AddOrGet <Storage>();

            storage.capacityKg = 600f;
            go.AddOrGet <LoopingSounds>();
            Prioritizable.AddRef(go);
            CoalManualDeliveryKG manualDeliveryKG = go.AddOrGet <CoalManualDeliveryKG>();

            manualDeliveryKG.SetStorage(storage);
            manualDeliveryKG.requestedItemTag       = new Tag("Coal");
            manualDeliveryKG.ignoresOperationStatus = true;
            manualDeliveryKG.capacity   = storage.capacityKg;
            manualDeliveryKG.refillMass = 100f;
            manualDeliveryKG.choreTags  = new Tag[]
            {
                GameTags.ChoreTypes.Power
            };
            manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.PowerFetch.IdHash;

            BuildingElementEmitter buildingElementEmitter = go.AddOrGet <BuildingElementEmitter>();

            buildingElementEmitter.emitRate       = 0.02f;
            buildingElementEmitter.temperature    = 310f;
            buildingElementEmitter.element        = SimHashes.CarbonDioxide;
            buildingElementEmitter.modifierOffset = new Vector2(1f, 2f);

            DualSlider dualSlider = go.AddOrGet <DualSlider>();

            dualSlider.fillUptoThreshold = manualDeliveryKG.capacity;
            dualSlider.refillThreshold   = manualDeliveryKG.refillMass;

            CoalDeliveryController controller = go.AddOrGet <CoalDeliveryController>();

            controller.batteryRefillPercent = 0.5f;

            Tinkerable.MakePowerTinkerable(go);
        }
Exemple #9
0
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
            EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

            energyGenerator.formula                = EnergyGenerator.CreateSimpleFormula(SimHashes.Water.CreateTag(), 1f, 10f, SimHashes.Water, 1f, true, new CellOffset(0, 0), 0f);
            energyGenerator.meterOffset            = Meter.Offset.Behind;
            energyGenerator.powerDistributionOrder = 15;
            go.AddOrGet <LoopingSounds>();
            Prioritizable.AddRef(go);
            Storage storage = go.AddOrGet <Storage>();

            storage.capacityKg = 10f;

            storage.showInUI         = true;
            storage.allowItemRemoval = false;
            storage.showDescriptor   = true;
            storage.fetchCategory    = Storage.FetchCategory.GeneralStorage;
            Tinkerable.MakePowerTinkerable(go);
            go.AddOrGet <BrisInfiniteGenerator>();
        }
    public override void DoPostConfigureComplete(GameObject go)
    {
        GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0);
        go.AddOrGet <LogicOperationalController>();
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        go.AddOrGet <BuildingComplete>().isManuallyOperated = true;
        go.AddOrGet <LoopingSounds>();
        Prioritizable.AddRef(go);
        Generator generator = go.AddOrGet <Generator>();

        generator.powerDistributionOrder = 10;
        ManualGenerator manualGenerator = go.AddOrGet <ManualGenerator>();

        manualGenerator.SetSliderValue(50f, 0);
        manualGenerator.workLayer = Grid.SceneLayer.BuildingFront;
        KBatchedAnimController kBatchedAnimController = go.AddOrGet <KBatchedAnimController>();

        kBatchedAnimController.fgLayer     = Grid.SceneLayer.BuildingFront;
        kBatchedAnimController.initialAnim = "off";
        Tinkerable.MakePowerTinkerable(go);
    }
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery);
            EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

            energyGenerator.formula = EnergyGenerator.CreateSimpleFormula(
                SimHashes.Hydrogen.CreateTag(), HYDROGEN_BURN_RATE, 10f,
                SimHashes.Iron, IRON_CREATE_RATE, true, new CellOffset(0, 0), 473.15f);

            energyGenerator.meterOffset                = Meter.Offset.Behind;
            energyGenerator.powerDistributionOrder     = 9;
            energyGenerator.ignoreBatteryRefillPercent = true;

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

            storage.capacityKg = STORAGE_SIZE;

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

            conduitConsumer.conduitType          = ConduitType.Gas;
            conduitConsumer.consumptionRate      = 2f;
            conduitConsumer.capacityKG           = 8f;
            conduitConsumer.forceAlwaysSatisfied = true;
            conduitConsumer.capacityTag          = GameTagExtensions.Create(SimHashes.Hydrogen);
            conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;

            ElementDropper elementDropper = go.AddOrGet <ElementDropper>();

            elementDropper.emitTag    = new Tag("Iron");
            elementDropper.emitMass   = 10f;
            elementDropper.emitOffset = new Vector3(0f, 0f, 0f);

            //FusionReactor reactor = go.AddOrGet<FusionReactor>();

            go.AddOrGet <LoopingSounds>();
            Prioritizable.AddRef(go);
            Tinkerable.MakePowerTinkerable(go);
            go.AddOrGet <MinimumOperatingTemperature>().minimumTemperature = 373.15f;
        }
    public override void DoPostConfigureComplete(GameObject go)
    {
        GeneratedBuildings.RegisterLogicPorts(go, LogicOperationalController.INPUT_PORTS_0_0);
        go.AddOrGet <LogicOperationalController>();
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        go.AddOrGet <LoopingSounds>();
        go.AddOrGet <Storage>();
        BuildingDef def = go.GetComponent <Building>().Def;
        float       num = 20f;

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

        conduitConsumer.conduitType          = def.InputConduitType;
        conduitConsumer.consumptionRate      = 10f;
        conduitConsumer.capacityTag          = GameTags.CombustibleLiquid;
        conduitConsumer.capacityKG           = num;
        conduitConsumer.forceAlwaysSatisfied = true;
        conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;
        EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

        energyGenerator.powerDistributionOrder     = 8;
        energyGenerator.ignoreBatteryRefillPercent = true;
        energyGenerator.hasMeter = true;
        EnergyGenerator.Formula formula = default(EnergyGenerator.Formula);
        formula.inputs = new EnergyGenerator.InputItem[1]
        {
            new EnergyGenerator.InputItem(GameTags.CombustibleLiquid, 2f, num)
        };
        formula.outputs = new EnergyGenerator.OutputItem[2]
        {
            new EnergyGenerator.OutputItem(SimHashes.CarbonDioxide, 0.5f, false, new CellOffset(0, 3), 383.15f),
            new EnergyGenerator.OutputItem(SimHashes.DirtyWater, 0.75f, false, new CellOffset(1, 1), 313.15f)
        };
        energyGenerator.formula = formula;
        Tinkerable.MakePowerTinkerable(go);
        go.AddOrGetDef <PoweredActiveController.Def>();
    }
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        EnergyGenerator energyGenerator = go.AddOrGet <EnergyGenerator>();

        energyGenerator.formula     = EnergyGenerator.CreateSimpleFormula(SimHashes.Carbon.CreateTag(), 1f, 600f, SimHashes.CarbonDioxide, 0.02f, false, new CellOffset(1, 2), 383.15f);
        energyGenerator.meterOffset = Meter.Offset.Behind;
        energyGenerator.SetSliderValue(50f, 0);
        energyGenerator.powerDistributionOrder = 9;
        Storage storage = go.AddOrGet <Storage>();

        storage.capacityKg = 600f;
        go.AddOrGet <LoopingSounds>();
        Prioritizable.AddRef(go);
        ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>();

        manualDeliveryKG.SetStorage(storage);
        manualDeliveryKG.requestedItemTag = new Tag("Coal");
        manualDeliveryKG.capacity         = storage.capacityKg;
        manualDeliveryKG.refillMass       = 100f;
        manualDeliveryKG.choreTypeIDHash  = Db.Get().ChoreTypes.PowerFetch.IdHash;
        Tinkerable.MakePowerTinkerable(go);
    }
        // сделать постройку улучшаемой
        private static Tinkerable MakeMachineTinkerable(GameObject go)
        {
            var tinkerable = Tinkerable.MakePowerTinkerable(go);

            tinkerable.tinkerMaterialTag    = MechanicsStationConfig.TINKER_TOOLS;
            tinkerable.tinkerMaterialAmount = 1f;
            tinkerable.addedEffect          = MACHINE_TINKER_EFFECT_NAME;
            tinkerable.requiredSkillPerk    = REQUIRED_ROLE_PERK;
            tinkerable.SetWorkTime(MACHINE_TINKERABLE_WORKTIME);
            tinkerable.choreTypeTinker = Db.Get().ChoreTypes.MachineTinker.IdHash;
            tinkerable.choreTypeFetch  = Db.Get().ChoreTypes.MachineFetch.IdHash;
            go.AddOrGet <RoomTracker>().requiredRoomType = Db.Get().RoomTypes.MachineShop.Id;
            go.GetComponent <KPrefabID>().prefabSpawnFn += delegate(GameObject prefab)
            {
                var _tinkerable = prefab.GetComponent <Tinkerable>();
                if (_tinkerable != null)
                {
                    _tinkerable.workTime          = MechanicsStationOptions.Instance.MachineTinkerableWorkTime;
                    _tinkerable.WorkTimeRemaining = Mathf.Min(_tinkerable.WorkTimeRemaining, _tinkerable.workTime);
                }
            };
            return(tinkerable);
        }