示例#1
0
        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);
                        }
                    }
                }
            }
        }