Beispiel #1
0
        public static void Postfix(Pawn pawn, FactionDef faction, ref List <BackstoryCategoryFilter> __result)
        {
            if (!LoadedModManager.GetMod <NoMoreRandomSkillsMod>().GetSettings <NoMoreRandomSkillsSettings>()
                .OnlyCustomBackstories)
            {
                return;
            }

            foreach (var backstoryCategoryFilter in __result)
            {
                for (var j = 0; j < backstoryCategoryFilter.categories.Count; j++)
                {
                    // Log.Message($"Found: {backstoryCategoryFilter.categories[j]}");
                    if (backstoryCategoryFilter.categories[j] == "OutlanderCivil" ||
                        backstoryCategoryFilter.categories[j] == "OutlanderRough" ||
                        backstoryCategoryFilter.categories[j] == "Outlander" ||
                        backstoryCategoryFilter.categories[j] == "Slave" ||
                        backstoryCategoryFilter.categories[j] == "Tribal" ||
                        backstoryCategoryFilter.categories[j] == "TribeCivil" ||
                        backstoryCategoryFilter.categories[j] == "TribeRough" ||
                        backstoryCategoryFilter.categories[j] == "Pirate" ||
                        backstoryCategoryFilter.categories[j] == "Trader" ||
                        backstoryCategoryFilter.categories[j] == "PlayerColony" ||
                        backstoryCategoryFilter.categories[j] == "Offworld")
                    {
                        backstoryCategoryFilter.categories[j] = "REB_" + backstoryCategoryFilter.categories[j];
                    }

                    // Log.Message($"Final: {backstoryCategoryFilter.categories[j]}");
                }
            }
        }
Beispiel #2
0
        static void Postfix(Pawn_PathFollower __instance, Pawn ___pawn)
        {
            bool enablePathing = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().enablePathing;

            if (___pawn.IsColonistPlayerControlled && __instance.Moving && enablePathing)
            {
                if (___pawn.CurJob != null && (___pawn.CurJob.def == JobDefOf.GotoWander || ___pawn.CurJob.def == JobDefOf.Wait_Wander))
                {
                    return;
                }

                if (__instance.nextCellCostLeft > 0f)
                {
                    __instance.nextCellCostLeft = 0;
                }

                if (!___pawn.Position.Equals(lastPos))
                {
                    lastPos = ___pawn.Position;
                    __instance.PatherTick();
                }
                else
                {
                    lastPos = ___pawn.Position;
                }
            }
        }
Beispiel #3
0
        private void MakeGlower()
        {
            if (!LoadedModManager.GetMod <SWSaberMod>().GetSettings <SWSaberSettings>().LightsabersGlowEffect)
            {
                return;
            }

            SaberGlow sb = null;
            var       ownerParentHolder = parent.holdingOwner.Owner.ParentHolder as Pawn;

            ownerParentHolder?.AllComps.Add(sb = new SaberGlow
            {
                parent = ownerParentHolder,
                props  = new CompProperties_Glower
                {
                    compClass  = typeof(SaberGlow),
                    glowRadius = 5f,
                    glowColor  = ColorIntUtility.AsColorInt(
                        parent.TryGetComp <CompSlotLoadable.CompSlotLoadable>()?.Slots
                        .FirstOrDefault(x => ((SlotLoadableDef)x.def).doesChangeColor)?.SlotOccupant
                        ?.TryGetComp <CompSlottedBonus>()?.Props.color ?? ColorLibrary.Violet),
                    overlightRadius = 5f
                }
            });
            sb?.PostSpawnSetup(false);
        }
Beispiel #4
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (Find.Selector.NumSelected > 1 && LoadedModManager.GetMod <RemnantMod>().GetSettings <RemnantModSettings>().hideAuraWhenMultiselect)
            {
                yield break;
            }
            foreach (Gizmo gizmo in base.CompGetGizmosExtra())
            {
                yield return(gizmo);
            }
            if (IsInitialized)
            {
                yield return(new GizmoAuraStatus
                {
                    aura = aura,
                    label = "AuraGizmoLabel".Translate(AbilityUser.Name.ToStringShort),
                    FullShieldBarTex = SolidColorMaterials.NewSolidColorTexture(aura.GetColor())
                });

                foreach (Gizmo gizmo in aura.GetGizmos())
                {
                    yield return(gizmo);
                }
            }
        }
        public static bool UnlockAura(Pawn pawn, string textKey, string labelKey = "LetterLabelUnlockAura")
        {
            if (pawn.health.hediffSet.HasHediff(RWBYDefOf.RWBY_AuraStolen))
            {
                return(false);
            }
            if (!LoadedModManager.GetMod <RemnantMod>().GetSettings <RemnantModSettings>().auraUnlockable)
            {
                return(false);
            }
            if (pawn.story.traits.HasTrait(RWBYDefOf.RWBY_Aura))
            {
                return(false);
            }
            if (semblanceList.Any(s => pawn.story.traits.HasTrait(s)))
            {
                return(false);
            }
            pawn.story.traits.GainTrait(new Trait(RWBYDefOf.RWBY_Aura));
            pawn.TryGetComp <CompAbilityUserAura>().Initialize();

            string label = labelKey.Translate().Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN").CapitalizeFirst();
            string text  = textKey.Translate().Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN").CapitalizeFirst();

            if (pawn.IsColonistPlayerControlled)
            {
                Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.PositiveEvent, pawn);
            }
            return(true);
        }
        // Token: 0x06000008 RID: 8 RVA: 0x000022A8 File Offset: 0x000004A8
        public override float GetScore(Tile tile, int tileID)
        {
            float result;

            if (tile.hilliness != Hilliness.Flat)
            {
                result = -100f;
            }
            else if (tile.elevation <= 0f)
            {
                result = -100f;
            }
            else if (tile.elevation > 1000f)
            {
                result = 0f;
            }
            else if (tile.rainfall < 2000f)
            {
                result = 0f;
            }
            else
            {
                result = 16f + (tile.temperature - 7f) + (tile.rainfall - 600f) / 155f;
            }
            result = result * (LoadedModManager.GetMod <BiomesPlusMod>().GetSettings <BiomesPlusSettings>().Wetland / 100);
            return(result);
        }
        public override bool ShouldSkip(Pawn pawn, bool forced = false)
        {
            if (!LoadedModManager.GetMod <RemnantMod>().GetSettings <RemnantModSettings>().autoCollectAmmunition)
            {
                return(true);
            }
            if (pawn.NonHumanlikeOrWildMan())
            {
                return(true);
            }
            List <ThingDef> thingDefs = AmmunitionUtility.NeedsAmmunition(pawn).ToList();

            thingDefs.RemoveAll(t => pawn.inventory.GetDirectlyHeldThings().Any(d => d.def == t && d.stackCount >= 5));
            if (thingDefs.Count() == 0)
            {
                return(true);
            }
            if (pawn.Map.GetDirectlyHeldThings().Where(t => !t.IsForbidden(pawn) && thingDefs.Contains(t.def)).Count() == 0)
            {
                return(true);
            }
            foreach (ThingDef thingDef in thingDefs)
            {
                if ((!pawn.inventory.GetDirectlyHeldThings().Any(t => t.def == thingDef) || pawn.inventory.GetDirectlyHeldThings().Any(t => t.def == thingDef && t.stackCount < 5)) && pawn.Map.GetDirectlyHeldThings().Any(t => t.def == thingDef))
                {
                    return(false);
                }
            }
            return(true);
        }
            static void Postfix(Pawn __instance, ref List <WorkTypeDef> __result, bool permanentOnly = false)
            {
                if (LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkPassionSkills &&
                    __instance.IsColonist &&
                    __instance.royalty?.MostSeniorTitle?.def?.seniority > 100 &&
                    __instance.royalty.MostSeniorTitle.conceited)
                {
                    var removeList = new List <WorkTypeDef>();
                    foreach (var workType in __result)
                    {
                        var skills = workType.relevantSkills;

                        if (LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkOnlyMajorPassionSkills)
                        {
                            // Will only work Major
                            if (!__instance.skills.skills.Any(a => a.passion == Passion.Major && skills.Contains(a.def)))
                            {
                                removeList.Add(workType);
                            }
                        }
                        else
                        {
                            // Will work all passion skills
                            if (!__instance.skills.skills.Any(a => a.passion != Passion.None && skills.Contains(a.def)))
                            {
                                removeList.Add(workType);
                            }
                        }
                    }
                    if (!removeList.NullOrEmpty())
                    {
                        __result = removeList;
                    }
                }
            }
Beispiel #9
0
        public static void LevelUpHealthScale(Pawn __instance, ref float __result)
        {
            LevelUpModSettings settings = LoadedModManager.GetMod <LevelUpMod>().GetSettings <LevelUpModSettings>();

            if (__instance.health.hediffSet.HasHediff(LevellingHediffDefOf.HealthLevel))
            {
                Hediff HealthLevel = __instance.health.hediffSet.GetFirstHediffOfDef(LevellingHediffDefOf.HealthLevel);
                if (HealthLevel.Severity < 0)
                {
                    float Severity        = Rand.Range(0f, settings.MaxRandomLevel);
                    float baseHealthScale = __instance.RaceProps.baseHealthScale;
                    HealthLevel.Severity = Severity / baseHealthScale;
                    Log.Message("Level was somehow negative? Please report to Level This! Author");
                }
                int   Level       = Mathf.FloorToInt(HealthLevel.Severity);
                float RoundedRate = (float)Math.Round(settings.LevelUpHealthRate, digits: 2);
                float LevelUpRate = RoundedRate + 1f;
                //Log.Message("Compounding Health Maths: " + __instance.RaceProps.baseHealthScale + "(1.1f)^" + Level + " = " + __instance.RaceProps.baseHealthScale * (Mathf.Pow(1.1f, Level)), true);
                if (settings.HealthScalingType == "Compounding Health")
                {
                    __result *= (1 * Mathf.Pow(LevelUpRate, Level));
                    return;
                }
                if (settings.HealthScalingType == "Simple Health")
                {
                    __result *= (1 + (RoundedRate * Level));
                    return;
                }
            }
        }
Beispiel #10
0
        private static int GetCustomCost(int originalCost)
        {
            var recountedCost = originalCost * LoadedModManager.GetMod <SimplyMoreBridgesMod>()
                                .GetSettings <SimplyMoreBridgesSettings>().CostPercent;

            return(Convert.ToInt32(Math.Ceiling(recountedCost)));
        }
        // Token: 0x06000003 RID: 3 RVA: 0x00002168 File Offset: 0x00000368
        public static bool CheckSettingsVersionNumber(int checkedout)
        {
            var roRAversionNumber = LoadedModManager.GetMod <RoRASettings.RoRAMod>().GetSettings <RoRASettings>()
                                    .RoRAversionNumber;

            return(roRAversionNumber == checkedout);
        }
        /// <summary>Tries to transform the pawn</summary>
        /// <param name="pawn">The pawn.</param>
        /// <param name="cause">The cause.</param>
        /// <returns></returns>
        public bool TryTransform(Pawn pawn, Hediff cause)
        {
            RandUtilities.PushState();
            bool changed = false;

            try
            {
                float chance = changeChance < 0 // If changeChance wasn't overriden use the default from the settings.
                                   ? LoadedModManager.GetMod <PawnmorpherMod>().GetSettings <PawnmorpherSettings>().transformChance
                                   : changeChance;

                //apply the new stat
                chance *= pawn.GetStatValue(PMStatDefOf.TransformationSensitivity);
                chance  = Mathf.Clamp(chance, 0, 100);


                if (Rand.Range(0, 100) < chance)
                {
                    changed = TransformPawn(pawn, cause);
                }
            }
            finally
            {
                RandUtilities.PopState();
            }

            return(changed);
        }
Beispiel #13
0
        static VehicleHarmony()
        {
            //harmony.PatchAll(Assembly.GetExecutingAssembly());
            //Harmony.DEBUG = true;
            Log.Message($"{LogLabel} version {Assembly.GetExecutingAssembly().GetName().Version}");

            IEnumerable <Type> patchCategories = GenTypes.AllTypes.Where(t => t.GetInterfaces().Contains(typeof(IPatchCategory)));

            foreach (Type patchCategory in patchCategories)
            {
                IPatchCategory patch = (IPatchCategory)Activator.CreateInstance(patchCategory, null);
                try
                {
                    patch.PatchMethods();
                }
                catch (Exception ex)
                {
                    SmashLog.Error($"Failed to Patch <type>{patch.GetType().FullName}</type>. Method=\"{methodPatching}\"");
                    throw ex;
                }
            }
            SmashLog.Message($"{LogLabel} <success>{Harmony.GetPatchedMethods().Count()} patches successfully applied.</success>");

            ResolveAllReferences();
            //Will want to be added via xml
            FillVehicleLordJobTypes();

            LoadedModManager.GetMod <VehicleMod>().InitializeTabs();
            VehicleMod.settings.Write();
        }
        static void SendMessages(bool __result, Pawn humanlike, Pawn animal, float baseChance)
        {
            if (__result)
            {
                var           relation      = humanlike.relations.DirectRelations.First(r => r.otherPawn == animal);
                bool          any           = false;
                AspectTracker aspectTracker = humanlike.GetAspectTracker();
                if (aspectTracker == null)
                {
                    return;
                }
                foreach (BondedAspect bondedAspect in aspectTracker.Aspects.OfType <BondedAspect>())
                {
                    any = true;
                    bondedAspect.Notify_BondedToAnimal(relation);
                }

                var mOutlook = humanlike.GetMutationOutlook();
                if (!any && (mOutlook == MutationOutlook.Furry || mOutlook == MutationOutlook.PrimalWish))
                {
                    if (Rand.Value < LoadedModManager.GetMod <PMTribalMod>().Settings.totemAspectAddChance)
                    {
                        aspectTracker.Add(Defs.Aspects.TotemAspect);
                    }
                }
            }
        }
Beispiel #15
0
        public static string GetColorForTier(int tier)
        {
            switch (tier)
            {
            case 1:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorMystic);

            case 2:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorLegendary);

            case 3:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorEpic);

            case 4:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorRare);

            case 5:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorUncommon);

            case 6:
                return(LoadedModManager.GetMod <TraitRarityColorsMod>().GetSettings <TraitRarityColorsModSettings>().colorCommon);

            default:
                return("<color=#FFFFFF>");
            }
        }
Beispiel #16
0
        // Token: 0x0600000A RID: 10 RVA: 0x00002354 File Offset: 0x00000554
        public override float GetScore(Tile tile, int tileID)
        {
            float result;

            if ((tile.hilliness != Hilliness.Mountainous) & (tile.hilliness != Hilliness.Impassable))
            {
                result = -100f;
            }
            else if (tile.elevation <= 0f)
            {
                result = -100f;
            }
            else if (tile.elevation > 1000f)
            {
                result = 0f;
            }
            else
            {
                result = 22.5f + ((tile.temperature - 20f) * 2.2f) + ((tile.rainfall - 600f) / 100f);
            }

            if (LoadedModManager.GetMod <BiomesPlusMod>().GetSettings <BiomesPlusSettings>().VolcanoVariety&&
                result == -100f && tile.elevation > 750f && tile.hilliness > Hilliness.Flat)
            {
                result = 22.5f + ((tile.temperature - 20f) * 2.2f) + ((tile.rainfall - 600f) / 100f);
            }

            result *= LoadedModManager.GetMod <BiomesPlusMod>().GetSettings <BiomesPlusSettings>().Volcano / 100;
            return(result);
        }
        public static void DefsLoaded()
        {
//            Log.Warning("LWM.deepstorag - defs loaded");
            // Todo? If settings are different from defaults, then:
            Setup();
            // Architect Menu:
            if (architectMenuDesigCatDef != architectMenuDefaultDesigCatDef ||
                architectMenuMoveALLStorageItems) // in which case, we need to redo menu anyway
            {
                ArchitectMenu_ChangeLocation(architectMenuDesigCatDef, true);
            }
            // Other def-related changes:
            if (defaultStoragePriority != StoragePriority.Important)
            {
                foreach (var d in allDeepStorageUnits)
                {
                    d.building.defaultStorageSettings.Priority = defaultStoragePriority;
                }
            }
            // Re-read Mod Settings - some won't have been read because Defs weren't loaded:
            //   (do this after above to allow user to override changes)
            //   (LoadedModManager.GetMod(typeof(DeepStorageMod)).Content.Identifier and typeof(DeepStorageMod).Name by the way)
//todo:
            Utils.Mess(Utils.DBF.Settings, "Defs Loaded.  About to re-load settings");
            //var s = LoadedModManager.ReadModSettings<Settings>("LWM.DeepStorage", "DeepStorageMod");
            var mod = LoadedModManager.GetMod(typeof(DeepStorageMod));
            var s   = LoadedModManager.ReadModSettings <Settings>(mod.Content.FolderName, "DeepStorageMod");
        }
        public override void GenerateFresh(string seed)
        {
            var settings = LoadedModManager.GetMod <Mod_Cities>().GetSettings <ModSettings_Cities>();

            GenerateCities(settings.citiesPer100kTiles.RandomInRange, false);
            GenerateCities(settings.abandonedPer100kTiles.RandomInRange, true);
        }
        public int UseISR2G()
        {
            var result   = 0;
            var settings = LoadedModManager.GetMod <RoadsOfTheRim>().GetSettings <RoadsOfTheRimSettings>();

            // Setting the caravan to use ISR2G or AISR2G if present and settings allow it
            // TO DO : I can do better than hardcode
            if (!settings.useISR2G)
            {
                return(result);
            }

            foreach (var aThing in CaravanInventoryUtility.AllInventoryItems(GetCaravan()))
            {
                if (result < 1 && aThing.GetInnerIfMinified().def.defName == "RotR_ISR2GNew")
                {
                    result = 1;
                }

                if (aThing.GetInnerIfMinified().def.defName != "RotR_AISR2GNew")
                {
                    continue;
                }

                result = 2;
                return(result);
            }

            return(result);
        }
Beispiel #20
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            Map         map = (Map)parms.target;
            PawnKindDef pawnKindDef;

            return(this.TryFindAnimalKind(map.Tile, out pawnKindDef) && LoadedModManager.GetMod <AlphaAnimals_Mod>().GetSettings <AlphaAnimals_Settings>().flagCactipineDroppods);
        }
Beispiel #21
0
                static void Postfix(Pawn __instance, WorkTypeDef w, ref bool __result)
                {
                    // __result = true means the work is disabled and to check further now.
                    if (__result && LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkPassionSkills &&
                        __instance.royalty != null &&
                        __instance.royalty.MostSeniorTitle != null &&
                        __instance.royalty.MostSeniorTitle.def != null &&
                        __instance.royalty.MostSeniorTitle.def.seniority > 100)
                    {
                        var skills = w.relevantSkills;

                        if (LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkOnlyMajorPassionSkills)
                        {
                            // Work only major passion skills
                            if (__instance.skills.skills.Any(a => a.passion == Passion.Major && skills.Contains(a.def)))
                            {
                                __result = false;
                            }
                        }
                        else
                        {
                            // Work all passion skills.
                            if (__instance.skills.skills.Any(a => a.passion != Passion.None && skills.Contains(a.def)))
                            {
                                __result = false;
                            }
                        }
                    }
                }
Beispiel #22
0
        /// <summary>
        /// Main constructor for setting up some values and executing harmony patches.
        /// </summary>
        static Cutebold_Assemblies()
        {
            CuteboldSettings = LoadedModManager.GetMod <CuteboldMod>().GetSettings <Cutebold_Settings>();

            try { CreateButcherRaceList(); } // Added because of an update to HAR that changed how referencing other races worked.
            catch (MissingFieldException e)
            {
                Log.Error($"{ModName}: Unable to create butcher race list. Check and see if Humanoid Alien Races has been updated.\n    {e.GetBaseException()}");
            }
            CreateHumanoidLeatherList();

            new Cutebold_Patch_Names(harmony);

            // Eating Humanoid Meat
            harmony.Patch(AccessTools.Method(typeof(Thing), "Ingested"), postfix: new HarmonyMethod(typeof(Cutebold_Assemblies), "CuteboldIngestedPostfix"));
            // Butchering Humanoid Corpses
            harmony.Patch(AccessTools.Method(typeof(Corpse), "ButcherProducts"), postfix: new HarmonyMethod(typeof(Cutebold_Assemblies), "CuteboldButcherProductsPostfix"));
            // Wearing Humanoid Clothing
            harmony.Patch(AccessTools.Method(typeof(ThoughtWorker_HumanLeatherApparel), "CurrentStateInternal"), postfix: new HarmonyMethod(typeof(Cutebold_Assemblies), "CuteboldCurrentStateInternalPostfix"));

            new Cutebold_Patch_BodyAddons(harmony);

            new Cutebold_Patch_Stats(harmony);

            new Cutebold_Patch_HediffRelated(harmony);
        }
Beispiel #23
0
        public static bool RemoveUserShow(UserShowDef userShow)
        {
            // Remove from settings
            RimFlixSettings settings = LoadedModManager.GetMod <RimFlixMod>().GetSettings <RimFlixSettings>();

            if (!settings.UserShows.Contains(userShow))
            {
                Log.Message($"RimFlix: Could not find show {userShow.defName} : {userShow.label}");
                return(false);
            }
            bool result = settings.UserShows.Remove(userShow);

            // We can't delete from DefDatabase, so mark as deleted
            userShow.deleted = true;

            // Do not remove graphic data if there are other shows with same path
            IEnumerable <UserShowDef> twins = DefDatabase <UserShowDef> .AllDefs.Where(s => (s.path?.Equals(userShow.path) ?? false) && !s.deleted);

            if (!twins.Any())
            {
                foreach (GraphicData frame in userShow.frames)
                {
                    result = RimFlixContent.contentList.Remove(frame.texPath);
                }
            }
            RimFlixSettings.showUpdateTime = RimFlixSettings.TotalSeconds;
            return(true);
        }
Beispiel #24
0
        public override void CompTickRare()
        {
            base.CompTickRare();
            if (!LoadedModManager.GetMod <MonsterHunterRimworldMod>().GetSettings <MonsterHunterRimworldModSettings>().elderDragonWeatherEffects)
            {
                return;
            }
            if (!(parent is Pawn elderDragon))
            {
                return;
            }
            if (!WyvernUtility.IsElderDragon(elderDragon))
            {
                return;
            }
            if (elderDragon.Dead)
            {
                return;
            }
            Map map = elderDragon.Map;

            if (map == null)
            {
                return;
            }
            WeatherDef newWeather = new WeatherDef();

            newWeather = WeatherDef.Named("RainyThunderstorm");
            if (map.weatherManager.curWeather != newWeather)
            {
                map.weatherManager.TransitionTo(newWeather);
            }
        }
Beispiel #25
0
        static void Postfix(Thing thing, StatDef stat, bool applyPostProcess, ref float __result)
        {
            Pawn pawn = thing as Pawn;

            if ((pawn != null) && (pawn.IsColonistPlayerControlled))
            {
                bool enableWorking          = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().enableWorking;
                bool enableLearning         = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().enableLearning;
                bool enableCarryingCapacity = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().enableCarryingCapacity;

                if (enableWorking && stat.Equals(StatDefOf.WorkSpeedGlobal))
                {
                    float workMultiplier = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().workMultiplier;
                    __result *= workMultiplier;
                }
                else if (enableLearning && stat.Equals(StatDefOf.GlobalLearningFactor))
                {
                    float learnMultiplier = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().learnMultiplier;
                    __result *= learnMultiplier;
                }
                else if (enableCarryingCapacity && stat.Equals(StatDefOf.CarryingCapacity))
                {
                    float carryingCapacityMultiplier = LoadedModManager.GetMod <RimCheats>().GetSettings <RimCheatsSettings>().carryingCapacityMultiplier;
                    __result *= carryingCapacityMultiplier;
                }
            }
        }
        /// <summary>called every once and a while</summary>
        public override void TickRare()
        {
            if (!Spawned || !LoadedModManager.GetMod <PawnmorpherMod>().GetSettings <PawnmorpherSettings>().enableMutagenMeteor)
            {
                return;
            }

            IEnumerable <Thing> enumerable = GenRadial.RadialDistinctThingsAround(Position, Map, 2.5f, true);

            var mutagen = MutagenDefOf.defaultMutagen;

            foreach (Thing thing in enumerable)
            {
                if (thing is Pawn pawn)
                {
                    MutatePawn(pawn, mutagen);
                }
                else if (thing is Plant plant)
                {
                    if (Rand.Value >= _p)
                    {
                        continue;
                    }

                    PMPlantUtilities.TryMutatePlant(plant);
                }
            }
        }
Beispiel #27
0
 public RuntimeGC(ModContentPack pack) : base(pack)
 {
     Settings = LoadedModManager.ReadModSettings <RuntimeGCSettings>(Content.PackageId, this.GetType().Name);
     Toolbox.Launcher.Launch(Settings.AutoCleanModMetaData, Settings.AutoCleanLanguageData, Settings.AutoCleanDefPackage);
     Mute.Launcher.Launch(Settings.DoMuteGC, Settings.DoMuteBL);
     Verse.Log.Message("[RuntimeGC] Mod settings loaded.");
 }
Beispiel #28
0
        public static IEnumerable <Thing> MakeRecipeProducts(RecipeDef recipeDef, IRecipeProductWorker worker, List <Thing> ingredients, Thing dominantIngredient, IBillGiver billGiver)
        {
            var result = MakeRecipeProductsInt(recipeDef, worker, ingredients, dominantIngredient, billGiver);

            LoadedModManager.GetMod <Mod_AutoMachineTool>().Hopm.ForEach(m => m.Postfix_MakeRecipeProducts(ref result, recipeDef, 1f, ingredients));
            return(result);
        }
Beispiel #29
0
        private bool CanBeFormerHuman()
        {
            if (!LoadedModManager.GetMod <PawnmorpherMod>().GetSettings <PawnmorpherSettings>().enableWildFormers)
            {
                return(false);
            }
            if (parent.def.GetModExtension <FormerHumanSettings>()?.neverFormerHuman == true)
            {
                return(false);
            }
            if (parent.Faction != null)
            {
                return(false);
            }
            var pawn = (Pawn)parent;

            if (pawn.relations == null)
            {
                return(true);
            }
            if (pawn.relations.DirectRelations.Any(r => r.def == PawnRelationDefOf.Child || r.def == PawnRelationDefOf.Parent))
            {
                return(false);
            }

            //make sure the animal is old enough

            var age = pawn.ageTracker.AgeBiologicalYears;
            //convert to human years
            var hAge = age * (ThingDefOf.Human.race.lifeExpectancy) / pawn.RaceProps.lifeExpectancy;



            return(hAge > 20); //make sure their older then 20 human years
        }
Beispiel #30
0
        public static void OptionsMenu(Rect rect)
        {
            var mod = LoadedModManager.GetMod <TwitchToolkit>();
            Listing_TwitchToolkit listingStandard = new Listing_TwitchToolkit();

            listingStandard.Begin(rect);
            listingStandard.CheckboxLabeled("Should buildings unable to be uninstalled be included in the item list? ", ref MinifiableBuildings, "Non-Minifiable Buildings?");
            listingStandard.CheckboxLabeled("Should viewers have unlimited coins? ", ref UnlimitedCoins, "Unlimited coins?");
            listingStandard.CheckboxLabeled("Should events have cooldowns? ", ref EventsHaveCooldowns, "Event cooldowns?");
            listingStandard.CheckboxLabeled("Should viewer names be repeated in raids/aid? ", ref RepeatViewerNames, "Repeat viewers?");
            listingStandard.CheckboxLabeled("Large voting window? ", ref LargeVotingWindow, "Large window?");
            listingStandard.Label("How many minutes in a cooldown period: " + EventCooldownInterval);
            EventCooldownInterval = listingStandard.Slider((float)EventCooldownInterval, 1, 120);
            listingStandard.Label("Seperate chatroom UUID:");
            ChatroomUUID = listingStandard.TextEntry(ChatroomUUID);
            listingStandard.Label("Seperate channel id:");
            ChannelID = listingStandard.TextEntry(ChannelID);
            if (listingStandard.ButtonText("Reset Options"))
            {
                MinifiableBuildings   = false;
                UnlimitedCoins        = false;
                EventsHaveCooldowns   = true;
                EventCooldownInterval = 15;
                mod.WriteSettings();
            }
            listingStandard.End();
        }