Ejemplo n.º 1
0
 public void ConstructComponents()
 {
     this.spawnedThings      = new ThingOwner <Thing>(this);
     this.cellIndices        = new CellIndices(this);
     this.listerThings       = new ListerThings(ListerThingsUse.Global);
     this.listerBuildings    = new ListerBuildings();
     this.mapPawns           = new MapPawns(this);
     this.dynamicDrawManager = new DynamicDrawManager(this);
     this.mapDrawer          = new MapDrawer(this);
     this.tooltipGiverList   = new TooltipGiverList();
     this.pawnDestinationReservationManager = new PawnDestinationReservationManager();
     this.reservationManager = new ReservationManager(this);
     this.physicalInteractionReservationManager = new PhysicalInteractionReservationManager();
     this.designationManager             = new DesignationManager(this);
     this.lordManager                    = new LordManager(this);
     this.debugDrawer                    = new DebugCellDrawer();
     this.passingShipManager             = new PassingShipManager(this);
     this.haulDestinationManager         = new HaulDestinationManager(this);
     this.gameConditionManager           = new GameConditionManager(this);
     this.weatherManager                 = new WeatherManager(this);
     this.zoneManager                    = new ZoneManager(this);
     this.resourceCounter                = new ResourceCounter(this);
     this.mapTemperature                 = new MapTemperature(this);
     this.temperatureCache               = new TemperatureCache(this);
     this.areaManager                    = new AreaManager(this);
     this.attackTargetsCache             = new AttackTargetsCache(this);
     this.attackTargetReservationManager = new AttackTargetReservationManager(this);
     this.lordsStarter                   = new VoluntarilyJoinableLordsStarter(this);
     this.thingGrid                  = new ThingGrid(this);
     this.coverGrid                  = new CoverGrid(this);
     this.edificeGrid                = new EdificeGrid(this);
     this.blueprintGrid              = new BlueprintGrid(this);
     this.fogGrid                    = new FogGrid(this);
     this.glowGrid                   = new GlowGrid(this);
     this.regionGrid                 = new RegionGrid(this);
     this.terrainGrid                = new TerrainGrid(this);
     this.pathGrid                   = new PathGrid(this);
     this.roofGrid                   = new RoofGrid(this);
     this.fertilityGrid              = new FertilityGrid(this);
     this.snowGrid                   = new SnowGrid(this);
     this.deepResourceGrid           = new DeepResourceGrid(this);
     this.exitMapGrid                = new ExitMapGrid(this);
     this.linkGrid                   = new LinkGrid(this);
     this.glowFlooder                = new GlowFlooder(this);
     this.powerNetManager            = new PowerNetManager(this);
     this.powerNetGrid               = new PowerNetGrid(this);
     this.regionMaker                = new RegionMaker(this);
     this.pathFinder                 = new PathFinder(this);
     this.pawnPathPool               = new PawnPathPool(this);
     this.regionAndRoomUpdater       = new RegionAndRoomUpdater(this);
     this.regionLinkDatabase         = new RegionLinkDatabase();
     this.moteCounter                = new MoteCounter();
     this.gatherSpotLister           = new GatherSpotLister();
     this.windManager                = new WindManager(this);
     this.listerBuildingsRepairable  = new ListerBuildingsRepairable();
     this.listerHaulables            = new ListerHaulables(this);
     this.listerMergeables           = new ListerMergeables(this);
     this.listerFilthInHomeArea      = new ListerFilthInHomeArea(this);
     this.reachability               = new Reachability(this);
     this.itemAvailability           = new ItemAvailability(this);
     this.autoBuildRoofAreaSetter    = new AutoBuildRoofAreaSetter(this);
     this.roofCollapseBufferResolver = new RoofCollapseBufferResolver(this);
     this.roofCollapseBuffer         = new RoofCollapseBuffer();
     this.wildAnimalSpawner          = new WildAnimalSpawner(this);
     this.wildPlantSpawner           = new WildPlantSpawner(this);
     this.steadyEnvironmentEffects   = new SteadyEnvironmentEffects(this);
     this.skyManager                 = new SkyManager(this);
     this.overlayDrawer              = new OverlayDrawer();
     this.floodFiller                = new FloodFiller(this);
     this.weatherDecider             = new WeatherDecider(this);
     this.fireWatcher                = new FireWatcher(this);
     this.dangerWatcher              = new DangerWatcher(this);
     this.damageWatcher              = new DamageWatcher();
     this.strengthWatcher            = new StrengthWatcher(this);
     this.wealthWatcher              = new WealthWatcher(this);
     this.regionDirtyer              = new RegionDirtyer(this);
     this.cellsInRandomOrder         = new MapCellsInRandomOrder(this);
     this.rememberedCameraPos        = new RememberedCameraPos(this);
     this.mineStrikeManager          = new MineStrikeManager();
     this.storyState                 = new StoryState(this);
     this.retainedCaravanData        = new RetainedCaravanData(this);
     this.components.Clear();
     this.FillComponents();
 }
Ejemplo n.º 2
0
        public static FloodUnfogResult FloodUnfog(IntVec3 root, Map map)
        {
            FloodFillerFog.cellsToUnfog.Clear();
            FloodUnfogResult result = default(FloodUnfogResult);

            bool[]         fogGridDirect      = map.fogGrid.fogGrid;
            FogGrid        fogGrid            = map.fogGrid;
            List <IntVec3> newlyUnfoggedCells = new List <IntVec3>();
            int            numUnfogged        = 0;
            bool           expanding          = false;
            CellRect       viewRect           = CellRect.ViewRect(map);

            result.allOnScreen = true;
            Predicate <IntVec3> predicate = delegate(IntVec3 c)
            {
                bool result;
                if (!fogGridDirect[map.cellIndices.CellToIndex(c)])
                {
                    result = false;
                }
                else
                {
                    Thing edifice = c.GetEdifice(map);
                    result = ((edifice == null || !edifice.def.MakeFog) && (!FloodFillerFog.testMode || expanding || numUnfogged <= 500));
                }
                return(result);
            };
            Action <IntVec3> processor = delegate(IntVec3 c)
            {
                fogGrid.Unfog(c);
                newlyUnfoggedCells.Add(c);
                List <Thing> thingList = c.GetThingList(map);
                for (int l = 0; l < thingList.Count; l++)
                {
                    Pawn pawn = thingList[l] as Pawn;
                    if (pawn != null)
                    {
                        pawn.mindState.Active = true;
                        if (pawn.def.race.IsMechanoid)
                        {
                            result.mechanoidFound = true;
                        }
                    }
                }
                if (!viewRect.Contains(c))
                {
                    result.allOnScreen = false;
                }
                result.cellsUnfogged++;
                if (FloodFillerFog.testMode)
                {
                    numUnfogged++;
                    map.debugDrawer.FlashCell(c, (float)numUnfogged / 200f, numUnfogged.ToStringCached(), 50);
                }
            };

            map.floodFiller.FloodFill(root, predicate, processor, int.MaxValue, false, null);
            expanding = true;
            for (int i = 0; i < newlyUnfoggedCells.Count; i++)
            {
                IntVec3 a = newlyUnfoggedCells[i];
                for (int j = 0; j < 8; j++)
                {
                    IntVec3 intVec = a + GenAdj.AdjacentCells[j];
                    if (intVec.InBounds(map) && fogGrid.IsFogged(intVec))
                    {
                        if (!predicate(intVec))
                        {
                            FloodFillerFog.cellsToUnfog.Add(intVec);
                        }
                    }
                }
            }
            for (int k = 0; k < FloodFillerFog.cellsToUnfog.Count; k++)
            {
                fogGrid.Unfog(FloodFillerFog.cellsToUnfog[k]);
                if (FloodFillerFog.testMode)
                {
                    map.debugDrawer.FlashCell(FloodFillerFog.cellsToUnfog[k], 0.3f, "x", 50);
                }
            }
            FloodFillerFog.cellsToUnfog.Clear();
            return(result);
        }