public virtual void OnEnable() { if (PipeAction != null) { PipeAction.pipeData = this; } AtmosManager.Instance.AddPipe(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 ConnectedAdd(PipeData NewConnection) { ConnectedPipes.Add(NewConnection); var pipe1Connection = this.Connections.Directions[(int)PipeFunctions.PipesToDirections(this, NewConnection)]; pipe1Connection.Connected = NewConnection; if (NetCompatible == false) { //This is a special pipe if (NewConnection.NetCompatible == false) { //NewConnection is a special pipe if (PipeFunctions.IsPipeOutputTo(this, NewConnection) && PipeFunctions.CanEqualiseWith(this, NewConnection)) { pipe1Connection.Connected = NewConnection; Outputs.Add(NewConnection); } } else { //NewConnection is a Pipe net if (PipeFunctions.IsPipeOutputTo(this, NewConnection)) { //An input to the pipe net it does not need to be recorded Outputs.Add(NewConnection); } if (this.Connections.Directions[(int)PipeFunctions.PipesToDirections(this, NewConnection)].PortType .HasFlag(OutputType.Can_Equalise_With)) { NewConnection.OnNet.AddEqualiseWith(this); } } } }