private static void DrawCustomDifficultySlider(Listing_Standard listing, string optionName, ref float value, ToStringStyle style, ToStringNumberSense numberSense, float min, float max, float precision = 0.01f, bool reciprocate = false, float reciprocalCutoff = 1000f)
        {
            string str  = (reciprocate ? "_Inverted" : "");
            string str2 = optionName.CapitalizeFirst();
            string key  = "Difficulty_" + str2 + str + "_Label";
            string key2 = "Difficulty_" + str2 + str + "_Info";
            float  num  = value;

            if (reciprocate)
            {
                num = Reciprocal(num, reciprocalCutoff);
            }
            TaggedString label = key.Translate() + ": " + num.ToStringByStyle(style, numberSense);

            listing.Label(label, -1f, key2.Translate());
            float num2 = listing.Slider(num, min, max);

            if (num2 != num)
            {
                num = GenMath.RoundTo(num2, precision);
            }
            if (reciprocate)
            {
                num = Reciprocal(num, reciprocalCutoff);
            }
            value = num;
        }
Пример #2
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var listing = new Listing_Standard();

            listing.Begin(inRect);
            listing.Gap();
            listing.CheckboxLabeled("LimitCitySize".Translate().Formatted(Config.citySizeScale, Config.citySizeScale), ref Config.customCitySize);
            listing.IntAdjuster(ref Config.citySizeScale, 10, 50);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityQuests".Translate(), ref Config.enableQuestSystem);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityEvents".Translate(), ref Config.enableEvents);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityTurrets".Translate(), ref Config.enableTurrets);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityMortars".Translate(), ref Config.enableMortars);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityLooting".Translate(), ref Config.enableLooting);
            listing.Gap();
            listing.Label("CityLootScale".Translate().Formatted(GenMath.RoundTo(Config.lootScale, 0.05F)));
            Config.lootScale = listing.Slider(Config.lootScale, 0, 3);
            // listing.Label("AbandonedCityChance".Translate().Formatted(GenMath.RoundTo(Config.abandonedChance, 0.01F)));
            // Config.abandonedChance = listing.Slider(Config.abandonedChance, 0, 1);
            listing.Gap();
            listing.Label("CitiesPer100kTiles".Translate());
            listing.IntRange(ref Config.citiesPer100kTiles, 0, 100);
            listing.Gap();
            listing.Label("AbandonedPer100kTiles".Translate());
            listing.IntRange(ref Config.abandonedPer100kTiles, 0, 100);
            listing.Gap();
            listing.Label("CompromisedPer100kTiles".Translate());
            listing.IntRange(ref Config.compromisedPer100kTiles, 0, 100);
            listing.Gap();
            listing.Label("MinCitadelsPerWorld".Translate().Formatted(Config.minCitadelsPerWorld));
            listing.IntAdjuster(ref Config.minCitadelsPerWorld, 1, 1);
            listing.Gap();
            {
                ///////////////
                // listing.Gap();
                // listing.CheckboxLabeled("Override all map sizes (disables upon exiting the game): [{0} x {1}]".Formatted(Config.customMapX, Config.customMapZ), ref Config.customMapSizes);
                // listing.Gap();
                // listing.Label("Custom map size X: [{0}]".Formatted(Config.customMapX));
                // listing.IntAdjuster(ref Config.customMapX, 5, 10);
                // listing.IntAdjuster(ref Config.customMapX, 100, 10);
                // listing.Label("Custom map size Z: [{0}]".Formatted(Config.customMapZ));
                // listing.IntAdjuster(ref Config.customMapZ, 5, 10);
                // listing.IntAdjuster(ref Config.customMapZ, 100, 10);
                // listing.Gap();
                // listing.Gap();
            }
            if (listing.ButtonText("CitiesConfigReset".Translate()))
            {
                settings.config = new Config_Cities();
            }
            listing.End();
            base.DoSettingsWindowContents(inRect);
        }
Пример #3
0
 public override void DoSettingsWindowContents(Rect inRect)
 {
     checked
     {
         float            sum = Mathf.Max((SyrIndividualitySettings.commonalityStraight + SyrIndividualitySettings.commonalityBi + SyrIndividualitySettings.commonalityGay + SyrIndividualitySettings.commonalityAsexual), 0.05f);
         Listing_Standard listing_Standard = new Listing_Standard();
         listing_Standard.Begin(inRect);
         listing_Standard.Label("SyrTraitsTraitCount".Translate());
         listing_Standard.IntRange(ref SyrIndividualitySettings.traitCount, 0, 8);
         listing_Standard.Gap(24f);
         if (PsychologyActive || RationalRomanceActive)
         {
             GUI.color = Color.red;
             string disabledReason = "";
             if (PsychologyActive)
             {
                 disabledReason = "SyrTraitsDisabledPsychology".Translate();
             }
             else if (RationalRomanceActive)
             {
                 disabledReason = "SyrTraitsDisabledRationalRomance".Translate();
             }
             listing_Standard.Label("SyrTraitsDisabled".Translate() + ": " + disabledReason);
             GUI.color = Color.white;
         }
         else
         {
             listing_Standard.CheckboxLabeled("SyrTraitsDisableRomance".Translate(), ref SyrIndividualitySettings.disableRomance, "SyrTraitsDisableRomanceTooltip".Translate());
         }
         listing_Standard.Gap(24f);
         if (!RomanceDisabled)
         {
             listing_Standard.Label("SyrTraitsSexualityCommonality".Translate());
             listing_Standard.Label("SyrTraitsSexualityCommonalityStraight".Translate() + ": " + (SyrIndividualitySettings.commonalityStraight / sum).ToStringByStyle(ToStringStyle.PercentZero));
             SyrIndividualitySettings.commonalityStraight = listing_Standard.Slider(GenMath.RoundTo(SyrIndividualitySettings.commonalityStraight, 0.1f), 0f, 1f);
             listing_Standard.Label("SyrTraitsSexualityCommonalityBi".Translate() + ": " + (SyrIndividualitySettings.commonalityBi / sum).ToStringByStyle(ToStringStyle.PercentZero));
             SyrIndividualitySettings.commonalityBi = listing_Standard.Slider(GenMath.RoundTo(SyrIndividualitySettings.commonalityBi, 0.1f), 0f, 1f);
             listing_Standard.Label("SyrTraitsSexualityCommonalityGay".Translate() + ": " + (SyrIndividualitySettings.commonalityGay / sum).ToStringByStyle(ToStringStyle.PercentZero));
             SyrIndividualitySettings.commonalityGay = listing_Standard.Slider(GenMath.RoundTo(SyrIndividualitySettings.commonalityGay, 0.1f), 0f, 1f);
             listing_Standard.Label("SyrTraitsSexualityCommonalityAsexual".Translate() + ": " + (SyrIndividualitySettings.commonalityAsexual / sum).ToStringByStyle(ToStringStyle.PercentZero));
             SyrIndividualitySettings.commonalityAsexual = listing_Standard.Slider(GenMath.RoundTo(SyrIndividualitySettings.commonalityAsexual, 0.1f), 0f, 1f);
             listing_Standard.Gap(12f);
         }
         if (listing_Standard.ButtonText("SyrTraitsDefaultSettings".Translate(), "SyrTraitsDefaultSettingsTooltip".Translate()))
         {
             SyrIndividualitySettings.traitCount.min      = 2;
             SyrIndividualitySettings.traitCount.max      = 3;
             SyrIndividualitySettings.commonalityStraight = 0.8f;
             SyrIndividualitySettings.commonalityBi       = 0.1f;
             SyrIndividualitySettings.commonalityGay      = 0.1f;
             SyrIndividualitySettings.commonalityAsexual  = 0f;
         }
         listing_Standard.End();
         settings.Write();
     }
 }
Пример #4
0
        public float RandomPsychicFactor()
        {
            float num = Mathf.Clamp(Rand.Gaussian(0f, 0.5f), -1f, 1f);

            if (num > -0.3f && num < 0.3) //this ensures there is few with 20% and many with 0% psychicFactor
            {
                num = 0f;
            }
            return(GenMath.RoundTo(num, 0.2f));
        }
Пример #5
0
 public override void DoSettingsWindowContents(Rect inRect)
 {
     checked
     {
         Listing_Standard listing_Standard = new Listing_Standard();
         listing_Standard.Begin(inRect);
         listing_Standard.Label("SyrDoorMatsSlowdown".Translate() + ": " + DoorMatsSettings.slowdown, -1, "SyrDoorMatsSlowdownToolTip".Translate());
         listing_Standard.Gap(6f);
         DoorMatsSettings.slowdown = (int)listing_Standard.Slider(GenMath.RoundTo(DoorMatsSettings.slowdown, 5), 0, 100);
         listing_Standard.Gap(24f);
         if (listing_Standard.ButtonText("SyrDoorMatsDefaultSettings".Translate(), "SyrDoorMatsDefaultSettingsTooltip".Translate()))
         {
             DoorMatsSettings.slowdown = 40;
         }
         listing_Standard.End();
         settings.Write();
     }
 }
Пример #6
0
        public void IndividualityValueSetup()
        {
            Pawn pawn = parent as Pawn;

            if (parent.def.defName == "ChjDroid")
            {
                if (sexuality == Sexuality.Undefined)
                {
                    sexuality = Sexuality.Asexual;
                }
                if (RomanceFactor == -1f)
                {
                    RomanceFactor = 0f;
                }
                if (PsychicFactor == -2f)
                {
                    PsychicFactor = RandomPsychicFactor();
                }
            }
            else if (parent.def.defName == "Harpy")
            {
                if (sexuality == Sexuality.Undefined)
                {
                    sexuality = Sexuality.Bisexual;
                }
            }
            if (sexuality == Sexuality.Undefined)
            {
                sexuality = RandomSexualityByWeight();
            }
            if (RomanceFactor == -1f)
            {
                RomanceFactor = GenMath.RoundTo(Rand.Range(0.1f, 1f), 0.1f);
            }
            if (PsychicFactor == -2f)
            {
                PsychicFactor = RandomPsychicFactor();
            }
            if (pawn != null && BodyWeight == -29)
            {
                BodyWeight = RandomBodyWeightByBodyType(pawn);
            }
        }
Пример #7
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var listing = new Listing_Standard();

            listing.Begin(inRect);
            listing.Gap();
            listing.CheckboxLabeled("Limit city map size (reduces lag)", ref settings.limitCitySize);
            listing.Gap();
            listing.CheckboxLabeled("Enable city quest system", ref settings.enableQuestSystem);
            listing.Gap();
            listing.CheckboxLabeled("Enable city events (food drops, reinforcements)", ref settings.enableEvents);
            listing.Gap();
            listing.Label("Abandoned city chance: [" + GenMath.RoundTo(settings.abandonedChance, 0.01F) + "]");
            settings.abandonedChance = listing.Slider(settings.abandonedChance, 0, 1);
            listing.Gap();
            listing.Label("City spawn frequency:");
            listing.IntRange(ref settings.citiesPer100kTiles, 0, 100);
            listing.End();
            base.DoSettingsWindowContents(inRect);
        }
Пример #8
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var listing = new Listing_Standard();

            listing.Begin(inRect);
            listing.Gap();
            listing.CheckboxLabeled("LimitCitySize".Translate(), ref settings.limitCitySize);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityQuests".Translate(), ref settings.enableQuestSystem);
            listing.Gap();
            listing.CheckboxLabeled("EnableCityEvents".Translate(), ref settings.enableEvents);
            listing.Gap();
            listing.Label("AbandonedCityChance".Translate().Formatted(GenMath.RoundTo(settings.abandonedChance, 0.01F)));
            settings.abandonedChance = listing.Slider(settings.abandonedChance, 0, 1);
            listing.Gap();
            listing.Label("CitiesPer100kTiles".Translate());
            listing.IntRange(ref settings.citiesPer100kTiles, 0, 100);
            listing.End();
            base.DoSettingsWindowContents(inRect);
        }
Пример #9
0
 public override void DoSettingsWindowContents(Rect inRect)
 {
     checked
     {
         Listing_Standard listing_Standard = new Listing_Standard();
         listing_Standard.Begin(inRect);
         listing_Standard.CheckboxLabeled("UF_ShowProcessIcon".Translate(), ref UF_Settings.showProcessIconGlobal, "UF_ShowProcessIconTooltip".Translate());
         listing_Standard.Gap(12);
         listing_Standard.Label("UF_ProcessIconSize".Translate() + ": " + UF_Settings.processIconSize.ToStringByStyle(ToStringStyle.PercentZero), -1, "UF_ProcessIconSizeTooltip".Translate());
         UF_Settings.processIconSize = listing_Standard.Slider(GenMath.RoundTo(UF_Settings.processIconSize, 0.05f), 0.2f, 1f);
         listing_Standard.CheckboxLabeled("UF_SingleItemIcon".Translate(), ref UF_Settings.singleItemIcon, "UF_SingleItemIconTooltip".Translate());
         listing_Standard.Gap(12);
         listing_Standard.CheckboxLabeled("UF_SortAlphabetically".Translate(), ref UF_Settings.sortAlphabetically, "UF_SortAlphabeticallyTooltip".Translate());
         listing_Standard.GapLine(30);
         listing_Standard.CheckboxLabeled("UF_ShowCurrentQualityIcon".Translate(), ref UF_Settings.showCurrentQualityIcon, "UF_ShowCurrentQualityIconTooltip".Translate());
         listing_Standard.Gap(12);
         listing_Standard.CheckboxLabeled("UF_ShowTargetQualityIcon".Translate(), ref UF_Settings.showTargetQualityIcon, "UF_ShowTargetQualityTooltip".Translate());
         listing_Standard.GapLine(30);
         Rect rectReplaceBarrels = listing_Standard.GetRect(30f);
         TooltipHandler.TipRegion(rectReplaceBarrels, "UF_ReplaceVanillaBarrelsTooltip".Translate());
         if (Widgets.ButtonText(rectReplaceBarrels, "UF_ReplaceVanillaBarrels".Translate(), true, true, true))
         {
             ReplaceVanillaBarrels();
         }
         listing_Standard.GapLine(30);
         Rect rectDefaultSettings = listing_Standard.GetRect(30f);
         TooltipHandler.TipRegion(rectDefaultSettings, "UF_DefaultSettingsTooltip".Translate());
         if (Widgets.ButtonText(rectDefaultSettings, "UF_DefaultSettings".Translate(), true, true, true))
         {
             UF_Settings.showProcessIconGlobal  = true;
             UF_Settings.processIconSize        = 0.6f;
             UF_Settings.singleItemIcon         = true;
             UF_Settings.sortAlphabetically     = false;
             UF_Settings.showCurrentQualityIcon = true;
             UF_Settings.showTargetQualityIcon  = false;
         }
         listing_Standard.End();
         settings.Write();
     }
 }
Пример #10
0
        public int RandomBodyWeightByBodyType(Pawn pawn)
        {
            int num;

            if (pawn?.story?.bodyType != null)
            {
                if (parent.def.defName == "Harpy")
                {
                    num = GenMath.RoundTo(Rand.Range(0, 10), 10);
                }
                else if (pawn.story.bodyType == BodyTypeDefOf.Fat)
                {
                    num = GenMath.RoundTo(Rand.Range(30, 40), 10);
                }
                else if (pawn.story.bodyType == BodyTypeDefOf.Hulk)
                {
                    num = GenMath.RoundTo(Rand.Range(10, 20), 10);
                }
                else if (pawn.story.bodyType == BodyTypeDefOf.Thin)
                {
                    num = GenMath.RoundTo(Rand.Range(-20, -10), 10);
                }
                else if (pawn.story.bodyType == BodyTypeDefOf.Female)
                {
                    num = GenMath.RoundTo(Rand.Range(-10, 0), 10);
                }
                else
                {
                    num = GenMath.RoundTo(Rand.Range(0, 10), 10);
                }
            }
            else
            {
                return(-29);
            }
            return(Mathf.Clamp(num, -20, 40));
        }
Пример #11
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            checked
            {
                Listing_Standard listing_Standard = new Listing_Standard();
                listing_Standard.Begin(inRect);
                if (HarvestYieldSettings.plantYieldMax > 5.0f)
                {
                    listing_Standard.Label("HarvestYieldMax".Translate() + ": " + "Unlimited".Translate(), -1, "HarvestYieldMaxTooltip".Translate());
                }
                else
                {
                    listing_Standard.Label("HarvestYieldMax".Translate() + ": " + HarvestYieldSettings.plantYieldMax.ToStringPercent(), -1, "HarvestYieldMaxTooltip".Translate());
                }
                listing_Standard.Gap(6f);
                HarvestYieldSettings.plantYieldMax = listing_Standard.Slider(GenMath.RoundTo(HarvestYieldSettings.plantYieldMax, 0.1f), 1f, 5.1f);
                listing_Standard.Gap(12f);

                if (HarvestYieldSettings.animalYieldMax > 5.0f)
                {
                    listing_Standard.Label("AnimalYieldMax".Translate() + ": " + "Unlimited".Translate(), -1, "AnimalYieldMaxTooltip".Translate());
                }
                else
                {
                    listing_Standard.Label("AnimalYieldMax".Translate() + ": " + HarvestYieldSettings.animalYieldMax.ToStringPercent(), -1, "AnimalYieldMaxTooltip".Translate());
                }
                listing_Standard.Gap(6f);
                HarvestYieldSettings.animalYieldMax = listing_Standard.Slider(GenMath.RoundTo(HarvestYieldSettings.animalYieldMax, 0.1f), 1f, 5.1f);
                listing_Standard.Gap(12f);

                if (HarvestYieldSettings.miningYieldMax > 5.0f)
                {
                    listing_Standard.Label("MiningYieldMax".Translate() + ": " + "Unlimited".Translate(), -1, "MiningYieldMaxTooltip".Translate());
                }
                else
                {
                    listing_Standard.Label("MiningYieldMax".Translate() + ": " + HarvestYieldSettings.miningYieldMax.ToStringPercent(), -1, "MiningYieldMaxTooltip".Translate());
                }
                listing_Standard.Gap(6f);
                HarvestYieldSettings.miningYieldMax = listing_Standard.Slider(GenMath.RoundTo(HarvestYieldSettings.miningYieldMax, 0.1f), 1f, 5.1f);
                listing_Standard.Gap(12f);

                if (HarvestYieldSettings.butcherFleshYieldMax > 5.0f)
                {
                    listing_Standard.Label("ButcherFleshYieldMax".Translate() + ": " + "Unlimited".Translate(), -1, "ButcherFleshYieldMaxTooltip".Translate());
                }
                else
                {
                    listing_Standard.Label("ButcherFleshYieldMax".Translate() + ": " + HarvestYieldSettings.butcherFleshYieldMax.ToStringPercent(), -1, "ButcherFleshYieldMaxTooltip".Translate());
                }
                listing_Standard.Gap(6f);
                HarvestYieldSettings.butcherFleshYieldMax = listing_Standard.Slider(GenMath.RoundTo(HarvestYieldSettings.butcherFleshYieldMax, 0.1f), 1f, 5.1f);
                listing_Standard.Gap(12f);

                if (HarvestYieldSettings.butcherMechYieldMax > 5.0f)
                {
                    listing_Standard.Label("ButcherMechYieldMax".Translate() + ": " + "Unlimited".Translate(), -1, "ButcherMechYieldMaxTooltip".Translate());
                }
                else
                {
                    listing_Standard.Label("ButcherMechYieldMax".Translate() + ": " + HarvestYieldSettings.butcherMechYieldMax.ToStringPercent(), -1, "ButcherMechYieldMaxTooltip".Translate());
                }
                listing_Standard.Gap(6f);
                HarvestYieldSettings.butcherMechYieldMax = listing_Standard.Slider(GenMath.RoundTo(HarvestYieldSettings.butcherMechYieldMax, 0.1f), 1f, 5.1f);
                listing_Standard.Gap(12f);

                listing_Standard.End();
                settings.Write();
            }
        }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            switch ((p.GetHashCode() ^ (GenLocalDate.DayOfYear(p) + GenLocalDate.Year(p) + (int)(GenMath.RoundTo(GenLocalDate.DayPercent(p), 0.25f) * 10) * 60) * 391) % 12)
            {
            case 0:
                return((p.story.traits.DegreeOfTrait(SyrTraitDefOf.Neurotic) == 2) ? ThoughtState.ActiveAtStage(0) : ThoughtState.Inactive);

            case 1:
                return(ThoughtState.ActiveAtStage(1));

            case 2:
                return(ThoughtState.ActiveAtStage(1));

            case 3:
                return(ThoughtState.ActiveAtStage(2));

            case 4:
                return(ThoughtState.ActiveAtStage(2));

            case 5:
                return(ThoughtState.Inactive);

            case 6:
                return(ThoughtState.Inactive);

            case 7:
                return(ThoughtState.ActiveAtStage(3));

            case 8:
                return(ThoughtState.ActiveAtStage(3));

            case 9:
                return(ThoughtState.ActiveAtStage(4));

            case 10:
                return(ThoughtState.ActiveAtStage(4));

            case 11:
                return((p.story.traits.DegreeOfTrait(SyrTraitDefOf.Neurotic) == 2) ? ThoughtState.ActiveAtStage(5) : ThoughtState.Inactive);

            default:
                throw new NotImplementedException();
            }
        }