public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active());
     //Debug.Log("RoomsExpanded: Loaded DLC version of the mod. Last update: 2021.05.14 for build 463874.");
     Debug.Log("RoomsExpanded: Loaded Vanilla version of the mod. Last update: 2021.05.14 for build 460672.");
     Debug.Log("ResearchRequirements: Loaded from: " + Assembly.GetExecutingAssembly().Location);
 }
예제 #2
0
        protected override void OnSpawn()
        {
            base.OnSpawn();

            if (diseasesKilled == null)
            {
                diseasesKilled = new HashSet <byte>();
                var db = Db.Get();

                if (Mod.Settings.UVCKillsFoodPoisoning)
                {
                    diseasesKilled.Add(db.Diseases.GetIndex(db.Diseases.FoodGerms.id));
                }

                if (Mod.Settings.UVCKillsSlimelung)
                {
                    diseasesKilled.Add(db.Diseases.GetIndex(db.Diseases.SlimeGerms.id));
                }

                if (Mod.Settings.UVCKillsZombieSpores)
                {
                    diseasesKilled.Add(db.Diseases.GetIndex(db.Diseases.ZombieSpores.id));
                }

                if (DlcManager.IsExpansion1Active())
                {
                    if (Mod.Settings.UVCKillsRadiation)
                    {
                        diseasesKilled.Add(db.Diseases.GetIndex(db.Diseases.RadiationPoisoning.id));
                    }
                }
            }

            lampXY = Grid.PosToXY(gameObject.transform.position);
        }
            public static void Postfix()
            {
                var copper   = ElementLoader.FindElementByHash(SimHashes.Copper);
                var iron     = ElementLoader.FindElementByHash(SimHashes.Iron);
                var tungsten = ElementLoader.FindElementByHash(SimHashes.Tungsten);
                var gold     = ElementLoader.FindElementByHash(SimHashes.Gold);
                var lead     = ElementLoader.FindElementByHash(SimHashes.Lead);
                var aluminum = ElementLoader.FindElementByHash(SimHashes.Aluminum);


                var elements = new[] { copper, iron, gold, lead, aluminum, tungsten };

                if (DlcManager.IsExpansion1Active())
                {
                    var cobalt = ElementLoader.FindElementByHash(SimHashes.Cobalt);
                    elements.AddItem(cobalt);
                }

                foreach (var element in elements)
                {
                    var tags = new List <Tag>(element.oreTags)
                    {
                        GameTags.Metal
                    };
                    element.oreTags = tags.ToArray();

                    GameTags.SolidElements.Add(element.tag);
                }
            }
            public static void OnLoad()
            {
                PUtil.InitLibrary();
                POptions.RegisterOptions(typeof(Settings));
                Settings.PLib_Initalize();

                //ModInfo.Initalize(ModInfo.GetAssemblyVersion(), true, 464434);
                ModInfo.Instance.VersionAlert(DlcManager.IsExpansion1Active(), "OnLoad() version check");
                ModInfo.Instance.LogDetails();
            }
            private static IEnumerable <MethodBase> TargetMethods()
            {
                const string name    = nameof(IBuildingConfig.ConfigureBuildingTemplate);
                var          methods = new List <MethodBase>();

                methods.Add(typeof(SuitLockerConfig).GetMethod(name));
                methods.Add(typeof(JetSuitLockerConfig).GetMethod(name));
                methods.Add(typeof(OxygenMaskLockerConfig).GetMethod(name));
                if (DlcManager.IsExpansion1Active())
                {
                    methods.Add(typeof(LeadSuitLockerConfig).GetMethod(name));
                }
                return(methods);
            }
예제 #6
0
 public override void OnLoad(Harmony harmony)
 {
     ReBuildableAETNOptions.Reload();
     base.OnLoad(harmony);
     PUtil.InitLibrary();
     new PPatchManager(harmony).RegisterPatchClass(GetType());
     if (DlcManager.IsExpansion1Active())
     {
         new POptions().RegisterOptions(this, typeof(ReBuildableAETNSpaceOutOptions));
     }
     else
     {
         new POptions().RegisterOptions(this, typeof(ReBuildableAETNVanillaOptions));
     }
 }
예제 #7
0
        public override void OnLoad(Harmony harmony)
        {
            base.OnLoad(harmony);
            PUtil.InitLibrary();
            new PPatchManager(harmony).RegisterPatchClass(typeof(SmelterPatches));
            var options = new POptions();

            if (DlcManager.IsExpansion1Active())
            {
                options.RegisterOptions(this, typeof(SmelterOptionsExpansion1));
            }
            else
            {
                options.RegisterOptions(this, typeof(SmelterOptions));
            }
        }
예제 #8
0
        public static void InitalizeDictionaries()
        {
            StoredGases   = new Dictionary <Tag, float>();
            StoredLiquids = new Dictionary <Tag, float>();

            if (!TechRequirements.Instance.GetGameTech("Plastics").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.CrudeOil).tag, 0);
            }
            if (!TechRequirements.Instance.GetGameTech("ValveMiniaturization").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.Petroleum).tag, 0);
            }
            if (!TechRequirements.Instance.GetGameTech("LiquidFiltering").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.SaltWater).tag, 0);
            }
            if (!TechRequirements.Instance.GetGameTech("LiquidFiltering").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.Brine).tag, 0);
            }
            if (!TechRequirements.Instance.GetGameTech("Distillation").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.DirtyWater).tag, 0);
            }

            if (!TechRequirements.Instance.GetGameTech("Catalytics").IsComplete())
            {
                StoredGases.Add(ElementLoader.FindElementByHash(SimHashes.CarbonDioxide).tag, 0);
            }
            if (!TechRequirements.Instance.GetGameTech("RenewableEnergy").IsComplete())
            {
                StoredGases.Add(ElementLoader.FindElementByHash(SimHashes.Steam).tag, 0);
            }

            //DLC Techs:
            if (DlcManager.IsExpansion1Active() && !TechRequirements.Instance.GetGameTech("CryoFuelPropulsion").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.LiquidHydrogen).tag, 0);
            }
            if (DlcManager.IsExpansion1Active() && !TechRequirements.Instance.GetGameTech("HydrocarbonPropulsion").IsComplete())
            {
                StoredLiquids.Add(ElementLoader.FindElementByHash(SimHashes.LiquidOxygen).tag, 0);
            }
        }
        private static void AddBuildingAndEffects()
        {
            Utils.AddBuildingToPlanScreen("Furniture", CarouselCentrifugeConfig.ID, EspressoMachineConfig.ID);
            string requiredTech = DlcManager.IsExpansion1Active() ? "SpaceProgram" : "ArtificialFriends";

            Utils.AddBuildingToTechnology(requiredTech, CarouselCentrifugeConfig.ID);

            moraleModifier = new AttributeModifier(
                attribute_id: "QualityOfLife",
                value: CarouselCentrifugeOptions.Instance.MoraleBonus,
                description: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.NAME,
                is_multiplier: false,
                uiOnly: false,
                is_readonly: false
                );

            specificEffect = new Effect(
                id: CarouselCentrifugeWorkable.specificEffectName,
                name: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.NAME,
                description: STRINGS.DUPLICANTS.MODIFIERS.RIDEONCAROUSEL.TOOLTIP,
                duration: (CarouselCentrifugeOptions.Instance.SpecificEffectDuration - 0.05f) * Constants.SECONDS_PER_CYCLE,
                show_in_ui: false,
                trigger_floating_text: true,
                is_bad: false
                );
            specificEffect.Add(moraleModifier);

            trackingEffect = new Effect(
                id: CarouselCentrifugeWorkable.trackingEffectName,
                name: "",
                description: "",
                duration: CarouselCentrifugeOptions.Instance.TrackingEffectDuration * Constants.SECONDS_PER_CYCLE,
                show_in_ui: false,
                trigger_floating_text: false,
                is_bad: false
                );

            Db.Get().effects.Add(specificEffect);
            Db.Get().effects.Add(trackingEffect);
        }
예제 #10
0
        /// <summary>
        /// Initializes the achievement list, after the Db has been initialized.
        /// </summary>
        internal static void InitAchievements()
        {
            var db = Db.Get();
            var dietRequirements = new ColonyAchievementRequirement[] {
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, FieldRationConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, MushBarConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, FriedMushBarConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, BasicPlantFoodConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, BasicPlantBarConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, PickledMealConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, PrickleFruitConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, GrilledPrickleFruitConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, SalsaConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, CookedEggConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, MeatConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, CookedMeatConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, FishMeatConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, CookedFishConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, SurfAndTurfConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, ColdWheatBreadConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, SpiceBreadConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, FruitCakeConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, MushroomConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, FriedMushroomConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, MushroomWrapConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, LettuceConfig.ID),
                new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, BurgerConfig.ID)
            };

            // If in DLC, require Grubfruit, Spindly Grubfruit, Roast Grubfruit Nut,
            // Grubfruit Preserve, and Mixed Berry Pie
            if (DlcManager.IsExpansion1Active())
            {
                var dlcDietRequirements = new ColonyAchievementRequirement[] {
                    new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, WormBasicFruitConfig.ID),
                    new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, WormBasicFoodConfig.ID),
                    new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, WormSuperFruitConfig.ID),
                    new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, WormSuperFoodConfig.ID),
                    new EatXCaloriesOfFood(AS.ABALANCEDDIET.KCAL, BerryPieConfig.ID),
                };
                int n1 = dietRequirements.Length, n2 = dlcDietRequirements.Length;
                var temp = new ColonyAchievementRequirement[n1 + n2];
                Array.Copy(dietRequirements, temp, n1);
                Array.Copy(dlcDietRequirements, 0, temp, n1, n2);
                dietRequirements = temp;
            }
            AllAchievements = new AD[] {
                new AD("EmpireBuilder", "build_2500", new BuildNBuildings(AS.EMPIREBUILDER.
                                                                          QUANTITY)),
                new AD("JohnHenry", "dig_10k", new DigNTiles(AS.JOHNHENRY.QUANTITY)),
                new AD("TestOfTime", "reach_cycle1000", new CycleNumber(AS.TESTOFTIME.CYCLE)),
                new AD("ThinkingAhead", "thinking_ahead", new UseGeneShufflerNTimes(AS.
                                                                                    THINKINGAHEAD.QUANTITY)),
                new AD("ChutesAndLadders", "firepole_travel", new TravelXUsingTransitTubes(
                           NavType.Pole, AS.CHUTESANDLADDERS.DISTANCE)),
                new AD("ImGonnaBe", "im_gonna_be", new TravelXUsingTransitTubes(NavType.Floor,
                                                                                AS.IMGONNABE.DISTANCE)),
                new AD("SmallWorld", "small_world", new NumberOfDupes(AS.SMALLWORLD.QUANTITY)),
                new AD("YouMonster", "youmonster", new KillNCritters(AS.YOUMONSTER.QUANTITY)),
                new AD("BelongsInAMuseum", "all_artifacts", new CollectNArtifacts(28)),
                new AD("WholeNewWorlds", "rocket", new VisitAllPlanets()),
                new AD(AS.FINALBREATH.ID, "final_breath", new TriggerEvent(AS.FINALBREATH.ID)),
                new AD(AS.SAVINGMEEP.ID, "saving_meep", new TriggerEvent(AS.SAVINGMEEP.ID)),
                new AD("PowerOverwhelming", "power_overwhelm", new OverloadWire(Wire.
                                                                                WattageRating.Max50000)),
                new AD("IsItHotInHere", "isithot", new HeatBuildingToXKelvin(AS.ISITHOTINHERE.
                                                                             TEMPERATURE)),
                new AD(AS.WATCHTHEWORLDBURN.ID, "burn_gravitas", new TriggerEvent(AS.
                                                                                  WATCHTHEWORLDBURN.ID)),
                new AD("SafeSpace", "safe_space", new NoDeathsForNCycles(AS.SAFESPACE.CYCLES),
                       new CycleNumber(AS.SAFESPACE.CYCLES)),
                new AD("CritterSinger", "Animal_friends",
                       CritterTypeRequirement(HatchConfig.ID, HatchHardConfig.ID,
                                              HatchMetalConfig.ID, HatchVeggieConfig.ID),
                       CritterTypeRequirement(PacuConfig.ID, PacuTropicalConfig.ID,
                                              PacuCleanerConfig.ID),
                       CritterTypeRequirement(LightBugConfig.ID, LightBugBlueConfig.ID,
                                              LightBugOrangeConfig.ID, LightBugPinkConfig.ID, LightBugPurpleConfig.ID,
                                              LightBugCrystalConfig.ID, LightBugBlackConfig.ID),
                       CritterTypeRequirement(PuftConfig.ID, PuftOxyliteConfig.ID,
                                              PuftBleachstoneConfig.ID, PuftAlphaConfig.ID),
                       CritterTypeRequirement(DreckoConfig.ID, DreckoPlasticConfig.ID),
                       CritterTypeRequirement(OilFloaterConfig.ID, OilFloaterDecorConfig.ID,
                                              OilFloaterHighTempConfig.ID),
                       CritterTypeRequirement(MoleConfig.ID),
                       CritterTypeRequirement(MooConfig.ID),
                       CritterTypeRequirement(CrabConfig.ID),
                       CritterTypeRequirement(SquirrelConfig.ID)),
                new AD("MasterOfDisaster", "master_of_disaster",
                       new DeathFromCause(db.Deaths.Overheating.Id),
                       new DeathFromCause(db.Deaths.Slain.Id),
                       new DeathFromCause(db.Deaths.Suffocation.Id),
                       new DeathFromCause(db.Deaths.Starvation.Id)),
                new AD("ABalancedDiet", "balanced_diet", dietRequirements),
                new AD("JackOfAllTrades", "well_rounded", new ReachXAllAttributes(AS.
                                                                                  JACKOFALLTRADES.LEVEL)),
                new AD("DestroyerOfWorlds", "dig_20", new ReachXAttributeValue(db.Attributes.
                                                                               Digging.Id, AS.DESTROYEROFWORLDS.LEVEL)),
                new AD("SmoothOperator", "operate_20", new ReachXAttributeValue(db.Attributes.
                                                                                Machinery.Id, AS.SMOOTHOPERATOR.LEVEL)),
                new AD("Olympian", "athletics_20", new ReachXAttributeValue(db.Attributes.Athletics.
                                                                            Id, AS.OLYMPIAN.LEVEL)),
                new AD("AdaLovelace", "science_20", new ReachXAttributeValue(db.Attributes.
                                                                             Learning.Id, AS.ADALOVELACE.LEVEL)),
                new AD("MasterChef", "cook_20", new ReachXAttributeValue(db.Attributes.
                                                                         Cooking.Id, AS.MASTERCHEF.LEVEL)),
                new AD("MasterBuilder", "build_20", new ReachXAttributeValue(db.Attributes.
                                                                             Construction.Id, AS.MASTERBUILDER.LEVEL)),
                new AD("MountainMover", "athletics_20", new ReachXAttributeValue(db.Attributes.
                                                                                 Strength.Id, AS.MOUNTAINMOVER.LEVEL)),
                new AD("Cowboy", "ranch_20", new ReachXAttributeValue(db.Attributes.
                                                                      Ranching.Id, AS.COWBOY.LEVEL)),
                new AD("MotherEarth", "farm_20", new ReachXAttributeValue(db.Attributes.
                                                                          Botanist.Id, AS.MOTHEREARTH.LEVEL)),
                new AD("Michelangelo", "art_20", new ReachXAttributeValue(db.Attributes.
                                                                          Art.Id, AS.MICHELANGELO.LEVEL)),
                new AD("FirstDoNoHarm", "care_20", new ReachXAttributeValue(db.Attributes.
                                                                            Caring.Id, AS.FIRSTDONOHARM.LEVEL)),
                new AD("TotallyEcstatic", "ecstatic", new ReachXMoraleValue(AS.TOTALLYECSTATIC.
                                                                            MORALE)),
                new AD(AS.HAVEIWONYET.ID, "reach_cycle4000", new CycleNumber(AS.HAVEIWONYET.
                                                                             CYCLE)),
                new AD(AS.ALLTHEDUPLICANTS.ID, "dupes_100", new NumberOfDupes(100)),
                new AD(AS.ISEEWHATYOUDIDTHERE.ID, "cheat", new TriggerEvent(AS.
                                                                            ISEEWHATYOUDIDTHERE.ID)),
            };
            // Meltable props, but unfortunately the IDs are not constants
            POI_PROPS.Add("PropDesk");
            POI_PROPS.Add("PropElevator");
            POI_PROPS.Add("PropFacilityChair");
            POI_PROPS.Add("PropFacilityChairFlip");
            POI_PROPS.Add("PropFacilityChandelier");
            POI_PROPS.Add("PropFacilityCouch");
            POI_PROPS.Add("PropFacilityDesk");
            POI_PROPS.Add("PropFacilityDisplay");
            POI_PROPS.Add("PropFacilityDisplay2");
            POI_PROPS.Add("PropFacilityDisplay3");
            POI_PROPS.Add("PropFacilityGlobeDroors");
            POI_PROPS.Add("PropFacilityHangingLight");
            POI_PROPS.Add("PropFacilityPainting");
            POI_PROPS.Add("PropFacilityStatue");
            POI_PROPS.Add("PropFacilityTable");
            POI_PROPS.Add("PropFacilityWallDegree");
            POI_PROPS.Add("PropGravitasCeilingRobot");
            POI_PROPS.Add("PropGravitasDecorativeWindow");
            POI_PROPS.Add("PropGravitasDisplay4");
            POI_PROPS.Add("PropGravitasFloorRobot");
            POI_PROPS.Add("PropGravitasHandScanner");
            POI_PROPS.Add("PropGravitasJar1");
            POI_PROPS.Add("PropGravitasJar2");
            POI_PROPS.Add("PropGravitasLabTable");
            POI_PROPS.Add("PropGravitasLabWindow");
            POI_PROPS.Add("PropGravitasLabWindowHorizontal");
            POI_PROPS.Add("PropGravitasRobitcTable");
            POI_PROPS.Add("PropGravitasShelf");
            POI_PROPS.Add("PropLight");
            POI_PROPS.Add("PropReceptionDesk");
            POI_PROPS.Add("PropSkeleton");
            POI_PROPS.Add("PropSurfaceSatellite1");
            POI_PROPS.Add("PropSurfaceSatellite2");
            POI_PROPS.Add("PropSurfaceSatellite3");
            POI_PROPS.Add("PropTable");
            POI_PROPS.Add("PropTallPlant");
        }
예제 #11
0
 private static bool Prepare()
 {
     return(DlcManager.IsExpansion1Active() && ReBuildableAETNOptions.Instance.SpaceOutPOIChance.Enabled);
 }
 public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active(), "OnLoad() version check");
     Debug.Log("RoomsExpanded: Loaded DLC version of the mod. Last update: 2021.03.07");
 }
예제 #13
0
 private static bool Prepare()
 {
     return(DlcManager.IsExpansion1Active());
 }
예제 #14
0
 private static bool Prepare() => DlcManager.IsExpansion1Active();
예제 #15
0
 public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active(), "OnLoad() version check");
     Debug.Log("RoomsExpanded: Loaded Vanilla version of the mod. Last update: 2021.03.12 for build 449549.");
     Debug.Log("RoomsExpanded: Loaded from: " + Assembly.GetExecutingAssembly().Location);
 }
예제 #16
0
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.AddOrGet <DropAllWorkable>();
            go.AddOrGet <BuildingComplete>().isManuallyOperated = true;
            go.AddOrGet <FabricatorIngredientStatusManager>();
            go.AddOrGet <CopyBuildingSettings>();

            var lcfr = go.AddOrGet <LiquidCooledFueledRefinery>();

            lcfr.duplicantOperated = true;
            lcfr.sideScreenStyle   = ComplexFabricatorSideScreen.StyleSetting.ListQueueHybrid;
            lcfr.keepExcessLiquids = true;
            BuildingTemplates.CreateComplexFabricatorStorage(go, lcfr);
            lcfr.coolantTag            = COOLANT_TAG;
            lcfr.minCoolantMass        = COOLANT_MASS;
            lcfr.maxCoolantMass        = COOLANT_MASS * 3;
            lcfr.outStorage.capacityKg = 2000f;
            lcfr.thermalFudge          = LIQUID_COOLED_HEAT_PORTION;
            lcfr.fuelTag = FUEL_TAG;
            lcfr.inStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers);
            lcfr.buildStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers);
            lcfr.outStorage.SetDefaultStoredItemModifiers(RefineryStoredItemModifiers);
            lcfr.outputOffset      = new Vector3(0.8f, 0.5f);
            lcfr.outputTemperature = OUTPUT_TEMPERATURE;
            lcfr.heatedTemperature = OUTPUT_TEMPERATURE;
            // выставляем выходную температуру. ради одного рецепта
            if (DlcManager.IsExpansion1Active())
            {
                lcfr.heatedTemperature = ElementLoader.FindElementByHash(SimHashes.Resin).highTemp;
            }

            var manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>();

            manualDeliveryKG.SetStorage(lcfr.outStorage);
            manualDeliveryKG.requestedItemTag       = FUEL_TAG;
            manualDeliveryKG.capacity               = FUEL_STORE_CAPACITY;
            manualDeliveryKG.refillMass             = FUEL_STORE_CAPACITY / 2;
            manualDeliveryKG.choreTypeIDHash        = Db.Get().ChoreTypes.MachineFetch.IdHash;
            manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.Functional;

            var workable = go.AddOrGet <SmelterWorkable>();

            workable.overrideAnims = new KAnimFile[] { Assets.GetAnim("anim_interacts_smelter_kanim") };
            workable.AnimOffset    = Vector3.left;

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

            conduitConsumer.capacityTag          = GameTags.Liquid;
            conduitConsumer.capacityKG           = COOLANT_MASS * 2;
            conduitConsumer.storage              = lcfr.inStorage;
            conduitConsumer.alwaysConsume        = true;
            conduitConsumer.forceAlwaysSatisfied = true;

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

            elementConverter.consumedElements = new ElementConverter.ConsumedElement[]
            {
                new ElementConverter.ConsumedElement(FUEL_TAG, FUEL_CONSUME_RATE)
            };
            elementConverter.outputElements = new ElementConverter.OutputElement[]
            {
                new ElementConverter.OutputElement(CO2_EMIT_RATE, SimHashes.CarbonDioxide, CO2_OUTPUT_TEMPERATURE, false, false, 1f, 2f)
            };

            var smelterWorkableEmpty = go.AddOrGet <SmelterWorkableEmpty>();

            smelterWorkableEmpty.workTime  = BUILDINGS.WORK_TIME_SECONDS.SHORT_WORK_TIME;
            smelterWorkableEmpty.workLayer = Grid.SceneLayer.BuildingFront;

            Prioritizable.AddRef(go);
        }
예제 #17
0
        protected override void OnSpawn()
        {
            var inst = Game.Instance;

            base.OnSpawn();
            if (BuildingsBuilt == 0)
            {
                // Not yet initialized, fill with number of completed buildings
                BuildingsBuilt = Components.BuildingCompletes.Count;
            }
            if (PlanetsVisited == null)
            {
                PlanetsVisited = new HashSet <int>();
            }
            if (TriggerEvents == null)
            {
                TriggerEvents = new Dictionary <string, bool>(64);
            }
            if (BestAttributeValue == null)
            {
                BestAttributeValue = new Dictionary <string, float>(64);
            }
            if (LastDeath <= 0)
            {
                InitGrimReaper();
            }
            var dbAttr = Db.Get().Attributes;

            VarietyAttributes = new Klei.AI.Attribute[] { dbAttr.Art, dbAttr.Athletics,
                                                          dbAttr.Botanist, dbAttr.Caring, dbAttr.Construction, dbAttr.Cooking,
                                                          dbAttr.Digging, dbAttr.Learning, dbAttr.Machinery, dbAttr.Ranching,
                                                          dbAttr.Strength };
            // Neutronium discovered?
            var neutronium = ElementLoader.FindElementByHash(SimHashes.Unobtanium);

            if (neutronium != null && DiscoveredResources.Instance.IsDiscovered(neutronium.tag))
            {
                Trigger(AchievementStrings.ISEEWHATYOUDIDTHERE.ID);
            }
            if (DlcManager.IsExpansion1Active())
            {
                // DLC STARMAP
                PlanetsRequired = ClusterManager.Instance.worldCount;
            }
            else
            {
                // VANILLA STARMAP
                var dest = SpacecraftManager.instance?.destinations;
                if (dest != null)
                {
                    int count = 0;
                    // Exclude unreachable destinations (earth) but include temporal tear
                    foreach (var destination in dest)
                    {
                        if (destination.GetDestinationType()?.visitable == true)
                        {
                            count++;
                        }
                    }
                    if (count > 0)
                    {
                        PlanetsRequired = count;
                    }
                }
            }
            if (inst != null)
            {
                inst.Subscribe((int)GameHashes.NewBuilding, OnBuildingCompleted);
                inst.Subscribe(DigNTiles.DigComplete, OnDigCompleted);
            }
        }
예제 #18
0
        public void Sim1000ms(float dt)
        {
            int have = 0;

            // Count artifacts discovered
            foreach (var pair in ArtifactConfig.artifactItems)
            {
                foreach (string name in pair.Value)
                {
                    if (DiscoveredResources.Instance.IsDiscovered(Assets.GetPrefab(name).
                                                                  PrefabID()))
                    {
                        have++;
                    }
                }
            }
            ArtifactsObtained = have;
            foreach (var duplicant in Components.LiveMinionIdentities.Items)
            {
                if (duplicant != null)
                {
                    float minValue = float.MaxValue;
                    // Find the worst attribute on this Duplicant for JoaT
                    foreach (var attribute in VarietyAttributes)
                    {
                        float attrValue = attribute.Lookup(duplicant)?.GetTotalValue() ?? 0.0f;
                        if (attrValue < minValue)
                        {
                            minValue = attrValue;
                        }
                    }
                    // If this Duplicant is better than previous jester, update it
                    if (minValue >= BestVarietyValue)
                    {
                        BestVarietyValue = minValue;
                    }
                }
            }
            // For each value requested, update the value if needed
            var keys = ListPool <string, AchievementStateComponent> .Allocate();

            keys.Clear();
            keys.AddRange(BestAttributeValue.Keys);
            foreach (var attribute in keys)
            {
                // Check each duplicant for the best value
                float best = 0.0f;
                var   attr = Db.Get().Attributes.Get(attribute);
                foreach (var duplicant in Components.LiveMinionIdentities.Items)
                {
                    if (duplicant != null)
                    {
                        best = Math.Max(best, attr.Lookup(duplicant).GetTotalValue());
                    }
                }
                BestAttributeValue[attribute] = best;
            }
            keys.Recycle();
            // Mark visited worlds for DLC
            if (DlcManager.IsExpansion1Active())
            {
                foreach (var world in ClusterManager.Instance.WorldContainers)
                {
                    if (world.IsDupeVisited)
                    {
                        PlanetsVisited.Add(world.id);
                    }
                }
            }
        }
 public static void OnLoad()
 {
     GVD.VersionAlert(DlcManager.IsExpansion1Active());
     Debug.Log("ResearchRequirements: Loaded DLC version of the mod. Last update: 16.03.2021 for 455509 build.");
     Debug.Log("ResearchRequirements: Loaded from: " + Assembly.GetExecutingAssembly().Location);
 }
예제 #20
0
        internal static void ConfigureRecipes()
        {
            const float INPUT_KG = 100f;

            // добавляем переплавку абиссалития в электроплавильню
            if (SmelterOptions.Instance.RecipeKatairiteToTungsten)
            {
                const float PHOSPHORUS             = 10f;
                const float SALT                   = 20f;
                const float TUNGSTEN               = INPUT_KG - PHOSPHORUS - SALT;
                const float SALT_TO_CHLORINE_RATIO = 1f / 3f;
                const float CHLORINEGAS            = SALT * SALT_TO_CHLORINE_RATIO;
                const float MAGMA                  = INPUT_KG - TUNGSTEN - CHLORINEGAS;

                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Katairite.CreateTag(), TUNGSTEN),
                    new ComplexRecipe.RecipeElement(SimHashes.Salt.CreateTag(), SALT),
                    new ComplexRecipe.RecipeElement(SimHashes.Phosphorus.CreateTag(), PHOSPHORUS)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Tungsten.CreateTag(), TUNGSTEN),
                    new ComplexRecipe.RecipeElement(SimHashes.IgneousRock.CreateTag(), MAGMA),
                    new ComplexRecipe.RecipeElement(SimHashes.ChlorineGas.CreateTag(), CHLORINEGAS)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(MetalRefineryConfig.ID, SimHashes.Katairite.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(MetalRefineryConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.MODERATE,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.Tungsten).name,
                        ElementLoader.FindElementByHash(SimHashes.Katairite).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(MetalRefineryConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем переплавку фосфора в стеклоплавильню
            if (SmelterOptions.Instance.RecipePhosphoriteToPhosphorus)
            {
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Phosphorite.CreateTag(), INPUT_KG)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.LiquidPhosphorus.CreateTag(), INPUT_KG)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(GlassForgeConfig.ID, SimHashes.Phosphorite.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(GlassForgeConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT / 2,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.LiquidPhosphorus).name,
                        ElementLoader.FindElementByHash(SimHashes.Phosphorite).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.Result,
                    fabricators = new List <Tag> {
                        TagManager.Create(GlassForgeConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем копию рецептов из электроплавильни. кроме стали и наёбия
            var metalrefinery_recipes = ComplexRecipeManager.Get().recipes
                                        .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(MetalRefineryConfig.ID)))
                                        .ToList();

            metalrefinery_recipes
            .DoIf(
                condition: (ComplexRecipe recipe) => !recipe.id.Contains(SimHashes.Steel.ToString()) &&
                !recipe.id.Contains(SimHashes.Niobium.ToString()),
                action: (ComplexRecipe recipe) => recipe.fabricators.Add(TagManager.Create(ID))
                );

            // добавляем сталь с увеличенным временем фабрикации
            const float fabricationTimeMultiplier = 1.3f;

            metalrefinery_recipes
            .Where((ComplexRecipe recipe) => recipe.id.Contains(SimHashes.Steel.ToString()))
            .ToList()
            .Do((ComplexRecipe recipe) =>
            {
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, recipe.results);
                new ComplexRecipe(id, recipe.ingredients, recipe.results)
                {
                    time        = recipe.time * fabricationTimeMultiplier,
                    description = recipe.description,
                    nameDisplay = recipe.nameDisplay,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            });

            // добавляем копию рецептов из стеклоплавильни с увеличенным временем фабрикации
            var glassforge_recipes = ComplexRecipeManager.Get().recipes
                                     .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(GlassForgeConfig.ID)))
                                     .ToList();

            glassforge_recipes
            .Do((ComplexRecipe recipe) =>
            {
                var results = new ComplexRecipe.RecipeElement[] {
                    new ComplexRecipe.RecipeElement(ElementLoader.GetElement(recipe.results[0].material).lowTempTransition.tag, recipe.results[0].amount)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, results);
                new ComplexRecipe(id, recipe.ingredients, results)
                {
                    time        = recipe.time * fabricationTimeMultiplier,
                    description = string.Format(global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.GetElement(results[0].material).name, ElementLoader.GetElement(recipe.ingredients[0].material).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            });

            // добавляем переплавку пластика
            if (SmelterOptions.Instance.RecipePlasticToNaphtha)
            {
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Polypropylene.CreateTag(), INPUT_KG)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Naphtha.CreateTag(), INPUT_KG)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, SimHashes.Polypropylene.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.Naphtha).name,
                        ElementLoader.FindElementByHash(SimHashes.Polypropylene).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем варку резины
            if (DlcManager.IsExpansion1Active() && SmelterOptions.Instance.RecipeResinToIsoresin)
            {
                var resin    = ElementLoader.FindElementByHash(SimHashes.Resin);
                var water    = resin.highTempTransition.lowTempTransition;
                var isoresin = resin.highTempTransitionOreID;

                float input   = INPUT_KG * 2;
                float output1 = input * resin.highTempTransitionOreMassConversion;
                float output2 = input - output1;

                // жидкая резина
                // побочный продукт вода сохраняется внутри
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(resin.tag, input)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(isoresin.CreateTag(), output1),
                    new ComplexRecipe.RecipeElement(water.tag, output2, ComplexRecipe.RecipeElement.TemperatureOperation.Heated, true),
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, resin.tag);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(isoresin).name,
                        resin.name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);

                // и замерзшая резина
                var resin_solid  = resin.lowTempTransition;
                var ingredients2 = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(resin_solid.tag, input)
                };
                string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID(ID, resin_solid.tag);
                string id2          = ComplexRecipeManager.MakeRecipeID(ID, ingredients2, results);
                new ComplexRecipe(id2, ingredients2, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(isoresin).name,
                        resin_solid.name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, id2);
            }

            // добавляем древесный уголь в печку
            if (SmelterOptions.Instance.RecipeWoodToCarbon)
            {
                const float WOOD   = 200f;
                const float CARBON = 100f;
                const float CO2    = 60f;

                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(WoodLogConfig.TAG, WOOD)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.RefinedCarbon.CreateTag(), CARBON),
                    new ComplexRecipe.RecipeElement(SimHashes.CarbonDioxide.CreateTag(), CO2)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(KilnConfig.ID, WoodLogConfig.TAG);
                string id          = ComplexRecipeManager.MakeRecipeID(KilnConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION,
                        global::STRINGS.UI.FormatAsLink(global::STRINGS.ITEMS.INDUSTRIAL_PRODUCTS.WOOD.NAME, ForestTreeConfig.ID.ToUpperInvariant()),
                        ElementLoader.FindElementByHash(SimHashes.RefinedCarbon).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(KilnConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }
        }