Пример #1
0
        // Function from file: atmosmachinery.dm
        public override dynamic Destroy(  )
        {
            double I = 0;


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

                this.nullifyNode(I);
            }
            GlobalVars.SSair.atmos_machinery.Remove(this);

            if (this.stored != null)
            {
                GlobalFuncs.qdel(this.stored);
                this.stored = null;
            }
            this.dropContents();

            if (this.pipe_vision_img != null)
            {
                GlobalFuncs.qdel(this.pipe_vision_img);
            }
            return(base.Destroy());
        }
Пример #2
0
 // Function from file: atmosmachinery.dm
 public override void Deconstruct(  )
 {
     if (this.can_unwrench)
     {
         this.stored.loc = this.loc;
         this.transfer_fingerprints_to(this.stored);
         this.stored = null;
     }
     GlobalFuncs.qdel(this);
     return;
 }
Пример #3
0
        // Function from file: pipe_dispenser.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Type          p_type = null;
            double?       p_dir  = null;
            Obj_Item_Pipe P      = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(1);
            }

            if (!Lang13.Bool(this.anchored) || !Task13.User.canmove || Task13.User.stat != 0 || Task13.User.restrained() || !(Map13.GetDistance(this.loc, Task13.User) <= 1))
            {
                Interface13.Browse(Task13.User, null, "window=pipedispenser");
                return(1);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(href_list["make"]))
            {
                if (!this.wait)
                {
                    p_type = Lang13.FindClass(href_list["make"]);
                    p_dir  = String13.ParseNumber(href_list["dir"]);
                    P      = new Obj_Item_Pipe(this.loc, p_type, p_dir);
                    P.add_fingerprint(Task13.User);
                    this.wait = true;
                    Task13.Schedule(10, (Task13.Closure)(() => {
                        this.wait = false;
                        return;
                    }));
                }
            }

            if (Lang13.Bool(href_list["makemeter"]))
            {
                if (!this.wait)
                {
                    new Obj_Item_PipeMeter(this.loc);
                    this.wait = true;
                    Task13.Schedule(15, (Task13.Closure)(() => {
                        this.wait = false;
                        return;
                    }));
                }
            }
            return(null);
        }
Пример #4
0
        // Function from file: atmosmachinery.dm
        public Obj_Machinery_Atmospherics(dynamic loc = null, int?process = null) : base((object)(loc))
        {
            process = process ?? GlobalVars.TRUE;

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

            if (Lang13.Bool(process))
            {
                GlobalVars.SSair.atmos_machinery.Add(this);
            }
            this.SetInitDirections();

            if (this.can_unwrench)
            {
                this.stored = new Obj_Item_Pipe(this, null, null, this);
            }
            return;
        }
Пример #5
0
        // Function from file: RPD.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic       queued_p_type    = null;
            double?       queued_p_dir     = null;
            double?       queued_p_flipped = null;
            dynamic       P  = null;
            Obj_Item_Pipe P2 = null;
            Obj_Structure_Disposalconstruct C = null;


            if (!(Map13.GetDistance(target, user) <= 1) || this.loc != user)
            {
                return(false);
            }

            if (!((Mob)user).IsAdvancedToolUser())
            {
                user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>");
                return(false);
            }

            if (target is Zone_Shuttle || target is Tile_Space_Transit)
            {
                return(false);
            }
            queued_p_type    = this.p_type;
            queued_p_dir     = this.p_dir;
            queued_p_flipped = this.p_flipped;

            switch ((int)(this.p_class))
            {
            case -2:

                if (!(target is Obj_Machinery_Atmospherics_Pipe))
                {
                    user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str("'s error light flickers!  Perhaps you need to only use it on pipes and pipe meters?</span>").ToString());
                    return(false);
                }
                P = target;
                GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1);
                P.color        = this.paint_colors[this.paint_color];
                P.pipe_color   = this.paint_colors[this.paint_color];
                P.stored.color = this.paint_colors[this.paint_color];
                ((Ent_Static)user).visible_message(new Txt("<span class='notice'>").item(user).str(" paints ").the(P).item().str(" ").item(this.paint_color).str(".</span>").ToString(), new Txt("<span class='notice'>You paint ").the(P).item().str(" ").item(this.paint_color).str(".</span>").ToString());
                ((Obj_Machinery_Atmospherics_Pipe)P).update_node_icon();
                return(true);

                break;

            case -1:

                if (target is Obj_Item_Pipe || target is Obj_Item_PipeMeter || target is Obj_Structure_Disposalconstruct)
                {
                    user.WriteMsg("<span class='notice'>You start destroying pipe...</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1);

                    if (GlobalFuncs.do_after(user, 2, null, target))
                    {
                        this.activate();
                        GlobalFuncs.qdel(target);
                        return(true);
                    }
                    return(false);
                }
                user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!  Perhaps you need to only use it on pipes and pipe meters?</span>");
                return(false);

                break;

            case 0:

                if (!(target is Tile))
                {
                    user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>");
                    return(false);
                }
                user.WriteMsg("<span class='notice'>You start building pipes...</span>");
                GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1);

                if (GlobalFuncs.do_after(user, 2, null, target))
                {
                    this.activate();
                    P2         = new Obj_Item_Pipe(target, queued_p_type, queued_p_dir);
                    P2.flipped = queued_p_flipped;
                    P2.update();
                    P2.add_fingerprint(Task13.User);
                    return(true);
                }
                return(false);

                break;

            case 1:

                if (!(target is Tile))
                {
                    user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>");
                    return(false);
                }
                user.WriteMsg("<span class='notice'>You start building meter...</span>");
                GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1);

                if (GlobalFuncs.do_after(user, 2, null, target))
                {
                    this.activate();
                    new Obj_Item_PipeMeter(target);
                    return(true);
                }
                return(false);

                break;

            case 2:

                if (!(target is Tile) || GlobalFuncs.is_anchored_dense_turf(target))
                {
                    user.WriteMsg("<span class='warning'>The " + this + "'s error light flickers!</span>");
                    return(false);
                }
                user.WriteMsg("<span class='notice'>You start building pipes...</span>");
                GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/machines/click.ogg", 50, 1);

                if (GlobalFuncs.do_after(user, 20, null, target))
                {
                    C = new Obj_Structure_Disposalconstruct(target, queued_p_type, queued_p_dir);

                    if (!C.can_place())
                    {
                        user.WriteMsg("<span class='warning'>There's not enough room to build that here!</span>");
                        GlobalFuncs.qdel(C);
                        return(false);
                    }
                    this.activate();
                    C.add_fingerprint(Task13.User);
                    C.update();
                    return(true);
                }
                return(false);

                break;

            default:
                base.afterattack((object)(target), (object)(user), proximity_flag, click_parameters);
                return(false);

                break;
            }
            return(false);
        }