public void Reload() { if (CompGasStation == null) { CompGasStation = GetComp <CompGasStation>(); GasModifiers = CompGasStation.Props.GasModifier; } CurrentNet = CompGasStation.pipeNet; NetTankers = CurrentNet.GasTankers; }
public void TryCreatePipeNet(IntVec3 pipe, PipeType type) { if (!pipe.InBounds(map) || PipeNetAt(pipe) != null) { return; } int pipeTypeInt = (int)type; PipelineNet newNet = new PipelineNet { GasManager = this, NetType = type }; Predicate <IntVec3> predicate = delegate(IntVec3 c) { foreach (var item in GridsUtility.GetThingList(c, map)) { CompPipe compPipe2 = item.TryGetComp <CompPipe>(); if (compPipe2 != null) { if (compPipe2.PipeType == type) { compPipe2.pipeNet = newNet; newNet.PipesThings.Add(compPipe2.parent); CellRect cellRect = compPipe2.parent.OccupiedRect(); foreach (var cell in cellRect) { int num = map.cellIndices.CellToIndex(cell.x, cell.z); PipeGrid[pipeTypeInt, map.cellIndices.CellToIndex(c)] = 1; PipeNets[num] = newNet; } } if (compPipe2.GasProps.ConnectEverything) { newNet.PipesThings.Add(compPipe2.parent); } return(true); } } return(false); }; map.floodFiller.FloodFill(pipe, predicate, delegate(IntVec3 x) { }); PipelineSet[type].Add(newNet); AllPipeNets.Add(newNet); newNet.InitNet(); }
public void DeletePipeNet(PipelineNet pipeNet) { AllPipeNets.Remove(pipeNet); PipelineSet[pipeNet.NetType].Remove(pipeNet); int pipeType = (int)pipeNet.NetType; foreach (var pipeThing in pipeNet.PipesThings) { CellRect cellRect = pipeThing.OccupiedRect(); foreach (var cell in cellRect) { int num = map.cellIndices.CellToIndex(cell); PipeNets[num] = null; PipeGrid[pipeType, num] = -1; } } }