Esempio n. 1
0
        // Function from file: thermomachine.dm
        public override bool default_change_direction_wrench(dynamic user = null, dynamic W = null)
        {
            Obj_Machinery_Atmospherics node = null;


            if (!base.default_change_direction_wrench((object)(user), (object)(W)))
            {
                return(false);
            }
            this.SetInitDirections();
            node = this.nodes[1];

            if (node != null)
            {
                node.disconnect(this);
                this.nodes[1] = null;
            }
            this.nullifyPipenet(this.parents[1]);
            this.atmosinit();
            node = this.nodes[1];

            if (node != null)
            {
                node.atmosinit();
                node.addMember(this);
            }
            this.build_network();
            return(true);
        }
        // Function from file: junction.dm
        public override bool can_be_node(Obj_Machinery_Atmospherics target = null, double iteration = 0)
        {
            dynamic init_dir             = null;
            Obj_Machinery_Atmospherics H = null;


            switch ((int)(iteration))
            {
            case 1:
                init_dir = target.initialize_directions;
                break;

            case 2:
                H = target;

                if (!(H is Obj_Machinery_Atmospherics_Pipe_HeatExchanging))
                {
                    return(false);
                }
                init_dir = ((dynamic)H).initialize_directions_he;
                break;
            }

            if (Lang13.Bool(init_dir & Map13.GetDistance(target, this)))
            {
                return(true);
            }
            return(false);
        }
        // Function from file: filter.dm
        public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null)
        {
            dynamic direction = null;
            Obj_Machinery_Atmospherics node = null;

            this.overlays.Cut();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
            {
                direction = _a;


                if (Lang13.Bool(direction & this.initialize_directions))
                {
                    node = this.findConnecting(direction);

                    if (node != null)
                    {
                        this.overlays.Add(this.getpipeimage("icons/obj/atmospherics/components/trinary_devices.dmi", "cap", direction, node.pipe_color));
                        continue;
                    }
                    this.overlays.Add(this.getpipeimage("icons/obj/atmospherics/components/trinary_devices.dmi", "cap", direction));
                }
            }
            base.update_icon((object)(new_state), (object)(new_icon), new_px, new_py);
            return(false);
        }
        // Function from file: atmosmachinery.dm
        public override void construction(dynamic pipe_type = null, dynamic obj_color = null)
        {
            Ent_Static T                 = null;
            ByTable    nodes             = null;
            Obj_Machinery_Atmospherics A = null;


            if (this.can_unwrench)
            {
                this.color            = obj_color;
                this.pipe_color       = obj_color;
                this.stored.dir       = this.dir;
                this.stored.pipe_type = pipe_type;
                this.stored.color     = obj_color;
            }
            T          = this.loc;
            this.level = (Lang13.Bool(((dynamic)T).intact) ? 2 : 1);
            this.atmosinit();
            nodes = this.pipeline_expansion();

            foreach (dynamic _a in Lang13.Enumerate(nodes, typeof(Obj_Machinery_Atmospherics)))
            {
                A = _a;

                A.atmosinit();
                A.addMember(this);
            }
            this.build_network();
            return;
        }
Esempio n. 5
0
        // Function from file: construction.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic A2 = null;
            Obj_Machinery_Atmospherics M = null;
            dynamic T = null;


            if (!(A is Obj_Item_Weapon_Wrench))
            {
                return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
            }

            if (!(this.loc is Tile))
            {
                return(1);
            }
            this.fixdir();

            if (new ByTable(new object [] { typeof(Obj_Machinery_Atmospherics_Components_Trinary_Mixer), typeof(Obj_Machinery_Atmospherics_Components_Trinary_Filter) }).Contains(this.pipe_type))
            {
                this.dir = this.unflip(this.dir);
            }
            A2     = Lang13.Call(this.pipe_type, this.loc);
            A2.dir = this.dir;
            ((Obj_Machinery_Atmospherics)A2).SetInitDirections();

            foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Machinery_Atmospherics)))
            {
                M = _a;


                if (M == A2)
                {
                    continue;
                }

                if (Lang13.Bool(M.GetInitDirections() & ((Obj_Machinery_Atmospherics)A2).GetInitDirections()))
                {
                    user.WriteMsg("<span class='warning'>There is already a pipe at that location!</span>");
                    GlobalFuncs.qdel(A2);
                    return(1);
                }
            }

            if (Lang13.Bool(this.pipename))
            {
                A2.name = this.pipename;
            }
            T = A2;

            if (T is Obj_Machinery_Atmospherics_Components_Trinary)
            {
                T.flipped = this.flipped;
            }
            ((Obj_Machinery)A2).construction(this.pipe_type, this.color);
            GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
            ((Ent_Static)user).visible_message(new Txt().item(user).str(" fastens ").the(this).item().str(".").ToString(), new Txt("<span class='notice'>You fasten ").the(this).item().str(".</span>").ToString(), "<span class='italics'>You hear ratchet.</span>");
            GlobalFuncs.qdel(this);
            return(null);
        }
 // Function from file: atmosmachinery.dm
 public virtual bool can_be_node(Obj_Machinery_Atmospherics target = null, double iteration = 0)
 {
     if (Lang13.Bool(target.initialize_directions & Map13.GetDistance(target, this)))
     {
         return(true);
     }
     return(false);
 }
        // Function from file: components_base.dm
        public override void setPipenet(Pipeline reference = null, Obj_Machinery_Atmospherics A = null)
        {
            dynamic I = null;

            I = this.nodes.Find(A);

            this.parents[I] = reference;
        }
        // Function from file: components_base.dm
        public dynamic icon_addintact(Obj_Machinery_Atmospherics node = null)
        {
            Image img = null;

            img = this.getpipeimage("icons/obj/atmospherics/components/binary_devices.dmi", "pipe_intact", Map13.GetDistance(this, node), node.pipe_color);
            this.underlays.Add(img);
            return(((dynamic)img).dir);
        }
        // Function from file: datum_pipeline.dm
        public override void addMember(Obj_Machinery_Atmospherics A = null)
        {
            Pipeline P = null;

            P = this.returnPipenet(A);
            P.addMember(A, this);
            return;
        }
Esempio n. 10
0
        // Function from file: atmosmachinery.dm
        public override bool relaymove(Mob user = null, int?direction = null)
        {
            Obj_Machinery_Atmospherics target_move = null;
            ByTable pipenetdiff = null;


            if (!(((direction ?? 0) & Convert.ToInt32(this.initialize_directions)) != 0))
            {
                return(false);
            }

            if (this.buckled_mob == user)
            {
                return(false);
            }
            target_move = this.findConnecting(direction);

            if (target_move != null)
            {
                if (target_move.can_crawl_through())
                {
                    if (GlobalFuncs.is_type_in_list(target_move, GlobalVars.ventcrawl_machinery))
                    {
                        user.forceMove(target_move.loc);
                        user.visible_message("<span class='notice'>You hear something squeezing through the ducts...</span>", "<span class='notice'>You climb out the ventilation system.");
                    }
                    else
                    {
                        pipenetdiff = this.returnPipenets() ^ target_move.returnPipenets();

                        if (pipenetdiff.len != 0)
                        {
                            user.update_pipe_vision(target_move);
                        }
                        user.loc        = target_move;
                        user.client.eye = target_move;

                        if (Game13.time - Convert.ToDouble(((dynamic)user).last_played_vent) > 30)
                        {
                            ((dynamic)user).last_played_vent = Game13.time;
                            GlobalFuncs.playsound(this, "sound/machines/ventcrawl.ogg", 50, 1, -3);
                        }
                    }
                }
            }
            else if (((direction ?? 0) & Convert.ToInt32(this.initialize_directions)) != 0 || GlobalFuncs.is_type_in_list(this, GlobalVars.ventcrawl_machinery) && this.can_crawl_through())
            {
                user.forceMove(this.loc);
                user.visible_message("<span class='notice'>You hear something squeezing through the ducts...</span>", "<span class='notice'>You climb out the ventilation system.");
            }
            user.canmove = false;
            Task13.Schedule(1, (Task13.Closure)(() => {
                user.canmove = true;
                return;
            }));
            return(false);
        }
Esempio n. 11
0
        // Function from file: datum_pipeline.dm
        public void addMachineryMember(Obj_Machinery_Atmospherics C = null)
        {
            dynamic G = null;

            this.other_atmosmch.Or(C);
            G = C.returnPipenetAir(this);
            this.other_airs.Or(G);
            return;
        }
        // Function from file: components_base.dm
        public override Pipeline returnPipenet(Obj_Machinery_Atmospherics A = null)
        {
            A = A ?? this.nodes[1];

            dynamic I = null;

            I = this.nodes.Find(A);
            return(this.parents[I]);
        }
Esempio n. 13
0
        // Function from file: atmosmachinery.dm
        public virtual void atmosinit(ByTable node_connects = null)
        {
            double  I  = 0;
            dynamic D  = null;
            double  I2 = 0;
            Obj_Machinery_Atmospherics target = null;


            if (!(node_connects != null))
            {
                node_connects     = new ByTable();
                node_connects.len = this.device_type;

                foreach (dynamic _b in Lang13.IterateRange(1, this.device_type))
                {
                    I = _b;


                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cardinal))
                    {
                        D = _a;


                        if (Lang13.Bool(D & this.GetInitDirections()))
                        {
                            if (node_connects.Contains(D))
                            {
                                continue;
                            }
                            node_connects[I] = D;
                            break;
                        }
                    }
                }
            }

            foreach (dynamic _d in Lang13.IterateRange(1, this.device_type))
            {
                I2 = _d;


                foreach (dynamic _c in Lang13.Enumerate(Map13.GetStep(this, Convert.ToInt32(node_connects[I2])), typeof(Obj_Machinery_Atmospherics)))
                {
                    target = _c;


                    if (this.can_be_node(target, I2))
                    {
                        this.nodes[I2] = target;
                        break;
                    }
                }
            }
            this.update_icon();
            return;
        }
Esempio n. 14
0
        // Function from file: construction.dm
        public Obj_Item_Pipe(dynamic loc = null, dynamic pipe_type = null, double?dir = null, Obj_Machinery_Atmospherics make_from = null) : base((object)(loc))
        {
            dynamic P = null;
            Obj_Machinery_Atmospherics triP = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            if (make_from != null)
            {
                this.dir      = make_from.dir;
                this.pipename = make_from.name;
                this.color    = make_from.color;

                if (GlobalVars.pipe_types.Contains(make_from.type))
                {
                    this.pipe_type = make_from.type;
                }
                else
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.pipe_types))
                    {
                        P = _a;


                        if (Lang13.Bool(P.IsInstanceOfType(make_from)))
                        {
                            this.pipe_type = P;
                            break;
                        }
                    }
                }
                triP = make_from;

                if (triP is Obj_Machinery_Atmospherics_Components_Trinary && Lang13.Bool(((dynamic)triP).flipped))
                {
                    this.flipped = 1;
                    this.dir     = Num13.Rotate(this.dir, -45);
                }
            }
            else
            {
                this.pipe_type = pipe_type;
                this.dir       = ((int)(dir ?? 0));
            }

            if (GlobalVars.diagonals.Contains(this.dir))
            {
                this.is_bent = true;
            }
            this.update();
            this.pixel_x = Rand13.Int(-5, 5);
            this.pixel_y = Rand13.Int(-5, 5);
            return;
        }
Esempio n. 15
0
        // Function from file: he_pipes.dm
        public override bool can_be_node(Obj_Machinery_Atmospherics target = null, double iteration = 0)
        {
            if (!(target is Obj_Machinery_Atmospherics_Pipe_HeatExchanging))
            {
                return(false);
            }

            if (Lang13.Bool(((dynamic)target).initialize_directions_he & Map13.GetDistance(target, this)))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 16
0
        // Function from file: atmosmachinery.dm
        public virtual void nullifyNode(double I = 0)
        {
            Obj_Machinery_Atmospherics N = null;


            if (Lang13.Bool(this.nodes[I]))
            {
                N = this.nodes[I];
                N.disconnect(this);
                this.nodes[I] = null;
            }
            return;
        }
        // Function from file: pipes.dm
        public override void nullifyNode(double I = 0)
        {
            Obj_Machinery_Atmospherics oldN = null;

            oldN = this.nodes[I];
            base.nullifyNode(I);

            if (oldN != null)
            {
                oldN.build_network();
            }
            return;
        }
Esempio n. 18
0
        // Function from file: atmosmachinery.dm
        public void disconnect(Obj_Machinery_Atmospherics reference = null)
        {
            Obj_Machinery_Atmospherics P = null;
            int I = 0;


            if (reference is Obj_Machinery_Atmospherics_Pipe)
            {
                P = reference;
                GlobalFuncs.qdel(((dynamic)P).parent);
            }
            I             = this.nodes.Find(reference);
            this.nodes[I] = null;
            this.update_icon();
            return;
        }
Esempio n. 19
0
        // Function from file: atmosmachinery.dm
        public Obj_Machinery_Atmospherics findConnecting(dynamic direction = null)
        {
            Obj_Machinery_Atmospherics target = null;


            foreach (dynamic _a in Lang13.Enumerate(Map13.GetStep(this, Convert.ToInt32(direction)), typeof(Obj_Machinery_Atmospherics)))
            {
                target = _a;


                if (Lang13.Bool(target.initialize_directions & Map13.GetDistance(target, this)))
                {
                    return(target);
                }
            }
            return(null);
        }
Esempio n. 20
0
        // Function from file: air.dm
        public void setup_atmos_machinery(double?z_level = null)
        {
            Obj_Machinery_Atmospherics AM = null;


            foreach (dynamic _a in Lang13.Enumerate(this.atmos_machinery, typeof(Obj_Machinery_Atmospherics)))
            {
                AM = _a;


                if (Lang13.Bool(z_level) && AM.z != z_level)
                {
                    continue;
                }
                AM.atmosinit();
            }
            return;
        }
Esempio n. 21
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;
        }
 // Function from file: datum_pipeline.dm
 public override void addMember(Obj_Machinery_Atmospherics A = null)
 {
     this.parent.addMember(A, this);
     return;
 }
Esempio n. 23
0
 // Function from file: datum_pipeline.dm
 public virtual void addMember(Obj_Machinery_Atmospherics A = null)
 {
     return;
 }
Esempio n. 24
0
 // Function from file: atmosmachinery.dm
 public virtual Pipeline returnPipenet(Obj_Machinery_Atmospherics A = null)
 {
     return(null);
 }
 // Function from file: pipes.dm
 public override Pipeline returnPipenet(Obj_Machinery_Atmospherics A = null)
 {
     return(this.parent);
 }
 // Function from file: pipes.dm
 public override void setPipenet(Pipeline reference = null, Obj_Machinery_Atmospherics A = null)
 {
     this.parent = reference;
     return;
 }
Esempio n. 27
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;
        }
Esempio n. 28
0
 // Function from file: atmosmachinery.dm
 public virtual void setPipenet(Pipeline reference = null, Obj_Machinery_Atmospherics A = null)
 {
     return;
 }