コード例 #1
0
 public void ExposeData()
 {
     MapExposeUtility.ExposeUshort(this.map, (IntVec3 c) => SnowGrid.SnowFloatToShort(this.GetDepth(c)), delegate(IntVec3 c, ushort val)
     {
         this.depthGrid[this.map.cellIndices.CellToIndex(c)] = SnowGrid.SnowShortToFloat(val);
     }, "depthGrid");
 }
コード例 #2
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            if (def.IsEdifice())
            {
                map.edificeGrid.Register(this);
                if (def.Fillage == FillCategory.Full)
                {
                    map.terrainGrid.Drawer.SetDirty();
                }
                if (def.AffectsFertility)
                {
                    map.fertilityGrid.Drawer.SetDirty();
                }
            }
            base.SpawnSetup(map, respawningAfterLoad);
            base.Map.listerBuildings.Add(this);
            if (def.coversFloor)
            {
                base.Map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Terrain, regenAdjacentCells: true, regenAdjacentSections: false);
            }
            CellRect cellRect = this.OccupiedRect();

            for (int i = cellRect.minZ; i <= cellRect.maxZ; i++)
            {
                for (int j = cellRect.minX; j <= cellRect.maxX; j++)
                {
                    IntVec3 intVec = new IntVec3(j, 0, i);
                    base.Map.mapDrawer.MapMeshDirty(intVec, MapMeshFlag.Buildings);
                    base.Map.glowGrid.MarkGlowGridDirty(intVec);
                    if (!SnowGrid.CanCoexistWithSnow(def))
                    {
                        base.Map.snowGrid.SetDepth(intVec, 0f);
                    }
                }
            }
            if (base.Faction == Faction.OfPlayer && def.building != null && def.building.spawnedConceptLearnOpportunity != null)
            {
                LessonAutoActivator.TeachOpportunity(def.building.spawnedConceptLearnOpportunity, OpportunityType.GoodToKnow);
            }
            AutoHomeAreaMaker.Notify_BuildingSpawned(this);
            if (def.building != null && !def.building.soundAmbient.NullOrUndefined())
            {
                LongEventHandler.ExecuteWhenFinished(delegate
                {
                    SoundInfo info   = SoundInfo.InMap(this);
                    sustainerAmbient = def.building.soundAmbient.TrySpawnSustainer(info);
                });
            }
            base.Map.listerBuildingsRepairable.Notify_BuildingSpawned(this);
            base.Map.listerArtificialBuildingsForMeditation.Notify_BuildingSpawned(this);
            base.Map.listerBuldingOfDefInProximity.Notify_BuildingSpawned(this);
            if (!this.CanBeSeenOver())
            {
                base.Map.exitMapGrid.Notify_LOSBlockerSpawned();
            }
            SmoothSurfaceDesignatorUtility.Notify_BuildingSpawned(this);
            map.avoidGrid.Notify_BuildingSpawned(this);
        }
コード例 #3
0
        private bool CanHaveSnow(int ind)
        {
            Building building = this.map.edificeGrid[ind];

            if (building != null && !SnowGrid.CanCoexistWithSnow(building.def))
            {
                return(false);
            }
            TerrainDef terrainDef = this.map.terrainGrid.TerrainAt(ind);

            return(terrainDef == null || terrainDef.holdSnow);
        }
コード例 #4
0
ファイル: Building.cs プロジェクト: sachdevs/RW-Decompile
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            if (this.def.IsEdifice())
            {
                map.edificeGrid.Register(this);
            }
            base.SpawnSetup(map, respawningAfterLoad);
            base.Map.listerBuildings.Add(this);
            if (this.def.coversFloor)
            {
                base.Map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Terrain, true, false);
            }
            CellRect cellRect = this.OccupiedRect();

            for (int i = cellRect.minZ; i <= cellRect.maxZ; i++)
            {
                for (int j = cellRect.minX; j <= cellRect.maxX; j++)
                {
                    IntVec3 intVec = new IntVec3(j, 0, i);
                    base.Map.mapDrawer.MapMeshDirty(intVec, MapMeshFlag.Buildings);
                    base.Map.glowGrid.MarkGlowGridDirty(intVec);
                    if (!SnowGrid.CanCoexistWithSnow(this.def))
                    {
                        base.Map.snowGrid.SetDepth(intVec, 0f);
                    }
                }
            }
            if (base.Faction == Faction.OfPlayer && this.def.building != null && this.def.building.spawnedConceptLearnOpportunity != null)
            {
                LessonAutoActivator.TeachOpportunity(this.def.building.spawnedConceptLearnOpportunity, OpportunityType.GoodToKnow);
            }
            AutoHomeAreaMaker.Notify_BuildingSpawned(this);
            if (this.def.building != null && !this.def.building.soundAmbient.NullOrUndefined())
            {
                LongEventHandler.ExecuteWhenFinished(delegate
                {
                    SoundInfo info        = SoundInfo.InMap(this, MaintenanceType.None);
                    this.sustainerAmbient = this.def.building.soundAmbient.TrySpawnSustainer(info);
                });
            }
            base.Map.listerBuildingsRepairable.Notify_BuildingSpawned(this);
            if (!this.CanBeSeenOver())
            {
                base.Map.exitMapGrid.Notify_LOSBlockerSpawned();
            }
            SmoothFloorDesignatorUtility.Notify_BuildingSpawned(this);
        }
コード例 #5
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();
 }
コード例 #6
0
 private void <ExposeData> m__1(IntVec3 c, ushort val)
 {
     this.depthGrid[this.map.cellIndices.CellToIndex(c)] = SnowGrid.SnowShortToFloat(val);
 }
コード例 #7
0
 private ushort <ExposeData> m__0(IntVec3 c)
 {
     return(SnowGrid.SnowFloatToShort(this.GetDepth(c)));
 }
コード例 #8
0
ファイル: Building.cs プロジェクト: woomy144/Rimworld
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            //Before base.SpawnSetup() so when regions are rebuilt this building can be accessed via edificeGrid
            if (def.IsEdifice())
            {
                map.edificeGrid.Register(this);
            }

            base.SpawnSetup(map, respawningAfterLoad);

            Map.listerBuildings.Add(this);

            //Remake terrain meshes with new underwall under me
            if (def.coversFloor)
            {
                Map.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Terrain, true, false);
            }

            var occRect = this.OccupiedRect();

            for (int z = occRect.minZ; z <= occRect.maxZ; z++)
            {
                for (int x = occRect.minX; x <= occRect.maxX; x++)
                {
                    var c = new IntVec3(x, 0, z);
                    Map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Buildings);
                    Map.glowGrid.MarkGlowGridDirty(c);
                    if (!SnowGrid.CanCoexistWithSnow(def))
                    {
                        Map.snowGrid.SetDepth(c, 0);
                    }
                }
            }

            if (Faction == Faction.OfPlayer)
            {
                if (def.building != null && def.building.spawnedConceptLearnOpportunity != null)
                {
                    LessonAutoActivator.TeachOpportunity(def.building.spawnedConceptLearnOpportunity, OpportunityType.GoodToKnow);
                }
            }

            AutoHomeAreaMaker.Notify_BuildingSpawned(this);

            if (def.building != null && !def.building.soundAmbient.NullOrUndefined())
            {
                LongEventHandler.ExecuteWhenFinished(() =>
                {
                    SoundInfo info   = SoundInfo.InMap(this, MaintenanceType.None);
                    sustainerAmbient = SoundStarter.TrySpawnSustainer(def.building.soundAmbient, info);
                });
            }

            Map.listerBuildingsRepairable.Notify_BuildingSpawned(this);

            if (!this.CanBeSeenOver())
            {
                Map.exitMapGrid.Notify_LOSBlockerSpawned();
            }

            SmoothSurfaceDesignatorUtility.Notify_BuildingSpawned(this);

            //Must go after adding to buildings list
            map.avoidGrid.Notify_BuildingSpawned(this);
        }