public void RegisterShieldNet(ShieldNet newNet) { this.allNets.Add(newNet); newNet.shieldNetManager = this; this.map.shieldNetGrid.Notify_ShieldNetCreated(newNet); ShieldNetMaker.UpdateVisualLinkagesFor(newNet); }
public void ConnectToTransmitter(CompShield transmitter, bool reconnectingAfterLoading = false) { if (this.connectParent != null && (!reconnectingAfterLoading || this.connectParent != transmitter)) { Log.Error(string.Concat(new object[] { "Tried to connect ", this, " to transmitter ", transmitter, " but it's already connected to ", this.connectParent, "." })); return; } this.connectParent = transmitter; if (this.connectParent.connectChildren == null) { this.connectParent.connectChildren = new List <CompShield>(); } transmitter.connectChildren.Add(this); ShieldNet powerNet = this.ShieldNet; if (powerNet != null) { powerNet.RegisterConnector(this); } }
public virtual void ResetPowerVars() { this.transNet = null; this.connectParent = null; this.connectChildren = null; CompShield.recentlyConnectedNets.Clear(); CompShield.lastManualReconnector = null; }
private void TryDestroyNetAt(IntVec3 cell) { if (!cell.InBounds(this.map)) { return; } ShieldNet powerNet = this.map.shieldNetGrid.TransmittedShieldNetAt(cell); if (powerNet != null) { this.DeletePowerNet(powerNet); } }
private void TryCreateNetAt(IntVec3 cell) { if (!cell.InBounds(this.map)) { return; } if (this.map.powerNetGrid.TransmittedPowerNetAt(cell) == null) { Building transmitter = cell.GetTransmitter(this.map); if (transmitter != null && transmitter.TransmitsPowerNow) { ShieldNet powerNet = ShieldNetMaker.NewPowerNetStartingFrom(transmitter); this.RegisterShieldNet(powerNet); for (int i = 0; i < powerNet.transmitters.Count; i++) { ShieldConnectionMaker.ConnectAllConnectorsToTransmitter(powerNet.transmitters[i]); } } } }
public void DeletePowerNet(ShieldNet oldNet) { this.allNets.Remove(oldNet); this.map.shieldNetGrid.Notify_ShieldNetDeleted(oldNet); }