public static LiquidPipeNet MakeNewNet(PipeData pipeData) { var Net = new LiquidPipeNet(); Net.AddPipe(pipeData); return(Net); }
public virtual void OnEnable() { if (PipeAction != null) { PipeAction.pipeData = this; } AtmosManager.Instance.inGameNewPipes.Add(this); ConnectedPipes = PipeFunctions.GetConnectedPipes(ConnectedPipes, this, MatrixPos, matrix); foreach (var Pipe in ConnectedPipes) { Pipe.NetHookUp(this); } if (OnNet == null && NetCompatible) { OnNet = LiquidPipeNet.MakeNewNet(this); } foreach (var Pipe in ConnectedPipes) { Pipe.ConnectedAdd(this); if (NetCompatible == false) { //This is a special pipe //so Determine If neighbours special or net if (Pipe.NetCompatible == false) { //What is connecting to is a special pipe if (PipeFunctions.IsPipeOutputTo(this, Pipe) && PipeFunctions.CanEqualiseWith(this, Pipe)) { Outputs.Add(Pipe); } //Shouldn't need to register outputs on Pipe Since it could handle itself } else { //What is connecting to is a Net if (PipeFunctions.IsPipeOutputTo(this, Pipe)) { Outputs.Add(Pipe); } //Can it accept input? if (this.Connections.Directions[(int)PipeFunctions.PipesToDirections(this, Pipe)].PortType .HasFlag(OutputType.Can_Equalise_With)) { Pipe.OnNet.AddEqualiseWith(this); } } } } }
public void CombinePipeNets(LiquidPipeNet LiquidPipeNet) { CanEqualiseWith = CanEqualiseWith.Union(LiquidPipeNet.CanEqualiseWith).ToList(); Covering.AddRange(LiquidPipeNet.Covering); foreach (var pipe in LiquidPipeNet.Covering) { pipe.OnNet = this; } mixAndVolume.Add(LiquidPipeNet.mixAndVolume); LiquidPipeNet.DisableThis(); }
public static LiquidPipeNet MakeNewNet(PipeData pipeData) { var Net = new LiquidPipeNet(); pipeData.OnNet = Net; Net.mixAndVolume = pipeData.mixAndVolume.Clone(); Net.Covering.Add(pipeData); Net.NetUpdateProxy.OnNet = Net; Net.NetUpdateProxy.OnEnable(); if (pipeData.CustomLogic == CustomLogic.CoolingPipe) { Net.pipeNetAction = new CoolingNet(); Net.pipeNetAction.LiquidPipeNet = Net; } return(Net); }
public void SplitPipeNets() { if (mixAndVolume.TheVolume == 0) { return; //Assuming that there was only one pipe and it's already been removed from It Spilling } foreach (var pipe in Covering) { //mixAndVolume.Take(pipe.mixAndVolume); pipe.OnNet = null; } LiquidPipeNet newPipenet = new LiquidPipeNet(); var separatedPipenets = new List <LiquidPipeNet>() { newPipenet }; for (int i = 0; i < Covering.Count; i++) { var pipe = Covering[i]; if (pipe.OnNet == null) { if (newPipenet == null) { newPipenet = new LiquidPipeNet(); separatedPipenets.Add(newPipenet); } newPipenet.SpreadPipenet(pipe); newPipenet = null; } } mixAndVolume.Divide(mixAndVolume.TheVolume); for (int i = 0; i < separatedPipenets.Count; i++) { var pipenet = separatedPipenets[i]; var MultiplyMixed = mixAndVolume.Clone(); MultiplyMixed.Multiply(pipenet.mixAndVolume.TheVolume); pipenet.mixAndVolume.Add(MultiplyMixed, false); } DisableThis(); }
public void LiquidFindNetWork() { if (NetCompatible) { foreach (var pipe in ConnectedPipes) { if (pipe.NetCompatible) { if (pipe.OnNet != null) { pipe.OnNet.AddPipe(this); } } } if (OnNet == null) { OnNet = LiquidPipeNet.MakeNewNet(this); } } }