public DelayedAction(ShieldNetManager.DelayedActionType type, CompShield compShield) { this.type = type; this.compShield = compShield; }
public void UpdatePowerNetsAndConnections_First() { int count = this.delayedActions.Count; for (int i = 0; i < count; i++) { ShieldNetManager.DelayedAction delayedAction = this.delayedActions[i]; ShieldNetManager.DelayedActionType type = this.delayedActions[i].type; if (type != ShieldNetManager.DelayedActionType.RegisterTransmitter) { if (type == ShieldNetManager.DelayedActionType.DeregisterTransmitter) { this.TryDestroyNetAt(delayedAction.compShield.parent.Position); ShieldConnectionMaker.DisconnectAllFromTransmitterAndSetWantConnect(delayedAction.compShield, this.map); delayedAction.compShield.ResetPowerVars(); } } else { ThingWithComps parent = delayedAction.compShield.parent; if (this.map.powerNetGrid.TransmittedPowerNetAt(parent.Position) != null) { Log.Warning(string.Concat(new object[] { "Tried to register trasmitter ", parent, " at ", parent.Position, ", but there is already a power net here. There can't be two transmitters on the same cell." })); } delayedAction.compShield.SetUpPowerVars(); foreach (IntVec3 current in GenAdj.CellsAdjacentCardinal(parent)) { this.TryDestroyNetAt(current); } } } for (int j = 0; j < count; j++) { ShieldNetManager.DelayedAction delayedAction2 = this.delayedActions[j]; if (delayedAction2.type == ShieldNetManager.DelayedActionType.RegisterTransmitter || delayedAction2.type == ShieldNetManager.DelayedActionType.DeregisterTransmitter) { this.TryCreateNetAt(delayedAction2.compShield.parent.Position); foreach (IntVec3 current2 in GenAdj.CellsAdjacentCardinal(delayedAction2.compShield.parent)) { this.TryCreateNetAt(current2); } } } for (int k = 0; k < count; k++) { ShieldNetManager.DelayedAction delayedAction3 = this.delayedActions[k]; ShieldNetManager.DelayedActionType type = this.delayedActions[k].type; if (type != ShieldNetManager.DelayedActionType.RegisterConnector) { if (type == ShieldNetManager.DelayedActionType.DeregisterConnector) { ShieldConnectionMaker.DisconnectFromPowerNet(delayedAction3.compShield); delayedAction3.compShield.ResetPowerVars(); } } else { delayedAction3.compShield.SetUpPowerVars(); ShieldConnectionMaker.TryConnectToAnyPowerNet(delayedAction3.compShield, null); } } this.delayedActions.RemoveRange(0, count); if (DebugViewSettings.drawPower) { this.DrawDebugPowerNets(); } }