Ejemplo n.º 1
0
        static void Prefix(MapParent parent, MapGeneratorDef mapGenerator, IEnumerable <GenStepWithParams> extraGenStepDefs)
        {
            Patch_GenStep_Terrain.ClearMiddleAreaCells();
            foreach (var q in Current.Game.questManager.QuestsListForReading)
            {
                if (q.State == QuestState.Ongoing)
                {
                    foreach (var qt in q.QuestLookTargets)
                    {
                        if (qt.Tile == parent.Tile)
                        {
                            IsQuestMap = true;
                            return;
                        }
                    }
                }
            }

            foreach (var d in mapGenerator.genSteps)
            {
                if (d.genStep.def.defName.Contains("Archonexus"))
                {
                    IsQuestMap = true;
                    return;
                }
            }

            if (extraGenStepDefs != null)
            {
                foreach (var d in extraGenStepDefs)
                {
                    if (d.def.defName.Contains("Archonexus"))
                    {
                        IsQuestMap = true;
                        return;
                    }
                }
            }
            IsQuestMap = false;
            return;
        }
Ejemplo n.º 2
0
        static void Postfix(ref Map __result, MapGeneratorDef mapGenerator)
        {
            if (__result.TileInfo.hilliness == Hilliness.Impassable && Settings.OuterShape == ImpassableShape.Fill)
            {
                int maxX = __result.Size.x - 1;
                int maxZ = __result.Size.z - 1;
                foreach (IntVec3 current in __result.AllCells)
                {
                    if (Settings.CoverRoadAndRiver && __result.roofGrid.RoofAt(current) == null)
                    {
                        if (Patch_GenStep_Terrain.IsWithinCornerOfMap(current, maxX + 1, maxZ + 1))
                        {
                            __result.roofGrid.SetRoof(current, null);
                            continue;
                        }
                        else if (Patch_GenStep_Terrain.IsInMiddleArea(current))
                        {
                            __result.roofGrid.SetRoof(current, null);
                            continue;
                        }
                        __result.roofGrid.SetRoof(current, RoofDefOf.RoofRockThick);
                    }

                    if (Settings.RoofEdgeDepth > 0)
                    {
                        if (current.x == 0 ||
                            current.x == maxX ||
                            current.z == 0 ||
                            current.z == maxZ)
                        {
                            __result.roofGrid.SetRoof(current, null);
                        }
                    }
                    if (Settings.HasMiddleArea == false)
                    {
                        for (var x = Math.Max(0, MapGenerator.PlayerStartSpot.x - 5); x < Math.Min(__result.Size.x, MapGenerator.PlayerStartSpot.x + 5); ++x)
                        {
                            for (var z = Math.Max(0, MapGenerator.PlayerStartSpot.z - 5); z < Math.Min(__result.Size.z, MapGenerator.PlayerStartSpot.z + 5); ++z)
                            {
                                var i = new IntVec3(x, 0, z);
                                foreach (var t in __result.thingGrid.ThingsAt(i))
                                {
                                    if (t.def.passability == Traversability.Impassable)
                                    {
                                        t.Destroy();
                                    }
                                }
                                __result.roofGrid.SetRoof(i, null);
                            }
                        }
                    }
                    else
                    {
                        __result.roofGrid.SetRoof(MapGenerator.PlayerStartSpot, null);
                    }
                }

                /*
                 * var map = __result;
                 * Patch_GenStep_Terrain.ClearMiddleAreaCells();
                 * Task.Delay(new TimeSpan(0, 0, 3)).ContinueWith(t => {
                 *  try
                 *  {
                 *      FloodFillerFog.DebugRefogMap(map);
                 *  }
                 *  catch { }
                 * });*/
            }
        }