Example #1
0
        private static void GenerateOneShootingLine(IntVec3 shootingPosition, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            // Spawn floor.
            for (int xOffset = -1; xOffset <= 1; xOffset++)
            {
                for (int zOffset = -1; zOffset <= 9; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 2).RotatedBy(rotation), TerrainDef.Named("MetalTile"));
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 3).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 4).RotatedBy(rotation), TerrainDef.Named("MetalTile"));
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 6).RotatedBy(rotation), TerrainDef.Named("MetalTile"));
            Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 7).RotatedBy(rotation), TerrainDef.Named("PavedTile"));

            // Spawn sandbags.
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(-1, 0, 0).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(-1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(1, 0, 0).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);

            // Spawn target.
            if (ModsConfig.IsActive("Miscellaneous_TrainingFacility"))
            {
                OG_Common.TrySpawnThingAt(ThingDef.Named("ShootingRangeTarget"), null, shootingPosition + new IntVec3(0, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            }
            else
            {
                OG_Common.TrySpawnWallAt(shootingPosition + new IntVec3(0, 0, 8).RotatedBy(rotation), ref outpostData);
            }
        }
Example #2
0
        public static void GenerateLaserFence(ZoneProperties[,] zoneMap, ref OG_OutpostData outpostData)
        {
            if (ModsConfig.IsActive("M&Co. LaserFence") == false)
            {
                Log.Warning("M&Co. OutpostGenerator: M&Co. LaserFence mod is not active. Cannot generate laser fences.");
                return;
            }

            int horizontalZonesNumber = 0;
            int verticalZonesNumber   = 0;

            if (outpostData.size == OG_OutpostSize.SmallOutpost)
            {
                horizontalZonesNumber = OG_SmallOutpost.horizontalZonesNumber;
                verticalZonesNumber   = OG_SmallOutpost.verticalZonesNumber;

                GenerateLaseFenceForSmallOutpost(zoneMap, horizontalZonesNumber, verticalZonesNumber, ref outpostData);
            }
            else
            {
                horizontalZonesNumber = OG_BigOutpost.horizontalZonesNumber;
                verticalZonesNumber   = OG_BigOutpost.verticalZonesNumber;
                GenerateLaseFenceForBigOutpost(zoneMap, horizontalZonesNumber, verticalZonesNumber, ref outpostData);
            }
        }
Example #3
0
 private static void BindDefsFor(Type type)
 {
     FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public);
     foreach (FieldInfo fieldInfo in fields)
     {
         Type fieldType = fieldInfo.FieldType;
         if (!typeof(Def).IsAssignableFrom(fieldType))
         {
             Log.Error(fieldType + " is not a Def.");
             continue;
         }
         MayRequireAttribute mayRequireAttribute = fieldInfo.TryGetAttribute <MayRequireAttribute>();
         bool              flag = (mayRequireAttribute == null || ModsConfig.IsActive(mayRequireAttribute.modId)) && !earlyTry;
         string            text = fieldInfo.Name;
         DefAliasAttribute defAliasAttribute = fieldInfo.TryGetAttribute <DefAliasAttribute>();
         if (defAliasAttribute != null)
         {
             text = defAliasAttribute.defName;
         }
         if (fieldType == typeof(SoundDef))
         {
             SoundDef soundDef = SoundDef.Named(text);
             if (soundDef.isUndefined && flag)
             {
                 Log.Error("Could not find SoundDef named " + text);
             }
             fieldInfo.SetValue(null, soundDef);
         }
         else
         {
             Def def = GenDefDatabase.GetDef(fieldType, text, flag);
             fieldInfo.SetValue(null, def);
         }
     }
 }
Example #4
0
        public static void InjectCustomUI()
        {
            Rect editButtonRect = new Rect(620f, 0.0f, 50f, 30f);

            if (ModsConfig.IsActive("hahkethomemah.simplepersonalities"))
            {
                editButtonRect.x -= 130;
            }

            if (Widgets.ButtonText(editButtonRect, "RandomPlus.FilterButton".Translate(), true, false, true))
            {
                var page = new Page_RandomEditor();
                Find.WindowStack.Add(page);
            }

            Rect rerollLabelRect = new Rect(620f, 40f, 200f, 30f);

            if (ModsConfig.IdeologyActive)
            {
                rerollLabelRect.y += 40;
            }

            string labelText = "RandomPlus.RerollLabel".Translate() + RandomSettings.RandomRerollCounter() + "/" + RandomSettings.PawnFilter.RerollLimit;

            var tmpSave = GUI.color;

            if (RandomSettings.RandomRerollCounter() >= RandomSettings.PawnFilter.RerollLimit)
            {
                GUI.color = Color.red;
            }
            Widgets.Label(rerollLabelRect, labelText);
            GUI.color = tmpSave;
        }
Example #5
0
        public static ModMetaData GetInstalledMod(string id)
        {
            if (ModsConfig.IsActive(id + ModMetaData.SteamModPostfix))
            {
                id += ModMetaData.SteamModPostfix;
            }

            return(ModLister.GetModWithIdentifier(id));
        }
Example #6
0
 public bool CanShowWithLoadedMods()
 {
     if (!showIfModsLoaded.NullOrEmpty())
     {
         for (int i = 0; i < showIfModsLoaded.Count; i++)
         {
             if (!ModsConfig.IsActive(showIfModsLoaded[i]))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Example #7
0
        public static void TryAddRecipeMakeMineralSonarModule()
        {
            if (ModsConfig.IsActive("M&Co. MMS"))
            {
                ThingDef electronicWorkbench = DefDatabase <ThingDef> .GetNamed("ElectronicWorkbench");

                if ((Find.ResearchManager.IsFinished(ResearchProjectDef.Named("ResearchMobileMineralSonar")) == true) &&
                    (electronicWorkbench.recipes.Contains(DefDatabase <RecipeDef> .GetNamed("MakeMineralSonarModule")) == false))
                {
                    electronicWorkbench.recipes.Add(DefDatabase <RecipeDef> .GetNamed("MakeMineralSonarModule"));
                    typeof(ThingDef).GetField("allRecipesCached", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(electronicWorkbench, null);
                }
            }
        }
        public override void PreOpen()
        {
            base.PreOpen();
            if (ModsConfig.IsActive("Lakuna.WellMet"))
            {
                MOD_WELL_MET = true;
            }

            panelSkills = new PanelSkills();
            panelTraits = new PanelTraits();
            panelOthers = new PanelOthers();

            RectButtonResetAll = new Rect(InitialSize.x - (ButtonWidth + 50), ButtonHeight - 8, ButtonWidth, ButtonHeight);
            RectButtonSaveLoad = new Rect(InitialSize.x - (ButtonWidth * 2 + 60), ButtonHeight - 8, ButtonWidth, ButtonHeight);
        }
Example #9
0
 public static void InitializeCloaks()
 {
     Constants.cloaks = new List <Texture>();
     Constants.cloaks.Clear();
     Constants.cloaksNorth = new List <Texture>();
     Constants.cloaksNorth.Clear();
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/opencloak_Female_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/opencloak_Hulk_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/opencloak_Male_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/opencloak_Thin_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/opencloak_Fat_north").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Female_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Female_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Fat_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Fat_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Hulk_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Hulk_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Thin_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Thin_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Male_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_Male_south").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Female_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Hulk_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Male_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Thin_north").mainTexture);
     Constants.cloaksNorth.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Fat_north").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Female_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Female_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Fat_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Fat_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Hulk_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Hulk_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Thin_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Thin_south").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Male_east").mainTexture);
     Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_Male_south").mainTexture);
     if (ModsConfig.IsActive("ssulunge.BBBodySupport"))
     {
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_FemaleBB_east").mainTexture);
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_FemaleBB_south").mainTexture);
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/demonlordcloakc_FemaleBB_north").mainTexture);
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_FemaleBB_east").mainTexture);
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_FemaleBB_south").mainTexture);
         Constants.cloaks.Add(MaterialPool.MatFrom("Equipment/opencloak_FemaleBB_south").mainTexture);
     }
     Constants.cloaks.AddRange(cloaksNorth);
 }
Example #10
0
        public AttritionSSPatch(ModContentPack content) : base(content)
        {
            // Early patch to avoid generic Def issues
            var harmony = new Harmony("AttritionSSPatch");

            if (ModsConfig.IsActive("petetimessix.simplesidearms"))
            {
                var findBestRangedWeapon = AccessTools.Method("SimpleSidearms.utilities.GettersFilters:findBestRangedWeapon");
                var getCarriedWeapons    = AccessTools.Method("SimpleSidearms.Extensions:getCarriedWeapons");
                if (findBestRangedWeapon != null && getCarriedWeapons != null)
                {
                    Harmony.ReversePatch(getCarriedWeapons, new HarmonyMethod(AccessTools.Method(typeof(Patch), "getCarriedRangedWeapon")),
                                         AccessTools.Method(typeof(Patch), "ReverseTranspiler"));
                    harmony.Patch(findBestRangedWeapon, transpiler: new HarmonyMethod(AccessTools.Method(typeof(Patch), "Transpiler")));
                }
            }
        }
Example #11
0
        public static void GenerateWaterPoolZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin     = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
            IntVec3 firstPatchCenter  = rotatedOrigin + new IntVec3(4, 0, 4).RotatedBy(rotation);
            IntVec3 secondPatchCenter = rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation);
            IntVec3 thirdPatchCenter  = rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation);

            // Generate water patches.
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 4.2f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Soil);
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 3.2f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Soil);
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 3.2f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterShallow"));
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 2f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterShallow"));
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 2f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep"));
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 1f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep"));
            }
            foreach (IntVec3 cell in GenRadial.RadialCellsAround(thirdPatchCenter, 1f, true))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep"));
            }

            // Spawn fishing pier.
            if (ModsConfig.IsActive("FishIndustry"))
            {
                OG_Common.TrySpawnThingAt(ThingDef.Named("FishingPier"), null, rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), true, rotation, ref outpostData);
            }
        }
Example #12
0
 public static RimWorld.Planet.Settlement AddNewHome(int tile, Faction faction, WorldObjectDef cityDef = null)
 {
     if (cityDef == null)
     {
         cityDef = WorldObjectDefOf.Settlement;
     }
     if (ModsConfig.IsActive("Cabbage.RimCities"))
     {
         if (cityDef.worldObjectClass.ToString() == "Cities.City")
         {
             return(GenerateCity(tile, faction, cityDef));
         }
         else
         {
             return(SettleUtility.AddNewHome(tile, faction));
         }
     }
     else
     {
         return(SettleUtility.AddNewHome(tile, faction));
     }
 }
 static SimpleSidearmsPatch()
 {
     SimpleSidearmsActive = ModsConfig.IsActive("PeteTimesSix.SimpleSidearms");
     if (SimpleSidearmsActive)
     {
         var type = AccessTools.TypeByName("PeteTimesSix.SimpleSidearms.Extensions");
         if (type != null)
         {
             var target = AccessTools.Method(type, "IsValidSidearmsCarrier");
             VFECore.VFECore.harmonyInstance.Patch(target, postfix: new HarmonyMethod(AccessTools.Method(typeof(SimpleSidearmsPatch), nameof(IsValidSidearmsCarrierPostfix))));
             type   = AccessTools.TypeByName("SimpleSidearms.rimworld.CompSidearmMemory");
             target = AccessTools.Method(type, "GetMemoryCompForPawn");
             VFECore.VFECore.harmonyInstance.Patch(target, prefix: new HarmonyMethod(AccessTools.Method(typeof(SimpleSidearmsPatch), nameof(GetMemoryCompForPawnPrefix))));
             type   = AccessTools.TypeByName("SimpleSidearms.rimworld.Gizmo_SidearmsList");
             target = AccessTools.Method(type, "DrawGizmoLabel");
             VFECore.VFECore.harmonyInstance.Patch(target, prefix: new HarmonyMethod(AccessTools.Method(typeof(SimpleSidearmsPatch), nameof(GizmoLabelFixer))));
         }
         else
         {
             Log.Error("[Vanilla Expanded Framework] Patching Simple Sidearms failed.");
         }
     }
 }
Example #14
0
        private void UpdateLord()
        {
            IntVec3 rallyPoint = IntVec3.Invalid;

            // Check there is no already existing defense lord.
            if (Find.LordManager.lords != null)
            {
                foreach (Lord lord in Find.LordManager.lords)
                {
                    if ((lord.faction != null) &&
                        (lord.faction == OG_Util.FactionOfMAndCo))
                    {
                        return;
                    }
                }
            }
            // Look for hostile in outpost perimeter.
            IntVec3 hostilePosition = FindHostileInPerimeter();

            if (hostilePosition.IsValid)
            {
                if ((OG_Util.FindOutpostArea() != null) &&
                    (OG_Util.FindOutpostArea().ActiveCells.Contains(hostilePosition)))
                {
                    // Ennemy is inside outpost area.
                    rallyPoint = hostilePosition;
                }
                else
                {
                    const int sectionsNumber = 100;
                    Vector3   sectionVector  = (this.outpostCenter - hostilePosition).ToVector3();
                    sectionVector = sectionVector / sectionsNumber;
                    // Default value if OutpostArea does not exist (should not occur, just a safety...).
                    rallyPoint = (hostilePosition.ToVector3() + sectionVector * 0.2f * (float)sectionsNumber).ToIntVec3();
                    for (int i = 1; i <= sectionsNumber; i++)
                    {
                        Vector3 potentialRallyPoint = hostilePosition.ToVector3() + sectionVector * i;
                        if ((OG_Util.FindOutpostArea() != null) &&
                            (OG_Util.FindOutpostArea().ActiveCells.Contains(potentialRallyPoint.ToIntVec3())))
                        {
                            // Ensure rallyPoint is completely inside the outpost area.
                            rallyPoint = (potentialRallyPoint + sectionVector * 0.1f * (float)sectionsNumber).ToIntVec3();
                            break;
                        }
                    }
                }
            }
            else
            {
                // Look for damaged turret to defend.
                Rot4    turretRotation = Rot4.Invalid;
                IntVec3 turretPosition = IntVec3.Invalid;
                FindDamagedTurret(out turretPosition, out turretRotation);
                if (turretPosition.IsValid)
                {
                    if (ModsConfig.IsActive("M&Co. ForceField"))
                    {
                        // Look for nearest force field to cover behind.
                        foreach (Thing thing in Find.ListerThings.ThingsOfDef(ThingDef.Named("ForceFieldGenerator")))
                        {
                            if (thing.Position.InHorDistOf(turretPosition, 23f))
                            {
                                rallyPoint = thing.Position + new IntVec3(0, 0, -2).RotatedBy(thing.Rotation);
                                break;
                            }
                        }
                    }
                    else
                    {
                        // Just go near the attacked turret.
                        rallyPoint = turretPosition + new IntVec3(0, 0, -5).RotatedBy(turretRotation);
                    }
                }
            }

            if (rallyPoint.IsValid)
            {
                // Generate defense lord.
                // TODO: add a siren like in alert speaker!
                LordJob_Joinable_DefendOutpost lordJob = new LordJob_Joinable_DefendOutpost(rallyPoint);
                LordMaker.MakeNewLord(OG_Util.FactionOfMAndCo, lordJob);
                SoundDef soundDef = SoundDefOf.MessageSeriousAlert;
                soundDef.PlayOneShot(rallyPoint);
                // Stop all pawns job.
                foreach (Pawn pawn in Find.MapPawns.AllPawns)
                {
                    if ((pawn.Faction != null) &&
                        (pawn.Faction == OG_Util.FactionOfMAndCo) &&
                        (pawn.kindDef != OG_Util.OutpostTechnicianDef))
                    {
                        pawn.ClearMind();
                    }
                }
            }
        }
Example #15
0
 public static bool IsActive(string modID)
 {
     return(ModsConfig.IsActive(modID) || ModsConfig.IsActive(modID + ModMetaData.SteamModPostfix) || ModsConfig.IsActive(modID + "_copy"));
 }
Example #16
0
 public static bool Prepare()
 => ModsConfig.IsActive("notooshabby.awesomeinventory") || ModsConfig.IsActive("notooshabby.awesomeinventory_local") || ModsConfig.IsActive("notooshabby.awesomeinventory_steam") || ModsConfig.IsActive("notooshabby.awesomeinventory_copy");
Example #17
0
        public static void ApplyBiomeSettings()
        {
            Log.Message("[Map Designer] Applying settings");
            MapDesignerSettings settings = MapDesignerMod.mod.settings;

            // densities
            Dictionary <string, BiomeDefault> biomeDefaults = settings.biomeDefaults;

            float densityPlant  = settings.densityPlant;
            float densityAnimal = settings.densityAnimal;

            foreach (BiomeDef biome in DefDatabase <BiomeDef> .AllDefs)
            {
                try
                {
                    biome.animalDensity = biomeDefaults[biome.defName].animalDensity * densityAnimal;
                    biome.plantDensity  = biomeDefaults[biome.defName].plantDensity * densityPlant;

                    if (biome.plantDensity > 1f)
                    {
                        biome.wildPlantRegrowDays = biomeDefaults[biome.defName].wildPlantRegrowDays / biome.plantDensity;
                        biome.plantDensity        = 1f;
                    }
                }
                catch
                {
                    Log.Message("[Map Designer] ERROR applying plant and animal settings to " + biome.defName);
                }
            }

            Dictionary <string, FloatRange> densityDefaults = settings.densityDefaults;

            // ruins
            try
            {
                float densityRuins = settings.densityRuins;
                if (densityRuins > 1)
                {
                    densityRuins = (float)Math.Pow(densityRuins, 3);
                }
                (DefDatabase <GenStepDef> .GetNamed("ScatterRuinsSimple").genStep as GenStep_Scatterer).countPer10kCellsRange.min = densityDefaults["ScatterRuinsSimple"].min * densityRuins;
                (DefDatabase <GenStepDef> .GetNamed("ScatterRuinsSimple").genStep as GenStep_Scatterer).countPer10kCellsRange.max = densityDefaults["ScatterRuinsSimple"].max * densityRuins;
            }
            catch
            {
                Log.Message("[Map Designer] ERROR with settings: ruins");
            }

            // ancient dangers
            try
            {
                float densityDanger = settings.densityDanger;
                if (densityDanger > 1)
                {
                    densityDanger = (float)Math.Pow(densityDanger, 4);
                }
                (DefDatabase <GenStepDef> .GetNamed("ScatterShrines").genStep as GenStep_Scatterer).countPer10kCellsRange.min = densityDefaults["ScatterShrines"].min * densityDanger;
                (DefDatabase <GenStepDef> .GetNamed("ScatterShrines").genStep as GenStep_Scatterer).countPer10kCellsRange.max = densityDefaults["ScatterShrines"].max * densityDanger;
            }
            catch
            {
                Log.Message("[Map Designer] ERROR with settings: ancient dangers");
            }

            // geysers
            try
            {
                float densityGeyser = settings.densityGeyser;
                if (densityGeyser > 1)
                {
                    densityGeyser = (float)Math.Pow(densityGeyser, 2);
                }
                (DefDatabase <GenStepDef> .GetNamed("SteamGeysers").genStep as GenStep_Scatterer).countPer10kCellsRange.min = densityDefaults["SteamGeysers"].min * densityGeyser;
                (DefDatabase <GenStepDef> .GetNamed("SteamGeysers").genStep as GenStep_Scatterer).countPer10kCellsRange.max = densityDefaults["SteamGeysers"].max * densityGeyser;
            }
            catch
            {
                Log.Message("[Map Designer] ERROR with settings: geysers");
            }

            // rivers
            float widthOnMap = 6f;

            foreach (RiverDef river in DefDatabase <RiverDef> .AllDefs)
            {
                try
                {
                    river.widthOnMap *= settings.sizeRiver;
                    river.widthOnMap  = Math.Min(175, river.widthOnMap);
                }
                catch
                {
                    Log.Message("[Map Designer] ERROR with settings: river width : " + river.defName);
                }
            }

            // terrain
            if (Math.Abs(settings.terrainFert - 1f) > 0.05 || Math.Abs(settings.terrainWater - 1f) > 0.05)
            {
                Log.Message(String.Format("[Map Designer] Terrain settings: fertility: {0} | Water {1}", Math.Round(100 * settings.terrainFert), Math.Round(100 * settings.terrainWater)));
                foreach (BiomeDef biome in DefDatabase <BiomeDef> .AllDefs)
                {
                    if (!biome.terrainsByFertility.NullOrEmpty())
                    {
                        //Log.Message("Doing adjustments for " + biome.defName);
                        try
                        {
                            TerrainDefault newTerrain;
                            float          minFertBound = -0.2f;
                            float          maxFertBound = 1.2f;

                            if (ModsConfig.IsActive("BiomesTeam.BiomesCore"))
                            {
                                maxFertBound = HelperMethods.GetMaxFertByBiome(biome);
                            }
                            newTerrain = TerrainUtility.StretchTerrainFertility(biomeDefaults[biome.defName].terrain, minFertBound, maxFertBound);


                            biome.terrainsByFertility = newTerrain.terrainsByFertility;
                            biome.terrainPatchMakers  = newTerrain.terrainPatchMakers;
                        }

                        catch (Exception e)
                        {
                            Log.Message("[Map Designer] ERROR with settings: terrain : " + biome.defName);
                            Log.Message(e.Message);

                            TerrainDefault dictEntry = settings.biomeDefaults[biome.defName].terrain;
                            Log.Message("--terrainsByFertility");
                            foreach (TerrainThreshold t in dictEntry.terrainsByFertility)
                            {
                                Log.Message(String.Format("- {0} .... {1} | {2}", t.terrain.defName, Math.Round(t.min, 2), Math.Round(t.max, 2)));
                            }
                            Log.Message("--terrainPatchMakers");
                            for (int i = 0; i < dictEntry.terrainPatchMakers.Count(); i++)
                            {
                                TerrainPatchMaker p = dictEntry.terrainPatchMakers[i];
                                Log.Message(String.Format("Patchmaker #{0} | min {1} | max {2}", i, p.minFertility, p.maxFertility));
                                foreach (TerrainThreshold t in p.thresholds)
                                {
                                    Log.Message(String.Format("--- {0} | {1} | {2}", t.terrain.defName, Math.Round(t.min, 2), Math.Round(t.max, 2)));
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                Log.Message("[Map Designer] Terrain settings: Default");
                foreach (BiomeDef biome in DefDatabase <BiomeDef> .AllDefs)
                {
                    biome.terrainsByFertility = biomeDefaults[biome.defName].terrain.terrainsByFertility;
                    biome.terrainPatchMakers  = biomeDefaults[biome.defName].terrain.terrainPatchMakers;
                }
            }
        }
        public static Building_OutpostCommandConsole GenerateBigRoomCommandRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            Building_OutpostCommandConsole commandConsole = null;

            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetDark"), ref outpostData);

            // Spawn doors.
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData);

            // Spawn weapon racks.
            Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;

            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;
            rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
            OG_Common.TrySpawnWeaponOnRack(rack);
            rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
            rack.GetStoreSettings().Priority = StoragePriority.Critical;

            // Spawn lamps.
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 9).RotatedBy(rotation), Color.white, ref outpostData);

            // Spawn table and stools.
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);

            // Spawn outpost command console, battery and spare parts cabinet.
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.SparePartsCabinetDef, null, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnResourceAt(ThingDefOf.Components, 10, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true);
            OG_Common.SpawnResourceAt(ThingDefOf.Components, 10, rotatedOrigin + new IntVec3(1, 0, 6).RotatedBy(rotation), true);
            commandConsole = OG_Common.TrySpawnThingAt(OG_Util.OutpostCommandConsoleDef, null, rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_OutpostCommandConsole;

            // Spawn workbenches.
            OG_Common.TrySpawnThingAt(ThingDef.Named("TableMachining"), null, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDef.Named("ElectricSmithy"), null, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);

            // Spawn heaters and coolers.
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 0).RotatedBy(rotation), new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);

            // Spawn floor and tactical computer.
            for (int xOffset = 0; xOffset <= 10; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }
            for (int zOffset = 0; zOffset <= 10; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }
            CellRect rect = new CellRect(origin.x + 3, origin.z + 3, 5, 5);

            foreach (IntVec3 cell in rect)
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("PavedTile"));
            }
            foreach (IntVec3 cell in rect.ContractedBy(1))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("CarpetRed"));
            }
            if (ModsConfig.IsActive("Miscellaneous_Incidents"))
            {
                OG_Common.TrySpawnThingAt(ThingDef.Named("TacticalComputer"), null, rotatedOrigin + new IntVec3(5, 0, 5).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            }

            return(commandConsole);
        }
        public override void DefsLoaded()
        {
            foreach (ThingDef tDef in DefDatabase <ThingDef> .AllDefs.Where(t => t.race?.Humanlike == true))
            {
                if (tDef.comps == null)
                {
                    tDef.comps = new List <CompProperties>();
                }
                tDef.comps.Add(new CompProperties(typeof(Pawn_ToolTracker)));
                Dictionaries.PawnCanUseTools.Add(tDef);
            }
            var harmony = new HarmonyLib.Harmony("ToolsFramework");

            if (ModsConfig.IsActive("roolo.dualwield") || ModsConfig.IsActive("roolo.dualwield_local") || ModsConfig.IsActive("roolo.dualwield_steam") || ModsConfig.IsActive("roolo.dualwield_copy"))
            {
                var myAddOffHand    = AccessTools.Method(typeof(Patch_DualWield_Ext_Pawn_EquipmentTracker), nameof(Patch_DualWield_Ext_Pawn_EquipmentTracker.AddOffHandEquipment));
                var myTryGetOffHand = AccessTools.Method(typeof(Patch_DualWield_Ext_Pawn_EquipmentTracker), nameof(Patch_DualWield_Ext_Pawn_EquipmentTracker.TryGetOffHandEquipment));
                var AddOffHand      = AccessTools.Method("DualWield.Ext_Pawn_EquipmentTracker:AddOffHandEquipment");
                var TryGetOffHand   = AccessTools.Method("DualWield.Ext_Pawn_EquipmentTracker:TryGetOffHandEquipment");
                HarmonyLib.Harmony.ReversePatch(TryGetOffHand, new HarmonyMethod(myTryGetOffHand), null);
                HarmonyLib.Harmony.ReversePatch(AddOffHand, new HarmonyMethod(myAddOffHand), null);
            }
            if (ModsConfig.IsActive("petetimessix.simplesidearms") || ModsConfig.IsActive("petetimessix.simplesidearms_local") || ModsConfig.IsActive("petetimessix.simplesidearms_steam") || ModsConfig.IsActive("petetimessix.simplesidearms_copy"))
            {
                harmony.Unpatch(AccessTools.Constructor(typeof(Toil)), HarmonyPatchType.Postfix, "PeteTimesSix.SimpleSidearms");
            }
            BaseMod.thisMod.GetSettings <Settings>();
            Dictionaries.StatPartSettings.SetOrAdd(StatDefOf.ToolReadinessDelay, ToolsFramework.Settings.equipDelayFactor);
            Dictionaries.StatPartSettings.SetOrAdd(StatDefOf.ToolWearFactor, ToolsFramework.Settings.degradationFactor);
            ToolsFramework.Settings.AllITool = false;
            var unoptToolDef = DefDatabase <ThingDef> .AllDefs.Where(t => t.IsTool() && !typeof(ITool).IsAssignableFrom(t.thingClass));

            if (unoptToolDef.Any())
            {
                ToolsFramework.Settings.AllITool = false;
                Log.Warning("TF_BaseMessage" + "TF_Warning_Unoptimized".Translate(unoptToolDef.ToStringSafeEnumerable()));
            }
            else
            {
                ToolsFramework.Settings.AllITool = true;
            }
            var stats = new List <StatDef>();

            foreach (var tdef in DefDatabase <ThingDef> .AllDefs.Where(t => t.HasComp(typeof(ToolComp))))
            {
                var compProp = tdef.ToolCompProp();
                compProp.statsAffected = compProp.ToolTypes.SelectMany(t => t.workStatFactors.Select(tt => tt.stat)).ToList();
                compProp.statsAffected.AddRange(compProp.ToolTypes.SelectMany(t => t.workStatOffset.Select(tt => tt.stat)));
                compProp.statsAffected.RemoveDuplicates();
                stats.AddRange(compProp.statsAffected);
            }
            stats.RemoveDuplicates();
            foreach (var stat in stats)
            {
                if (stat.parts == null)
                {
                    stat.parts = new List <StatPart>();
                }
                var statPart = new StatPart_Tool()
                {
                    parentStat = stat
                };
                foreach (var toolType in DefDatabase <ToolType> .AllDefs.Where(t => t.workStatFactors.Any(tt => tt.stat == stat) || t.workStatOffset.Any(tt => tt.stat == stat)))
                {
                    statPart.ToolTypes.Add(toolType);
                }
                stat.parts.Add(statPart);
            }
        }
        public void DoWindowContents(Rect wrect)
        {
            float days;
            float hours;
            // wrect.yMin += 15f;
            // wrect.yMax -= 15f;

            var options = new Listing_Standard();
            //
            var outRect    = new Rect(wrect.x, wrect.y, wrect.width, wrect.height);         // Size of viewed area
            var scrollRect = new Rect(0f, 0f, wrect.width - 16f, wrect.height * 1.5f);      // Size of content data

            Widgets.BeginScrollView(outRect, ref scrollPosition, scrollRect, true);

            options.Begin(scrollRect);

            Header(options, "Performance_Settings".Translate(), false);

            if (degradation)
            {
                options.CheckboxLabeled("TF_alertToolNeedsReplacing".Translate(), ref alertToolNeedsReplacing, "TF_alertToolNeedsReplacing_tooltip".Translate());
                if (alertToolNeedsReplacing)
                {
                    options.Gap();
                    days  = Mathf.FloorToInt((float)alertToolNeedsReplacing_Delay / GenDate.TicksPerDay);
                    hours = ((float)alertToolNeedsReplacing_Delay - days * GenDate.TicksPerDay) / GenDate.TicksPerHour;
                    options.Label("TF_alertToolNeedsReplacing_Delay".Translate() + $"\t{days} " + "DaysLower".Translate() +
                                  $"  {hours.ToString("F02")} " + "HoursLower".Translate(),
                                  tooltip: "TF_alertToolNeedsReplacing_Delay_tooltip".Translate());
                    alertToolNeedsReplacing_Delay = Mathf.RoundToInt(options.Slider(alertToolNeedsReplacing_Delay, 1, GenDate.TicksPerDay));
                    options.Gap();
                    days  = Mathf.FloorToInt(alertToolNeedsReplacing_Treshold);
                    hours = alertToolNeedsReplacing_Treshold % 1f * 24f;
                    options.Label("TF_alertToolNeedsReplacing_Treshold".Translate() + $"\t{days} " + "DaysLower".Translate() +
                                  $"  {hours.ToString("F02")} " + "HoursLower".Translate(),
                                  tooltip: "TF_alertToolNeedsReplacing_Treshold_tooltip".Translate());
                    alertToolNeedsReplacing_Treshold = options.Slider(alertToolNeedsReplacing_Treshold, 0.01f, 10f);
                }
            }
            if (optimization)
            {
                options.Gap();
                days  = Mathf.FloorToInt((float)optimizationDelay / GenDate.TicksPerDay);
                hours = ((float)optimizationDelay - days * GenDate.TicksPerDay) / GenDate.TicksPerHour;
                options.Label("TF_optimizationDelay".Translate() + $"\t{days} " + "DaysLower".Translate() +
                              $"  {hours.ToString("F02")} " + "HoursLower".Translate(),
                              tooltip: "TF_optimizationDelay_tooltip".Translate());
                optimizationDelay = Mathf.RoundToInt(options.Slider(optimizationDelay, GenDate.TicksPerHour, GenDate.TicksPerYear));
                options.Gap();
                days  = Mathf.FloorToInt((float)mapTrackerDelay_StoredTools / GenDate.TicksPerDay);
                hours = ((float)mapTrackerDelay_StoredTools - days * GenDate.TicksPerDay) / GenDate.TicksPerHour;
                options.Label("TF_mapTrackerDelay_Stored".Translate() + $"\t{days} " + "DaysLower".Translate() +
                              $"  {hours.ToString("F02")} " + "HoursLower".Translate(),
                              tooltip: "TF_mapTrackerDelay_Stored_tooltip".Translate());
                mapTrackerDelay_StoredTools = Mathf.RoundToInt(options.Slider(mapTrackerDelay_StoredTools, GenDate.TicksPerHour, GenDate.TicksPerYear));
                days  = Mathf.FloorToInt((float)mapTrackerDelay_UseableTools / GenDate.TicksPerDay);
                hours = ((float)mapTrackerDelay_UseableTools - days * GenDate.TicksPerDay) / GenDate.TicksPerHour;
                options.Label("TF_mapTrackerDelay_Useable".Translate() + $"\t{days} " + "DaysLower".Translate() +
                              $"  {hours.ToString("F02")} " + "HoursLower".Translate(),
                              tooltip: "TF_mapTrackerDelay_Useable_tooltip".Translate());
                mapTrackerDelay_UseableTools = Mathf.RoundToInt(options.Slider(mapTrackerDelay_UseableTools, GenDate.TicksPerHour, GenDate.TicksPerYear));
                if (mapTrackerDelay_UseableTools > mapTrackerDelay_StoredTools)
                {
                    mapTrackerDelay_UseableTools = mapTrackerDelay_StoredTools;
                }
            }
            if (opportunisticTakeTool)
            {
                options.Gap();
                if (ModsConfig.IsActive("fluffy.colonymanager"))
                {
                    options.CheckboxLabeled("TF_opportunisticTakeTool_calcPath".Translate(), ref opportunisticTakeTool_calcPath, "TF_opportunisticTakeTool_calcPath_tooltip".Translate());
                }
                else
                {
                    options.CheckboxLabeled("TF_opportunisticTakeTool_calcPath".Translate(), ref opportunisticTakeTool_calcPath, "TF_opportunisticTakeTool_calcPath_tooltip".Translate());
                }
            }
            if (!degradation && !optimization && !opportunisticTakeTool)
            {
                GUI.color = Color.gray;
                options.Label("NoPerformanceTweaks".Translate());
                GUI.color = Color.white;
            }

            Header(options, "Gameplay_Settings".Translate(), false);

            options.CheckboxLabeled("TF_degredation".Translate(), ref degradation, "TF_degredation_tooltip".Translate());
            if (degradation)
            {
                options.Gap();
                options.Label("TF_degredationFactor".Translate() + $"\tx{degradationFactor.ToString("F02")}", tooltip: "TF_degredationFactor_tooltip".Translate());
                degradationFactor = options.Slider(degradationFactor, 0.01f, 10f);
                options.Gap();
            }
            options.Gap();
            var equipString = equipTool ? "TF_equipTool_equip".Translate() : "TF_usefrominv".Translate();

            options.CheckboxLabeled("TF_equipTool".Translate() + $": {equipString}", ref equipTool, "TF_equipTool_tooltip".Translate());
            if (equipTool)
            {
                options.Gap();
                options.CheckboxLabeled("TF_draw".Translate(), ref draw, "TF_draw_tooltip".Translate());
            }
            options.Gap();
            options.CheckboxLabeled("TF_equipDelay".Translate(), ref equipDelay, "TF_equipDelay_tooltip".Translate());
            if (equipDelay)
            {
                options.Gap();
                options.Label("TF_equipDelayFactor".Translate() + $"\tx{equipDelayFactor.ToString("F02")}", tooltip: "TF_equipDelayFactor_tooltip".Translate());
                equipDelayFactor = options.Slider(equipDelayFactor, 0.01f, 10);
            }
            options.Gap();
            options.CheckboxLabeled("TF_optimization".Translate(), ref optimization, "TF_optimization_tooltip".Translate());
            options.Gap();
            options.CheckboxLabeled("TF_opportunisticToolJobs".Translate(), ref opportunisticToolJobs, "TF_opportunisticToolJobs_tooltip".Translate());
            if (opportunisticToolJobs)
            {
                options.Gap();
                options.CheckboxLabeled("TF_opportunisticReturnTool".Translate(), ref opportunisticReturnTool, "TF_opportunisticReturnTool_tooltip".Translate());
                options.Gap();
                options.CheckboxLabeled("TF_opportunisticTakeTool".Translate(), ref opportunisticTakeTool, "TF_opportunisticTakeTool_tooltip".Translate());
            }
            options.End();
            Widgets.EndScrollView();
            // Mod.GetSettings<Settings>().Write();
        }
Example #21
0
        public static void GenerateEntranchedZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
            IntVec3 cell          = rotatedOrigin;

            // Generate south west battery shelter.
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            for (int xOffset = 0; xOffset < 4; xOffset++)
            {
                for (int zOffset = 0; zOffset < 4; zOffset++)
                {
                    cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
                    Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef);
                }
            }

            // Generate south east battery shelter.
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            for (int xOffset = 7; xOffset < 11; xOffset++)
            {
                for (int zOffset = 0; zOffset < 4; zOffset++)
                {
                    cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
                    Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef);
                }
            }

            // Generate central paved alley.
            for (int xOffset = 4; xOffset <= 6; xOffset++)
            {
                for (int zOffset = 0; zOffset < 7; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int zOffset = 0; zOffset < 7; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }

            // Generate north west force field.
            IntVec3 northWestOrigin = rotatedOrigin + new IntVec3(0, 0, 6).RotatedBy(rotation);

            for (int xOffset = 0; xOffset < 5; xOffset++)
            {
                for (int zOffset = 0; zOffset < 2; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int xOffset = 1; xOffset <= 3; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete);
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            for (int zOffset = -3; zOffset <= 3; zOffset++)
            {
                if ((zOffset == 1) &&
                    ModsConfig.IsActive("M&Co. ForceField"))
                {
                    // Do not spawn power conduit under force field as it generates a warning message.
                    continue;
                }
                OG_Common.SpawnFireproofPowerConduitAt(northWestOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData);
            }
            if (ModsConfig.IsActive("M&Co. ForceField"))
            {
                OG_Common.TrySpawnThingAt(ThingDef.Named("ForceFieldGenerator"), null, northWestOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            }

            // Generate central sandbag.
            cell = rotatedOrigin + new IntVec3(5, 0, 7).RotatedBy(rotation);
            Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);

            // Generate north east force field.
            IntVec3 northEastOrigin = rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation);

            for (int xOffset = 0; xOffset < 5; xOffset++)
            {
                for (int zOffset = 0; zOffset < 2; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int xOffset = 1; xOffset <= 3; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete);
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            for (int zOffset = -3; zOffset <= 3; zOffset++)
            {
                if ((zOffset == 1) &&
                    ModsConfig.IsActive("M&Co. ForceField"))
                {
                    // Do not spawn power conduit under force field as it generates a warning message.
                    continue;
                }
                OG_Common.SpawnFireproofPowerConduitAt(northEastOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData);
            }
            if (ModsConfig.IsActive("M&Co. ForceField"))
            {
                OG_Common.TrySpawnThingAt(ThingDef.Named("ForceFieldGenerator"), null, northEastOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            }
        }
 public static bool Prepare()
 => !ModsConfig.IsActive("fluffy.worktab") && !ModsConfig.IsActive("fluffy.worktab_local") && !ModsConfig.IsActive("fluffy.worktab_steam") && !ModsConfig.IsActive("fluffy.worktab_copy");
Example #23
0
 private static void GeneratePawnApparelAndWeapon(ref Pawn pawn, PawnKindDef kindDef)
 {
     if (kindDef == OG_Util.OutpostOfficerDef)
     {
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Hyperweave"), pantColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CollarShirt"), ThingDef.Named("Hyperweave"), shirtColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_VestPlate"), null, Color.black, false);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Duster"), ThingDef.Named("Hyperweave"), armorColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CowboyHat"), ThingDef.Named("Hyperweave"), helmetColor);
         GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_SniperRifle"));
     }
     else if ((kindDef == OG_Util.OutpostHeavyGuardDef) ||
              (kindDef == OG_Util.OutpostGuardDef))
     {
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), pantColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_BasicShirt"), ThingDef.Named("Synthread"), shirtColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_PowerArmor"), null, armorColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_PowerArmorHelmet"), null, helmetColor);
         if (kindDef == OG_Util.OutpostHeavyGuardDef)
         {
             GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_Minigun"));
         }
         else
         {
             GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_ChargeRifle"));
         }
     }
     else if (kindDef == OG_Util.OutpostScoutDef)
     {
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), pantColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_BasicShirt"), ThingDef.Named("Synthread"), shirtColor);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_VestPlate"), null, Color.black, false);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_KevlarHelmet"), null, helmetColor);
         if (needParka)
         {
             GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Parka"), ThingDef.Named("Synthread"), armorColor);
         }
         GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_AssaultRifle"));
     }
     else if (kindDef == OG_Util.OutpostTechnicianDef)
     {
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), colorCivilGrey);
         GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CollarShirt"), ThingDef.Named("Synthread"), colorCivilGrey);
         if (ModsConfig.IsActive("M&Co. MiningHelmet"))
         {
             GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("MiningHelmet"), null, Color.black, false);
         }
         else
         {
             if (Find.MapWorldSquare.temperature < 20f)
             {
                 // Only give a tuque if temperature is low enough.
                 GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Tuque"), ThingDef.Named("Synthread"), colorCivilGrey);
             }
         }
         if (needParka)
         {
             GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Parka"), ThingDef.Named("Synthread"), armorColor);
         }
         GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_Pistol"));
     }
 }