예제 #1
0
        // Function from file: datum_pipeline.dm
        public void addMember(Obj_Machinery_Atmospherics A = null, Obj_Machinery_Atmospherics N = null)
        {
            Obj_Machinery_Atmospherics P      = null;
            ByTable adjacent                  = null;
            Obj_Machinery_Atmospherics_Pipe I = null;
            Pipeline E = null;


            if (A is Obj_Machinery_Atmospherics_Pipe)
            {
                P = A;
                ((dynamic)P).parent = this;
                adjacent            = P.pipeline_expansion();

                foreach (dynamic _a in Lang13.Enumerate(adjacent, typeof(Obj_Machinery_Atmospherics_Pipe)))
                {
                    I = _a;


                    if (I.parent == this)
                    {
                        continue;
                    }
                    E = I.parent;
                    this.merge(E);
                }

                if (!(this.members.Find(P) != 0))
                {
                    this.members.Add(P);
                    this.air.volume += Convert.ToDouble(((dynamic)P).volume);
                }
            }
            else
            {
                A.setPipenet(this, N);
                this.addMachineryMember(A);
            }
            return;
        }
예제 #2
0
        // Function from file: datum_pipeline.dm
        public void build_pipeline(Obj_Machinery_Atmospherics _base = null)
        {
            double volume = 0;
            Obj_Machinery_Atmospherics E          = null;
            ByTable possible_expansions           = null;
            Obj_Machinery_Atmospherics borderline = null;
            ByTable result = null;
            Obj_Machinery_Atmospherics P    = null;
            Obj_Machinery_Atmospherics item = null;

            volume = 0;

            if (_base is Obj_Machinery_Atmospherics_Pipe)
            {
                E      = _base;
                volume = Convert.ToDouble(((dynamic)E).volume);
                this.members.Add(E);

                if (Lang13.Bool(((dynamic)E).air_temporary))
                {
                    this.air = ((dynamic)E).air_temporary;
                    ((dynamic)E).air_temporary = null;
                }
            }
            else
            {
                this.addMachineryMember(_base);
            }

            if (!(this.air != null))
            {
                this.air = new GasMixture();
            }
            possible_expansions = new ByTable(new object [] { _base });

            while (possible_expansions.len > 0)
            {
                foreach (dynamic _b in Lang13.Enumerate(possible_expansions, typeof(Obj_Machinery_Atmospherics)))
                {
                    borderline = _b;

                    result = borderline.pipeline_expansion(this);

                    if (result.len > 0)
                    {
                        foreach (dynamic _a in Lang13.Enumerate(result, typeof(Obj_Machinery_Atmospherics)))
                        {
                            P = _a;


                            if (P is Obj_Machinery_Atmospherics_Pipe)
                            {
                                item = P;

                                if (!(this.members.Find(item) != 0))
                                {
                                    if (Lang13.Bool(((dynamic)item).parent))
                                    {
                                        if (GlobalVars.pipenetwarnings > 0)
                                        {
                                            GlobalFuncs.warning("build_pipeline(): " + item.type + " added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) Nearby: (" + item.x + ", " + item.y + ", " + item.z + ")");
                                            GlobalVars.pipenetwarnings -= 1;

                                            if (GlobalVars.pipenetwarnings == 0)
                                            {
                                                GlobalFuncs.warning("build_pipeline(): further messages about pipenets will be supressed");
                                            }
                                        }
                                    }
                                    this.members.Add(item);
                                    possible_expansions.Add(item);
                                    volume += Convert.ToDouble(((dynamic)item).volume);
                                    ((dynamic)item).parent = this;

                                    if (Lang13.Bool(((dynamic)item).air_temporary))
                                    {
                                        this.air.merge(((dynamic)item).air_temporary);
                                        ((dynamic)item).air_temporary = null;
                                    }
                                }
                            }
                            else
                            {
                                P.setPipenet(this, borderline);
                                this.addMachineryMember(P);
                            }
                        }
                    }
                    possible_expansions.Remove(borderline);
                }
            }
            this.air.volume = volume;
            return;
        }