public void PrintForPowerGrid(SectionLayer layer) { //Transmitter stuff if (TransmitsPower) { foreach (IntVec3 sq in GenAdj.SquaresOccupiedBy(this)) { //Transmission lines LinkDrawers.transmitterOverlay.PrintOnto(layer, this, sq); } } //The connector base (small blue circle) if (def.ConnectToPower) { PowerNetGraphics.PrintOverlayConnectorBaseFor(layer, this); } //The connector wire if (connectedToTransmitter != null) { PowerNetGraphics.PrintWirePieceConnecting(layer, this, connectedToTransmitter, true); } }
public override void SpawnSetup() { base.SpawnSetup(); Find.ListerBuildings.Add(this); if (TransmitsPower) { PowerNetManager.Notify_TransmitterSpawned(this); } if (def.ConnectToPower) { PowerNetManager.Notify_ConnectorSpawned(this); } //Remake terrain meshes with new underwall under me if (def.coversFloor) { Find.MapDrawer.MapChanged(Position, MapChangeType.Terrain); } if (TransmitsPower || def.ConnectToPower) { Find.MapDrawer.MapChanged(Position, MapChangeType.PowerGrid, true, false); } foreach (IntVec3 sq in GenAdj.SquaresOccupiedBy(this)) { Find.MapDrawer.MapChanged(sq, MapChangeType.Buildings); Find.GlowGrid.MarkGlowGridDirty(sq); } if (def.category == EntityCategory.Building) { Find.BuildingGrid.Register(this); } if (Faction == Faction.OfColony) { if (def.building != null && def.building.spawnedConceptLearnOpportunity != null) { Find.ConceptTracker.TeachOpportunity(def.building.spawnedConceptLearnOpportunity, OpportunityType.GoodToKnow); } } }
public override void Destroy() { base.Destroy(); GenLeaving.DoLeavingsFor(this, destroyMode); if (def.MakeFog) { Find.FogGrid.Notify_FogBlockerDestroyed(Position); } if (def.holdsRoof) { RoofCollapseChecker.Notify_RoofHolderDestroyed(this); } if (def.leaveTerrain != null && Map.Initialized) { foreach (IntVec3 loc in GenAdj.SquaresOccupiedBy(this)) { Find.TerrainGrid.SetTerrain(loc, def.leaveTerrain); } } Find.ListerBuildings.Remove(this); if (TransmitsPower || def.ConnectToPower) { if (TransmitsPower) { PowerNetManager.Notify_TransmitterDespawned(this); } if (def.ConnectToPower) { PowerNetManager.Notify_ConnectorDespawned(this); } Find.MapDrawer.MapChanged(Position, MapChangeType.PowerGrid, true, false); } }
public override void DeSpawn() { base.DeSpawn(); if (def.category == EntityCategory.Building) { Find.BuildingGrid.DeRegister(this); } foreach (IntVec3 sq in GenAdj.SquaresOccupiedBy(this)) { MapChangeType changeType = MapChangeType.Buildings; if (def.coversFloor) //Because floor covering buildings affect how the terrain looks { changeType |= MapChangeType.Terrain; } Find.Map.mapDrawer.MapChanged(sq, changeType); Find.GlowGrid.MarkGlowGridDirty(sq); } }