Exemplo n.º 1
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>();
            }
Exemplo n.º 2
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);
        }
Exemplo n.º 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);
 }
        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
            };
        }
 private static void Postfix(GameObject plant)
 {
     if (plant.GetComponent <Crop>() == null)
     {
         plant.AddOrGet <ExtraSeedProducer>().isNotDecorative = plant.HasTag(OxyfernConfig.ID) || plant.HasTag(ColdBreatherConfig.ID);
         Tinkerable.MakeFarmTinkerable(plant);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Applied after OnCompleteWork runs.
        /// </summary>
        internal static void Postfix(Tinkerable __instance)
        {
            var inst = AchievementPatches.Instance;

            if (__instance.tinkerMaterialTag == PowerStationToolsConfig.tag && inst != null)
            {
                inst.tuneUps++;
            }
        }
            private static void Postfix(Tinkerable __instance, ref bool __result)
            {
                var extra = __instance.GetComponent <ExtraSeedProducer>();

                if (extra != null)
                {
                    __result = __result || !extra.ShouldFarmTinkerTending;
                }
                // todo: может быть. прикрутить запрет убобрять засохшие или полностью выросшие.
            }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 10
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);
        }
    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);
    }
            private static void Postfix(Tinkerable __instance, Worker worker)
            {
                var extra = __instance.GetComponent <ExtraSeedProducer>();

                if (extra != null && !extra.ExtraSeedAvailable)
                {
                    // шанс получить семя за счет навыка фермера
                    float seedChance = worker.GetComponent <AttributeConverters>().Get(ExtraSeedTendingChance).Evaluate();
                    // множитель длительности эффекта.
                    float effectMultiplier =
#if EXPANSION1
                        worker.GetAttributes().Get(Db.Get().Attributes.Get(__instance.effectAttributeId)).GetTotalValue() * __instance.effectMultiplier +
#endif
                        1f;
                    // чем выше навык, тем дольше эффект, тем реже убобряют, поэтому перемножаем чтобы выровнять шансы

                    Debug.Log($"Tinkerable ExtraSeed effectMultiplier={effectMultiplier}, seedChance={seedChance}");

                    extra.CreateExtraSeed(seedChance * effectMultiplier);
                }
            }
Exemplo n.º 14
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>();
        }
Exemplo n.º 15
0
        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>();
    }
Exemplo n.º 17
0
        // сделать постройку улучшаемой
        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);
        }
    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 void Postfix(ref GameObject __result)
 {
     Tinkerable.MakeFarmTinkerable(__result);
     __result.AddOrGet <TinkerableOxyfern>();
 }
Exemplo n.º 20
0
    public static GameObject ExtendEntityToBasicPlant(GameObject template, float temperature_lethal_low = 218.15f, float temperature_warning_low = 283.15f, float temperature_warning_high = 303.15f, float temperature_lethal_high = 398.15f, SimHashes[] safe_elements = null, bool pressure_sensitive = true, float pressure_lethal_low = 0f, float pressure_warning_low = 0.15f, string crop_id = null, bool can_drown = true, bool can_tinker = true, bool require_solid_tile = true, bool should_grow_old = true, float max_age = 2400f)
    {
        template.AddOrGet <EntombVulnerable>();
        PressureVulnerable pressureVulnerable = template.AddOrGet <PressureVulnerable>();

        if (pressure_sensitive)
        {
            PressureVulnerable pressureVulnerable2 = pressureVulnerable;
            SimHashes[]        safeAtmospheres     = safe_elements;
            pressureVulnerable2.Configure(pressure_warning_low, pressure_lethal_low, 10f, 30f, safeAtmospheres);
        }
        else
        {
            pressureVulnerable.Configure(safe_elements);
        }
        template.AddOrGet <WiltCondition>();
        template.AddOrGet <Prioritizable>();
        template.AddOrGet <Uprootable>();
        if (require_solid_tile)
        {
            template.AddOrGet <UprootedMonitor>();
        }
        template.AddOrGet <ReceptacleMonitor>();
        template.AddOrGet <Notifier>();
        if (can_drown)
        {
            template.AddOrGet <DrowningMonitor>();
        }
        TemperatureVulnerable temperatureVulnerable = template.AddOrGet <TemperatureVulnerable>();

        temperatureVulnerable.Configure(temperature_warning_low, temperature_lethal_low, temperature_warning_high, temperature_lethal_high);
        template.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1]
        {
            ObjectLayer.Building
        };
        KPrefabID component = template.GetComponent <KPrefabID>();

        if (crop_id != null)
        {
            GeneratedBuildings.RegisterWithOverlay(OverlayScreen.HarvestableIDs, component.PrefabID().ToString());
            Crop.CropVal cropval = CROPS.CROP_TYPES.Find((Crop.CropVal m) => m.cropId == crop_id);
            Crop         crop    = template.AddOrGet <Crop>();
            crop.Configure(cropval);
            Growing growing = template.AddOrGet <Growing>();
            growing.growthTime    = cropval.cropDuration;
            growing.shouldGrowOld = should_grow_old;
            growing.maxAge        = max_age;
            template.AddOrGet <Harvestable>();
            template.AddOrGet <HarvestDesignatable>();
        }
        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component2 = inst.GetComponent <PressureVulnerable>();
            if (safe_elements != null)
            {
                SimHashes[] array = safe_elements;
                foreach (SimHashes hash in array)
                {
                    component2.safe_atmospheres.Add(ElementLoader.FindElementByHash(hash));
                }
            }
        };
        if (can_tinker)
        {
            Tinkerable.MakeFarmTinkerable(template);
        }
        return(template);
    }
 private static void Postfix(ref GameObject __result)
 {
     Tinkerable.MakeFarmTinkerable(__result);
     __result.AddOrGet <TinkerableColdBreather>();
 }
Exemplo n.º 22
0
        };                                                                                                                                                                                     //wilt1, grow_seed

        public static void ProcessPlant(GameObject plant)
        {
            PlantData setting = CustomizePlantsState.StateManager.State.PlantSettings?.FirstOrDefault(t => t.id == plant.name);

            if (setting == null)
            {
                return;
            }

            #region decor plant fixes
            if (setting.fruitId != null)    //decor plant fixes
            {
                PrickleGrass grass = plant.GetComponent <PrickleGrass>();
                if (grass != null || plant.name == ColdBreatherConfig.ID || plant.name == EvilFlowerConfig.ID)
                {
                    UnityEngine.Object.DestroyImmediate(grass); //what happens if this is null?
                    plant.AddOrGet <StandardCropPlant>();

                    KPrefabID prefab = plant.GetComponent <KPrefabID>();
                    prefab.prefabInitFn += (inst =>
                    {
                        StandardCropPlant stdcrop2 = inst.GetComponent <StandardCropPlant>();
                        stdcrop2.anims = PlantHelper.DecorAnim;
                    });

                    //KBatchedAnimController kbatchedAnimController = plant.AddOrGet<KBatchedAnimController>();
                    //kbatchedAnimController.AnimFiles = new KAnimFile[1]
                    //{
                    //  Assets.GetAnim("bristleblossom_kanim")
                    //};
                    //kbatchedAnimController.initialAnim = "idle_empty";
                }

                SeedProducer seed = plant.GetComponent <SeedProducer>();
                if (seed != null)
                {
                    seed.seedInfo.productionType   = SeedProducer.ProductionType.Harvest;
                    seed.seedInfo.newSeedsProduced = 1;
                }
            }
            #endregion
            #region fruitId
            if (setting.fruitId != null || setting.fruit_grow_time != null || setting.fruit_amount != null)    //actual setting fruit
            {
                Crop         crop    = plant.AddOrGet <Crop>();
                Crop.CropVal cropval = crop.cropVal;   //this is a copy
                if (setting.fruitId != null)
                {
                    cropval.cropId = setting.fruitId;
                }
                if (cropval.cropId == "")
                {
                    cropval.cropId = "WoodLog";
                }
                if (setting.fruit_grow_time != null)
                {
                    cropval.cropDuration = (float)setting.fruit_grow_time;
                }
                if (cropval.cropDuration < 1f)
                {
                    cropval.cropDuration = 1f;
                }
                if (setting.fruit_amount != null)
                {
                    cropval.numProduced = (int)setting.fruit_amount;
                }
                if (cropval.numProduced < 1)
                {
                    cropval.numProduced = 1;
                }
                crop.Configure(cropval);

                KPrefabID prefab = plant.GetComponent <KPrefabID>();
                GeneratedBuildings.RegisterWithOverlay(OverlayScreen.HarvestableIDs, prefab.PrefabID().ToString());
                Growing growing = plant.AddOrGet <Growing>();
                growing.growthTime = cropval.cropDuration;
                if (setting.id != ForestTreeConfig.ID)  // don't harvest arbor trees directly
                {
                    plant.AddOrGet <Harvestable>();
                }
                plant.AddOrGet <HarvestDesignatable>();
                plant.AddOrGet <StandardCropPlant>();
            }
            #endregion
            #region irrigation
            if (setting.irrigation != null)
            {
                RemoveIrrigation(plant);

                List <PlantElementAbsorber.ConsumeInfo> irrigation    = new List <PlantElementAbsorber.ConsumeInfo>(3);
                List <PlantElementAbsorber.ConsumeInfo> fertilization = new List <PlantElementAbsorber.ConsumeInfo>(3);
                foreach (KeyValuePair <string, float> entry in setting.irrigation)
                {
                    if (GameTags.LiquidElements.Contains(entry.Key))
                    {
                        irrigation.Add(new PlantElementAbsorber.ConsumeInfo(entry.Key, entry.Value / 600f));
                    }
                    else if (GameTags.SolidElements.Contains(entry.Key))
                    {
                        fertilization.Add(new PlantElementAbsorber.ConsumeInfo(entry.Key, entry.Value / 600f));
                    }
                    else
                    {
                        Debug.Log(ToDialog("Irrigation for " + setting.id + " defines bad element: " + entry.Key));
                    }
                }
                if (irrigation.Count > 0)
                {
                    EntityTemplates.ExtendPlantToIrrigated(plant, irrigation.ToArray());
                }
                if (fertilization.Count > 0)
                {
                    EntityTemplates.ExtendPlantToFertilizable(plant, fertilization.ToArray());
                }
            }
            #endregion
            #region illumination
            if (setting.illumination != null)
            {
                IlluminationVulnerable  illumination = plant.GetComponent <IlluminationVulnerable>();
                CropSleepingMonitor.Def cropSleep    = plant.GetDef <CropSleepingMonitor.Def>();

                if (setting.illumination == 0f)
                {
                    if (illumination != null)
                    {
                        UnityEngine.Object.DestroyImmediate(illumination);
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }
                }
                else if (setting.illumination < 0f)
                {
                    if (illumination == null)
                    {
                        illumination = plant.AddOrGet <IlluminationVulnerable>();
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }

                    illumination.SetPrefersDarkness(true);
                }
                else if (setting.illumination == 1f)
                {
                    if (illumination == null)
                    {
                        illumination = plant.AddOrGet <IlluminationVulnerable>();
                    }
                    if (cropSleep != null)
                    {
                        FumLib.FumTools.RemoveDef(plant, cropSleep);
                    }

                    illumination.SetPrefersDarkness(false);
                }
                else
                {
                    if (illumination != null)
                    {
                        UnityEngine.Object.DestroyImmediate(illumination);
                    }
                    if (cropSleep == null)
                    {
                        cropSleep = plant.AddOrGetDef <CropSleepingMonitor.Def>();
                    }

                    cropSleep.lightIntensityThreshold = (float)setting.illumination;
                    cropSleep.prefersDarkness         = false;
                }
            }
            #endregion
            #region safe_elements
            if (setting.safe_elements != null)
            {
                plant.GetComponent <KPrefabID>().prefabInitFn += (inst =>
                {
                    PressureVulnerable pressure = inst.GetComponent <PressureVulnerable>();
                    pressure.safe_atmospheres.Clear();

                    foreach (string safe_element in setting.safe_elements)
                    {
                        pressure.safe_atmospheres.Add(ElementLoader.FindElementByName(safe_element));
                    }
                });
            }
            #endregion
            #region pressure
            if (setting.pressures != null)
            {
                PressureVulnerable pressure = plant.AddOrGet <PressureVulnerable>();
                pressure.pressureLethal_Low   = 0f;
                pressure.pressureWarning_Low  = 0f;
                pressure.pressureWarning_High = float.MaxValue;
                pressure.pressureLethal_High  = float.MaxValue;
                pressure.pressure_sensitive   = false;

                for (int i = 0; i < setting.pressures.Length; i++)
                {
                    switch (i)
                    {
                    case 0: pressure.pressureLethal_Low = setting.pressures[i]; pressure.pressure_sensitive = true; break;

                    case 1: pressure.pressureWarning_Low = setting.pressures[i]; break;

                    case 2: pressure.pressureWarning_High = setting.pressures[i]; break;

                    case 3: pressure.pressureLethal_High = setting.pressures[i]; break;
                    }
                }
            }
            #endregion
            #region decor
            try {
                if (setting.decor_value != null)
                {
                    plant.GetComponent <DecorProvider>().baseDecor = (float)setting.decor_value;
                }

                if (setting.decor_radius != null)
                {
                    plant.GetComponent <DecorProvider>().baseRadius = (float)setting.decor_radius;
                }
            } catch (Exception) {
                Debug.LogWarning("[CustomizePlants] For some weird reason " + plant.name + " has no DecorProvider.");
            }
            #endregion
            #region temperatures
            if (setting.temperatures != null)
            {
                TemperatureVulnerable temperature = plant.AddOrGet <TemperatureVulnerable>();

                for (int i = 0; i < setting.temperatures.Length; i++)
                {
                    switch (i)
                    {
                    case 0: temperature.internalTemperatureLethal_Low = setting.temperatures[i]; break;

                    case 1: temperature.internalTemperatureWarning_Low = setting.temperatures[i]; break;

                    case 2: temperature.internalTemperatureWarning_High = setting.temperatures[i]; break;

                    case 3: temperature.internalTemperatureLethal_High = setting.temperatures[i]; break;
                    }
                }
            }
            #endregion
            #region submerged_threshold
            if (setting.submerged_threshold != null)
            {
                DrowningMonitor drowning = plant.AddOrGet <DrowningMonitor>();

                if (setting.submerged_threshold == 0f)   //doesn't care about water
                {
                    UnityEngine.Object.DestroyImmediate(drowning);
                }
                else if (setting.submerged_threshold < 0f)   //needs water
                {
                    drowning.livesUnderWater = true;
                    drowning.canDrownToDeath = false;
                }
                else    //if(setting.submerged_threshold > 0f)  //hates water
                {
                    drowning.livesUnderWater = false;
                    drowning.canDrownToDeath = false;
                }
            }
            #endregion
            #region can_tinker
            if (setting.can_tinker != null)
            {
                if (setting.can_tinker == true)
                {
                    Tinkerable.MakeFarmTinkerable(plant);
                }
            }
            #endregion
            #region require_solid_tile
            if (setting.require_solid_tile != null)
            {
                UprootedMonitor uproot = plant.AddOrGet <UprootedMonitor>();
                if (setting.require_solid_tile == false)
                {
                    UnityEngine.Object.DestroyImmediate(uproot);
                }
            }
            #endregion
            #region max_age
            if (setting.max_age != null && plant.GetComponent <StandardCropPlant>() != null) //only if plant has fruit
            {
                Growing growing = plant.AddOrGet <Growing>();
                if (setting.max_age <= 0)
                {
                    growing.shouldGrowOld = false;
                }
                else
                {
                    growing.shouldGrowOld = true;
                    growing.maxAge        = (float)setting.max_age;
                }
            }
            #endregion
            #region disease
            if (setting.disease != null || setting.disease_amount != null)
            {
                DiseaseDropper.Def def = plant.AddOrGetDef <DiseaseDropper.Def>();
                if (setting.disease != null)
                {
                    def.diseaseIdx = Db.Get().Diseases.GetIndex(setting.disease);
                }
                if (setting.disease_amount != null)
                {
                    def.singleEmitQuantity = (int)setting.disease_amount;
                }

                if (def.diseaseIdx == byte.MaxValue || def.singleEmitQuantity == 0)
                {
                    FumLib.FumTools.RemoveDef(plant, def);
                }
            }
            #endregion
            #region input_element
            if (setting.input_element != null)
            {
                ElementConsumer consumer = plant.AddOrGet <ElementConsumer>();
                Element         element  = ElementLoader.FindElementByName(setting.input_element);

                if (element == null || element.IsSolid)                //invalid element
                {
                    Debug.Log(ToDialog("input_element is bad element: " + setting.input_element));
                    UnityEngine.Object.DestroyImmediate(consumer);
                }
                else if (setting.input_rate <= 0f)   //delete consumer
                {
                    UnityEngine.Object.DestroyImmediate(consumer);
                }
                else
                {
                    consumer.configuration     = ElementConsumer.Configuration.Element;
                    consumer.consumptionRadius = 2;
                    consumer.sampleCellOffset  = new Vector3(0f, 0f);
                    consumer.EnableConsumption(true);
                    consumer.showInStatusPanel = true;
                    consumer.storeOnConsume    = false; //consumer deletes elements; output_element might overrides this
                    consumer.consumptionRate   = (float)setting.input_rate;
                    consumer.elementToConsume  = element.id;
                    consumer.capacityKG        = (float)setting.input_rate * 10;

                    plant.AddOrGet <Storage>().capacityKg = consumer.capacityKG;
                    plant.AddOrGet <SaltPlant>();
                }
            }
            #endregion
            #region output_element
            if (setting.output_element != null)
            {
                ElementConsumer  consumer  = plant.GetComponent <ElementConsumer>();
                ElementConverter converter = plant.AddOrGet <ElementConverter>();
                Element          element   = ElementLoader.FindElementByName(setting.output_element);

                if (element == null)                //invalid element
                {
                    Debug.Log(ToDialog("output_element is bad element: " + setting.output_element));
                    UnityEngine.Object.DestroyImmediate(converter);
                }
                else if (setting.output_rate <= 0f)  //delete converter
                {
                    UnityEngine.Object.DestroyImmediate(converter);
                    if (consumer != null)
                    {
                        consumer.storeOnConsume = false;
                    }
                }
                else
                {
                    if (consumer != null)   //transform elements
                    {
                        consumer.storeOnConsume    = true;
                        converter.consumedElements = new ElementConverter.ConsumedElement[1] {
                            new ElementConverter.ConsumedElement(consumer.elementToConsume.CreateTag(), consumer.consumptionRate)
                        };
                        converter.OutputMultiplier = (float)setting.output_rate / consumer.consumptionRate;
                        //Debug.Log("TAG is: " + consumer.elementToConsume.CreateTag().Name + " SimHash is: " + consumer.elementToConsume.ToString());
                    }
                    else    //create from nothing
                    {
                        converter.consumedElements = new ElementConverter.ConsumedElement[0];
                        converter.OutputMultiplier = 1f;
                    }
                    converter.outputElements = new ElementConverter.OutputElement[1] {
                        new ElementConverter.OutputElement((float)setting.output_rate, element.id, 0f, true, false, 0f, 1f)
                    };

                    plant.AddOrGet <Storage>();
                    plant.AddOrGet <SaltPlant>();
                }
            }
            #endregion
        }
Exemplo n.º 23
0
        private void CreateStatusItems()
        {
            Func <string, object, string> resolveStringCallback = delegate(string str, object data)
            {
                Workable workable3 = (Workable)data;
                if ((UnityEngine.Object)workable3 != (UnityEngine.Object)null)
                {
                    str = str.Replace("{Target}", workable3.GetComponent <KSelectable>().GetName());
                }
                return(str);
            };
            Func <string, object, string> resolveStringCallback2 = delegate(string str, object data)
            {
                Workable workable2 = (Workable)data;
                if ((UnityEngine.Object)workable2 != (UnityEngine.Object)null)
                {
                    str = str.Replace("{Target}", workable2.GetComponent <KSelectable>().GetName());
                    ComplexFabricatorWorkable complexFabricatorWorkable = workable2 as ComplexFabricatorWorkable;
                    if ((UnityEngine.Object)complexFabricatorWorkable != (UnityEngine.Object)null)
                    {
                        ComplexRecipe currentWorkingOrder = complexFabricatorWorkable.CurrentWorkingOrder;
                        if (currentWorkingOrder != null)
                        {
                            str = str.Replace("{Item}", currentWorkingOrder.FirstResult.ProperName());
                        }
                    }
                }
                return(str);
            };

            BedUnreachable = CreateStatusItem("BedUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            BedUnreachable.AddNotification(null, null, null, 0f);
            DailyRationLimitReached = CreateStatusItem("DailyRationLimitReached", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            DailyRationLimitReached.AddNotification(null, null, null, 0f);
            HoldingBreath = CreateStatusItem("HoldingBreath", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Hungry        = CreateStatusItem("Hungry", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Unhappy       = CreateStatusItem("Unhappy", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Unhappy.AddNotification(null, null, null, 0f);
            NervousBreakdown = CreateStatusItem("NervousBreakdown", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            NervousBreakdown.AddNotification(null, null, null, 0f);
            NoRationsAvailable       = CreateStatusItem("NoRationsAvailable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            PendingPacification      = CreateStatusItem("PendingPacification", "DUPLICANTS", "status_item_pending_pacification", StatusItem.IconType.Custom, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            QuarantineAreaUnassigned = CreateStatusItem("QuarantineAreaUnassigned", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            QuarantineAreaUnassigned.AddNotification(null, null, null, 0f);
            QuarantineAreaUnreachable = CreateStatusItem("QuarantineAreaUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            QuarantineAreaUnreachable.AddNotification(null, null, null, 0f);
            Quarantined        = CreateStatusItem("Quarantined", "DUPLICANTS", "status_item_quarantined", StatusItem.IconType.Custom, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            RationsUnreachable = CreateStatusItem("RationsUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            RationsUnreachable.AddNotification(null, null, null, 0f);
            RationsNotPermitted = CreateStatusItem("RationsNotPermitted", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            RationsNotPermitted.AddNotification(null, null, null, 0f);
            Rotten   = CreateStatusItem("Rotten", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Starving = CreateStatusItem("Starving", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            Starving.AddNotification(null, null, null, 0f);
            Suffocating = CreateStatusItem("Suffocating", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2);
            Suffocating.AddNotification(null, null, null, 0f);
            Tired = CreateStatusItem("Tired", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Idle  = CreateStatusItem("Idle", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Idle.AddNotification(null, null, null, 0f);
            Pacified = CreateStatusItem("Pacified", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Dead     = CreateStatusItem("Dead", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Dead.resolveStringCallback = delegate(string str, object data)
            {
                Death death = (Death)data;
                return(str.Replace("{Death}", death.Name));
            };
            MoveToSuitNotRequired   = CreateStatusItem("MoveToSuitNotRequired", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            DroppingUnusedInventory = CreateStatusItem("DroppingUnusedInventory", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            MovingToSafeArea        = CreateStatusItem("MovingToSafeArea", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            ToiletUnreachable       = CreateStatusItem("ToiletUnreachable", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            ToiletUnreachable.AddNotification(null, null, null, 0f);
            NoUsableToilets = CreateStatusItem("NoUsableToilets", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            NoUsableToilets.AddNotification(null, null, null, 0f);
            NoToilets = CreateStatusItem("NoToilets", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            NoToilets.AddNotification(null, null, null, 0f);
            BreathingO2 = CreateStatusItem("BreathingO2", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 130);
            BreathingO2.resolveStringCallback = delegate(string str, object data)
            {
                OxygenBreather oxygenBreather2 = (OxygenBreather)data;
                float          averageRate     = Game.Instance.accumulators.GetAverageRate(oxygenBreather2.O2Accumulator);
                return(str.Replace("{ConsumptionRate}", GameUtil.GetFormattedMass(0f - averageRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")));
            };
            EmittingCO2 = CreateStatusItem("EmittingCO2", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 130);
            EmittingCO2.resolveStringCallback = delegate(string str, object data)
            {
                OxygenBreather oxygenBreather = (OxygenBreather)data;
                return(str.Replace("{EmittingRate}", GameUtil.GetFormattedMass(oxygenBreather.CO2EmitRate, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")));
            };
            Vomiting  = CreateStatusItem("Vomiting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Coughing  = CreateStatusItem("Coughing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            LowOxygen = CreateStatusItem("LowOxygen", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            LowOxygen.AddNotification(null, null, null, 0f);
            RedAlert = CreateStatusItem("RedAlert", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Sleeping = CreateStatusItem("Sleeping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Sleeping.resolveTooltipCallback = delegate(string str, object data)
            {
                if (data is SleepChore.StatesInstance)
                {
                    SleepChore.StatesInstance statesInstance2 = (SleepChore.StatesInstance)data;
                    string stateChangeNoiseSource             = statesInstance2.stateChangeNoiseSource;
                    if (!string.IsNullOrEmpty(stateChangeNoiseSource))
                    {
                        string text5 = DUPLICANTS.STATUSITEMS.SLEEPING.TOOLTIP;
                        text5 = text5.Replace("{Disturber}", stateChangeNoiseSource);
                        str  += text5;
                    }
                }
                return(str);
            };
            SleepingInterruptedByNoise = CreateStatusItem("SleepingInterruptedByNoise", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            SleepingInterruptedByLight = CreateStatusItem("SleepingInterruptedByLight", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Eating = CreateStatusItem("Eating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Eating.resolveStringCallback = resolveStringCallback;
            Digging  = CreateStatusItem("Digging", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Cleaning = CreateStatusItem("Cleaning", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Cleaning.resolveStringCallback = resolveStringCallback;
            PickingUp = CreateStatusItem("PickingUp", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            PickingUp.resolveStringCallback = resolveStringCallback;
            Mopping = CreateStatusItem("Mopping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Cooking = CreateStatusItem("Cooking", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Cooking.resolveStringCallback = resolveStringCallback2;
            Mushing = CreateStatusItem("Mushing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Mushing.resolveStringCallback = resolveStringCallback2;
            Researching = CreateStatusItem("Researching", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Researching.resolveStringCallback = delegate(string str, object data)
            {
                TechInstance activeResearch = Research.Instance.GetActiveResearch();
                if (activeResearch != null)
                {
                    return(str.Replace("{Tech}", activeResearch.tech.Name));
                }
                return(str);
            };
            Tinkering = CreateStatusItem("Tinkering", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Tinkering.resolveStringCallback = delegate(string str, object data)
            {
                Tinkerable tinkerable = (Tinkerable)data;
                if ((UnityEngine.Object)tinkerable != (UnityEngine.Object)null)
                {
                    return(string.Format(str, tinkerable.tinkerMaterialTag.ProperName()));
                }
                return(str);
            };
            Storing = CreateStatusItem("Storing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Storing.resolveStringCallback = delegate(string str, object data)
            {
                Workable workable = (Workable)data;
                if ((UnityEngine.Object)workable != (UnityEngine.Object)null && (UnityEngine.Object)workable.worker != (UnityEngine.Object)null)
                {
                    KSelectable component = workable.GetComponent <KSelectable>();
                    if ((bool)component)
                    {
                        str = str.Replace("{Target}", component.GetName());
                    }
                    Pickupable pickupable = workable.worker.workCompleteData as Pickupable;
                    if ((UnityEngine.Object)workable.worker != (UnityEngine.Object)null && (bool)pickupable)
                    {
                        KSelectable component2 = pickupable.GetComponent <KSelectable>();
                        if ((bool)component2)
                        {
                            str = str.Replace("{Item}", component2.GetName());
                        }
                    }
                }
                return(str);
            };
            Building = CreateStatusItem("Building", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Building.resolveStringCallback = resolveStringCallback;
            Equipping = CreateStatusItem("Equipping", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Equipping.resolveStringCallback = resolveStringCallback;
            WarmingUp = CreateStatusItem("WarmingUp", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            WarmingUp.resolveStringCallback = resolveStringCallback;
            GeneratingPower = CreateStatusItem("GeneratingPower", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            GeneratingPower.resolveStringCallback = resolveStringCallback;
            Harvesting = CreateStatusItem("Harvesting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Harvesting.resolveStringCallback = resolveStringCallback;
            Uprooting = CreateStatusItem("Uprooting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Uprooting.resolveStringCallback = resolveStringCallback;
            Emptying = CreateStatusItem("Emptying", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Emptying.resolveStringCallback = resolveStringCallback;
            Toggling = CreateStatusItem("Toggling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Toggling.resolveStringCallback = resolveStringCallback;
            Deconstructing = CreateStatusItem("Deconstructing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Deconstructing.resolveStringCallback = resolveStringCallback;
            Disinfecting = CreateStatusItem("Disinfecting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Disinfecting.resolveStringCallback = resolveStringCallback;
            Upgrading = CreateStatusItem("Upgrading", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Upgrading.resolveStringCallback = resolveStringCallback;
            Fabricating = CreateStatusItem("Fabricating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Fabricating.resolveStringCallback = resolveStringCallback2;
            Processing = CreateStatusItem("Processing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Processing.resolveStringCallback = resolveStringCallback2;
            Clearing = CreateStatusItem("Clearing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Clearing.resolveStringCallback = resolveStringCallback;
            GeneratingPower = CreateStatusItem("GeneratingPower", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            GeneratingPower.resolveStringCallback = resolveStringCallback;
            Cold = CreateStatusItem("Cold", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Cold.resolveTooltipCallback = delegate(string str, object data)
            {
                str = str.Replace("{StressModification}", GameUtil.GetFormattedPercent(Db.Get().effects.Get("ColdAir").SelfModifiers[0].Value, GameUtil.TimeSlice.PerCycle));
                float dtu_s2 = ((ExternalTemperatureMonitor.Instance)data).temperatureTransferer.average_kilowatts_exchanged.GetWeightedAverage * 1000f;
                str = str.Replace("{currentTransferWattage}", GameUtil.GetFormattedHeatEnergyRate(dtu_s2, GameUtil.HeatEnergyFormatterUnit.Automatic));
                AttributeInstance attributeInstance3 = ((ExternalTemperatureMonitor.Instance)data).attributes.Get("ThermalConductivityBarrier");
                string            text3 = "<b>" + attributeInstance3.GetFormattedValue() + "</b>";
                for (int j = 0; j != attributeInstance3.Modifiers.Count; j++)
                {
                    AttributeModifier attributeModifier2 = attributeInstance3.Modifiers[j];
                    text3 += "\n";
                    string text4 = text3;
                    text3 = text4 + "    • " + attributeModifier2.GetDescription() + " <b>" + attributeModifier2.GetFormattedString(attributeInstance3.gameObject) + "</b>";
                }
                str = str.Replace("{conductivityBarrier}", text3);
                return(str);
            };
            Hot = CreateStatusItem("Hot", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            Hot.resolveTooltipCallback = delegate(string str, object data)
            {
                str = str.Replace("{StressModification}", GameUtil.GetFormattedPercent(Db.Get().effects.Get("WarmAir").SelfModifiers[0].Value, GameUtil.TimeSlice.PerCycle));
                float dtu_s = ((ExternalTemperatureMonitor.Instance)data).temperatureTransferer.average_kilowatts_exchanged.GetWeightedAverage * 1000f;
                str = str.Replace("{currentTransferWattage}", GameUtil.GetFormattedHeatEnergyRate(dtu_s, GameUtil.HeatEnergyFormatterUnit.Automatic));
                AttributeInstance attributeInstance2 = ((ExternalTemperatureMonitor.Instance)data).attributes.Get("ThermalConductivityBarrier");
                string            text = "<b>" + attributeInstance2.GetFormattedValue() + "</b>";
                for (int i = 0; i != attributeInstance2.Modifiers.Count; i++)
                {
                    AttributeModifier attributeModifier = attributeInstance2.Modifiers[i];
                    text += "\n";
                    string text2 = text;
                    text = text2 + "    • " + attributeModifier.GetDescription() + " <b>" + attributeModifier.GetFormattedString(attributeInstance2.gameObject) + "</b>";
                }
                str = str.Replace("{conductivityBarrier}", text);
                return(str);
            };
            BodyRegulatingHeating = CreateStatusItem("BodyRegulatingHeating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            BodyRegulatingHeating.resolveStringCallback = delegate(string str, object data)
            {
                WarmBlooded.StatesInstance statesInstance = (WarmBlooded.StatesInstance)data;
                return(str.Replace("{TempDelta}", GameUtil.GetFormattedTemperature(statesInstance.TemperatureDelta, GameUtil.TimeSlice.PerSecond, GameUtil.TemperatureInterpretation.Relative, true, false)));
            };
            BodyRegulatingCooling = CreateStatusItem("BodyRegulatingCooling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            BodyRegulatingCooling.resolveStringCallback = BodyRegulatingHeating.resolveStringCallback;
            EntombedChore = CreateStatusItem("EntombedChore", "DUPLICANTS", "status_item_entombed", StatusItem.IconType.Custom, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2);
            EntombedChore.AddNotification(null, null, null, 0f);
            EarlyMorning                 = CreateStatusItem("EarlyMorning", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            NightTime                    = CreateStatusItem("NightTime", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            PoorDecor                    = CreateStatusItem("PoorDecor", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            PoorQualityOfLife            = CreateStatusItem("PoorQualityOfLife", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            PoorFoodQuality              = CreateStatusItem("PoorFoodQuality", DUPLICANTS.STATUSITEMS.POOR_FOOD_QUALITY.NAME, DUPLICANTS.STATUSITEMS.POOR_FOOD_QUALITY.TOOLTIP, string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, 2);
            GoodFoodQuality              = CreateStatusItem("GoodFoodQuality", DUPLICANTS.STATUSITEMS.GOOD_FOOD_QUALITY.NAME, DUPLICANTS.STATUSITEMS.GOOD_FOOD_QUALITY.TOOLTIP, string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, 2);
            Arting                       = CreateStatusItem("Arting", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Arting.resolveStringCallback = resolveStringCallback;
            SevereWounds                 = CreateStatusItem("SevereWounds", "DUPLICANTS", "status_item_broken", StatusItem.IconType.Custom, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            SevereWounds.AddNotification(null, null, null, 0f);
            Incapacitated = CreateStatusItem("Incapacitated", "DUPLICANTS", "status_item_broken", StatusItem.IconType.Custom, NotificationType.DuplicantThreatening, false, OverlayModes.None.ID, true, 2);
            Incapacitated.AddNotification(null, null, null, 0f);
            Incapacitated.resolveStringCallback = delegate(string str, object data)
            {
                IncapacitationMonitor.Instance instance = (IncapacitationMonitor.Instance)data;
                float bleedLifeTime = instance.GetBleedLifeTime(instance);
                str = str.Replace("{CauseOfIncapacitation}", instance.GetCauseOfIncapacitation().Name);
                return(str.Replace("{TimeUntilDeath}", GameUtil.GetFormattedTime(bleedLifeTime)));
            };
            Relocating = CreateStatusItem("Relocating", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Relocating.resolveStringCallback = resolveStringCallback;
            Fighting = CreateStatusItem("Fighting", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            Fighting.AddNotification(null, null, null, 0f);
            Fleeing = CreateStatusItem("Fleeing", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            Fleeing.AddNotification(null, null, null, 0f);
            Stressed = CreateStatusItem("Stressed", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Stressed.AddNotification(null, null, null, 0f);
            LashingOut = CreateStatusItem("LashingOut", "DUPLICANTS", string.Empty, StatusItem.IconType.Exclamation, NotificationType.Bad, false, OverlayModes.None.ID, true, 2);
            LashingOut.AddNotification(null, null, null, 0f);
            LowImmunity = CreateStatusItem("LowImmunity", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 2);
            LowImmunity.AddNotification(null, null, null, 0f);
            Studying         = CreateStatusItem("Studying", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 2);
            Socializing      = CreateStatusItem("Socializing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2);
            Dancing          = CreateStatusItem("Dancing", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2);
            Gaming           = CreateStatusItem("Gaming", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2);
            Mingling         = CreateStatusItem("Mingling", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2);
            ContactWithGerms = CreateStatusItem("ContactWithGerms", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.Disease.ID, true, 2);
            ContactWithGerms.resolveStringCallback = delegate(string str, object data)
            {
                GermExposureMonitor.ExposureStatusData exposureStatusData4 = (GermExposureMonitor.ExposureStatusData)data;
                string name2 = Db.Get().Sicknesses.Get(exposureStatusData4.exposure_type.sickness_id).Name;
                str = str.Replace("{Sickness}", name2);
                return(str);
            };
            ContactWithGerms.statusItemClickCallback = delegate(object data)
            {
                GermExposureMonitor.ExposureStatusData exposureStatusData3 = (GermExposureMonitor.ExposureStatusData)data;
                Vector3 lastExposurePosition2 = exposureStatusData3.owner.GetLastExposurePosition(exposureStatusData3.exposure_type.germ_id);
                CameraController.Instance.CameraGoTo(lastExposurePosition2, 2f, true);
                if (OverlayScreen.Instance.mode == OverlayModes.None.ID)
                {
                    OverlayScreen.Instance.ToggleOverlay(OverlayModes.Disease.ID, true);
                }
            };
            ExposedToGerms = CreateStatusItem("ExposedToGerms", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, true, OverlayModes.Disease.ID, true, 2);
            ExposedToGerms.resolveStringCallback = delegate(string str, object data)
            {
                GermExposureMonitor.ExposureStatusData exposureStatusData2 = (GermExposureMonitor.ExposureStatusData)data;
                string                       name = Db.Get().Sicknesses.Get(exposureStatusData2.exposure_type.sickness_id).Name;
                AttributeInstance            attributeInstance = Db.Get().Attributes.GermResistance.Lookup(exposureStatusData2.owner.gameObject);
                string                       lastDiseaseSource = exposureStatusData2.owner.GetLastDiseaseSource(exposureStatusData2.exposure_type.germ_id);
                GermExposureMonitor.Instance sMI = exposureStatusData2.owner.GetSMI <GermExposureMonitor.Instance>();
                float num        = (float)exposureStatusData2.exposure_type.base_resistance + GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[0];
                float totalValue = attributeInstance.GetTotalValue();
                float resistanceToExposureType = sMI.GetResistanceToExposureType(exposureStatusData2.exposure_type, -1f);
                float contractionChance        = GermExposureMonitor.GetContractionChance(resistanceToExposureType);
                float exposureTier             = sMI.GetExposureTier(exposureStatusData2.exposure_type.germ_id);
                float num2 = GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[(int)exposureTier - 1] - GERM_EXPOSURE.EXPOSURE_TIER_RESISTANCE_BONUSES[0];
                str = str.Replace("{Severity}", DUPLICANTS.STATUSITEMS.EXPOSEDTOGERMS.EXPOSURE_TIERS[(int)exposureTier - 1]);
                str = str.Replace("{Sickness}", name);
                str = str.Replace("{Source}", lastDiseaseSource);
                str = str.Replace("{Base}", GameUtil.GetFormattedSimple(num, GameUtil.TimeSlice.None, null));
                str = str.Replace("{Dupe}", GameUtil.GetFormattedSimple(totalValue, GameUtil.TimeSlice.None, null));
                str = str.Replace("{Total}", GameUtil.GetFormattedSimple(resistanceToExposureType, GameUtil.TimeSlice.None, null));
                str = str.Replace("{ExposureLevelBonus}", GameUtil.GetFormattedSimple(num2, GameUtil.TimeSlice.None, null));
                str = str.Replace("{Chance}", GameUtil.GetFormattedPercent(contractionChance * 100f, GameUtil.TimeSlice.None));
                return(str);
            };
            ExposedToGerms.statusItemClickCallback = delegate(object data)
            {
                GermExposureMonitor.ExposureStatusData exposureStatusData = (GermExposureMonitor.ExposureStatusData)data;
                Vector3 lastExposurePosition = exposureStatusData.owner.GetLastExposurePosition(exposureStatusData.exposure_type.germ_id);
                CameraController.Instance.CameraGoTo(lastExposurePosition, 2f, true);
                if (OverlayScreen.Instance.mode == OverlayModes.None.ID)
                {
                    OverlayScreen.Instance.ToggleOverlay(OverlayModes.Disease.ID, true);
                }
            };
            LightWorkEfficiencyBonus = CreateStatusItem("LightWorkEfficiencyBonus", "DUPLICANTS", string.Empty, StatusItem.IconType.Info, NotificationType.Good, false, OverlayModes.None.ID, true, 2);
        }