コード例 #1
0
        // Function from file: glass.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic CC = null;
            Obj_Item_Stack_LightW new_tile = null;
            dynamic V = null;
            Obj_Item_Stack_Sheet_Rglass RG = null;
            Obj_Item_Stack_Sheet_Glass  G  = null;
            bool replace = false;

            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            this.add_fingerprint(user);

            if (A is Obj_Item_Stack_CableCoil)
            {
                CC = A;

                if ((this.get_amount() ?? 0) < 1 || (((Obj_Item_Stack)CC).get_amount() ?? 0) < 5)
                {
                    user.WriteMsg("<span class='warning>You need five lengths of coil and one sheet of glass to make wired glass!</span>");
                    return(null);
                }
                CC.use(5);
                this.use(1);
                user.WriteMsg("<span class='notice'>You attach wire to the " + this.name + ".</span>");
                new_tile = new Obj_Item_Stack_LightW(user.loc);
                new_tile.add_fingerprint(user);
            }
            else if (A is Obj_Item_Stack_Rods)
            {
                V = A;

                if ((((Obj_Item_Stack)V).get_amount() ?? 0) >= 1 && (this.get_amount() ?? 0) >= 1)
                {
                    RG = new Obj_Item_Stack_Sheet_Rglass(user.loc);
                    RG.add_fingerprint(user);
                    G             = this;
                    Task13.Source = null;
                    replace       = ((Mob)user).get_inactive_hand() == G;
                    V.use(1);
                    G.use(1);

                    if (!(G != null) && replace)
                    {
                        ((Mob)user).put_in_hands(RG);
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need one rod and one sheet of glass to make reinforced glass!</span>");
                    return(null);
                }
            }
            else
            {
                return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
            }
            return(null);
        }
コード例 #2
0
        // Function from file: window.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic WT = null;
            Obj_Item_Stack_Sheet_Rglass RG = null;
            Obj_Item_Stack_Sheet_Glass  G  = null;


            if (!this.can_be_reached(user))
            {
                return(1);
            }
            this.add_fingerprint(user);

            if (A is Obj_Item_Weapon_Weldingtool && user.a_intent == "help")
            {
                WT = A;

                if (this.health < this.maxhealth)
                {
                    if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                    {
                        user.WriteMsg("<span class='notice'>You begin repairing " + this + "...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 40, 1);

                        if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                        {
                            this.health = this.maxhealth;
                            GlobalFuncs.playsound(this.loc, "sound/items/welder2.ogg", 50, 1);
                            this.update_nearby_icons();
                            user.WriteMsg("<span class='notice'>You repair " + this + ".</span>");
                        }
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>" + this + " is already in good condition!</span>");
                }
                return(null);
            }

            if (!Lang13.Bool(this.flags & 128))
            {
                if (A is Obj_Item_Weapon_Screwdriver)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 75, 1);

                    if (this.reinf == true && (this.state == 2 || this.state == 1))
                    {
                        user.WriteMsg((this.state == 2 ? "<span class='notice'>You begin to unscrew the window from the frame...</span>" : "<span class='notice'>You begin to screw the window to the frame...</span>"));
                    }
                    else if (this.reinf == true && this.state == 0)
                    {
                        user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You begin to unscrew the frame from the floor...</span>" : "<span class='notice'>You begin to screw the frame to the floor...</span>"));
                    }
                    else if (!(this.reinf == true))
                    {
                        user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You begin to unscrew the window from the floor...</span>" : "<span class='notice'>You begin to screw the window to the floor...</span>"));
                    }

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.reinf == true && (this.state == 1 || this.state == 2))
                        {
                            this.state = (this.state == 1 ? 2 : 1);
                            user.WriteMsg((this.state == 1 ? "<span class='notice'>You unfasten the window from the frame.</span>" : "<span class='notice'>You fasten the window to the frame.</span>"));
                        }
                        else if (this.reinf == true && this.state == 0)
                        {
                            this.anchored = !Lang13.Bool(this.anchored);
                            this.update_nearby_icons();
                            user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You fasten the frame to the floor.</span>" : "<span class='notice'>You unfasten the frame from the floor.</span>"));
                        }
                        else if (!(this.reinf == true))
                        {
                            this.anchored = !Lang13.Bool(this.anchored);
                            this.update_nearby_icons();
                            user.WriteMsg((Lang13.Bool(this.anchored) ? "<span class='notice'>You fasten the window to the floor.</span>" : "<span class='notice'>You unfasten the window.</span>"));
                        }
                    }
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Crowbar && this.reinf == true && (this.state == 0 || this.state == 1))
                {
                    user.WriteMsg((this.state == 0 ? "<span class='notice'>You begin to lever the window into the frame...</span>" : "<span class='notice'>You begin to lever the window out of the frame...</span>"));
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 75, 1);

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        this.state = (this.state == 0 ? true : false);
                        user.WriteMsg((this.state == 1 ? "<span class='notice'>You pry the window into the frame.</span>" : "<span class='notice'>You pry the window out of the frame.</span>"));
                    }
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Wrench && !Lang13.Bool(this.anchored))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 75, 1);
                    user.WriteMsg("<span class='notice'> You begin to disassemble " + this + "...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.disassembled)
                        {
                            return(null);
                        }

                        if (this.reinf == true)
                        {
                            RG = new Obj_Item_Stack_Sheet_Rglass(user.loc);
                            RG.add_fingerprint(user);

                            if (this.fulltile)
                            {
                                RG = new Obj_Item_Stack_Sheet_Rglass(user.loc);
                                RG.add_fingerprint(user);
                            }
                        }
                        else
                        {
                            G = new Obj_Item_Stack_Sheet_Glass(user.loc);
                            G.add_fingerprint(user);

                            if (this.fulltile)
                            {
                                G = new Obj_Item_Stack_Sheet_Glass(user.loc);
                                G.add_fingerprint(user);
                            }
                        }
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        this.disassembled = true;
                        user.WriteMsg("<span class='notice'>You successfully disassemble " + this + ".</span>");
                        GlobalFuncs.qdel(this);
                    }
                    return(null);
                }
            }

            if (A is Obj_Item_Weapon_Rcd)
            {
                return(null);
            }

            if (A.damtype == "brute" || A.damtype == "fire")
            {
                ((Mob)user).changeNext_move(8);
                this.hit(A.force);
            }
            else
            {
                GlobalFuncs.playsound(this.loc, "sound/effects/Glasshit.ogg", 75, 1);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
コード例 #3
0
        // Function from file: windoor_assembly.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic WT = null;
            Obj_Item_Stack_Sheet_Rglass RG  = null;
            Obj_Item_Stack_Rods         R   = null;
            Obj_Machinery_Door_Window   WD  = null;
            Obj_Machinery_Door_Window   WD2 = null;
            dynamic P  = null;
            dynamic CC = null;
            dynamic ae = null;
            string  t  = null;
            Obj_Machinery_Door_Window_Brigdoor windoor  = null;
            Obj_Machinery_Door_Window          windoor2 = null;

            this.add_fingerprint(user);

            switch ((string)(this.state))
            {
            case "01":

                if (A is Obj_Item_Weapon_Weldingtool && !Lang13.Bool(this.anchored))
                {
                    WT = A;

                    if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                    {
                        ((Ent_Static)user).visible_message("" + user + " disassembles the windoor assembly.", "<span class='notice'>You start to disassemble the windoor assembly...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/items/welder2.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                        {
                            if (!(this != null) || !((Obj_Item_Weapon_Weldingtool)WT).isOn())
                            {
                                return(null);
                            }
                            user.WriteMsg("<span class='notice'>You disassemble the windoor assembly.</span>");
                            RG = new Obj_Item_Stack_Sheet_Rglass(GlobalFuncs.get_turf(this), 5);
                            RG.add_fingerprint(user);

                            if (this.secure)
                            {
                                R = new Obj_Item_Stack_Rods(GlobalFuncs.get_turf(this), 4);
                                R.add_fingerprint(user);
                            }
                            GlobalFuncs.qdel(this);
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }

                if (A is Obj_Item_Weapon_Wrench && !Lang13.Bool(this.anchored))
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Machinery_Door_Window)))
                    {
                        WD = _a;


                        if (WD.dir == this.dir)
                        {
                            user.WriteMsg("<span class='warning'>There is already a windoor in that location!</span>");
                            return(null);
                        }
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " secures the windoor assembly to the floor.", "<span class='notice'>You start to secure the windoor assembly to the floor...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || Lang13.Bool(this.anchored))
                        {
                            return(null);
                        }

                        foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Obj_Machinery_Door_Window)))
                        {
                            WD2 = _b;


                            if (WD2.dir == this.dir)
                            {
                                user.WriteMsg("<span class='warning'>There is already a windoor in that location!</span>");
                                return(null);
                            }
                        }
                        user.WriteMsg("<span class='notice'>You secure the windoor assembly.</span>");
                        this.anchored = 1;

                        if (this.secure)
                        {
                            this.name = "secure anchored windoor assembly";
                        }
                        else
                        {
                            this.name = "anchored windoor assembly";
                        }
                    }
                }
                else if (A is Obj_Item_Weapon_Wrench && Lang13.Bool(this.anchored))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " unsecures the windoor assembly to the floor.", "<span class='notice'>You start to unsecure the windoor assembly to the floor...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || !Lang13.Bool(this.anchored))
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You unsecure the windoor assembly.</span>");
                        this.anchored = 0;

                        if (this.secure)
                        {
                            this.name = "secure windoor assembly";
                        }
                        else
                        {
                            this.name = "windoor assembly";
                        }
                    }
                }
                else if (A is Obj_Item_Stack_Sheet_Plasteel && !this.secure)
                {
                    P = A;

                    if (Convert.ToDouble(P.amount) < 2)
                    {
                        user.WriteMsg("<span class='warning'>You need more plasteel to do this!</span>");
                        return(null);
                    }
                    user.WriteMsg("<span class='notice'>You start to reinforce the windoor with plasteel...</span>");

                    if (GlobalFuncs.do_after(user, 40, null, this))
                    {
                        if (!(this != null) || this.secure)
                        {
                            return(null);
                        }
                        P.use(2);
                        user.WriteMsg("<span class='notice'>You reinforce the windoor.</span>");
                        this.secure = true;

                        if (Lang13.Bool(this.anchored))
                        {
                            this.name = "secure anchored windoor assembly";
                        }
                        else
                        {
                            this.name = "secure windoor assembly";
                        }
                    }
                }
                else if (A is Obj_Item_Stack_CableCoil && Lang13.Bool(this.anchored))
                {
                    ((Ent_Static)user).visible_message("" + user + " wires the windoor assembly.", "<span class='notice'>You start to wire the windoor assembly...</span>");

                    if (GlobalFuncs.do_after(user, 40, null, this))
                    {
                        if (!(this != null) || !Lang13.Bool(this.anchored) || this.state != "01")
                        {
                            return(null);
                        }
                        CC = A;

                        if (!Lang13.Bool(CC.use(1)))
                        {
                            user.WriteMsg("<span class='warning'>You need more cable to do this!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You wire the windoor.</span>");
                        this.state = "02";

                        if (this.secure)
                        {
                            this.name = "secure wired windoor assembly";
                        }
                        else
                        {
                            this.name = "wired windoor assembly";
                        }
                    }
                }
                else
                {
                    base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
                }
                break;

            case "02":

                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " cuts the wires from the airlock assembly.", "<span class='notice'>You start to cut the wires from airlock assembly...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || this.state != "02")
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You cut the windoor wires.</span>");
                        new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(user), 1);
                        this.state = "01";

                        if (this.secure)
                        {
                            this.name = "secure anchored windoor assembly";
                        }
                        else
                        {
                            this.name = "anchored windoor assembly";
                        }
                    }
                }
                else if (A is Obj_Item_Weapon_Electronics_Airlock)
                {
                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " installs the electronics into the airlock assembly.", "<span class='notice'>You start to install electronics into the airlock assembly...</span>");
                    A.loc = this;

                    if (GlobalFuncs.do_after(user, 40, null, this))
                    {
                        if (!(this != null) || Lang13.Bool(this.electronics))
                        {
                            A.loc = this.loc;
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You install the airlock electronics.</span>");
                        this.name        = "near finished windoor assembly";
                        this.electronics = A;
                    }
                    else
                    {
                        A.loc = this.loc;
                    }
                }
                else if (A is Obj_Item_Weapon_Screwdriver)
                {
                    if (!Lang13.Bool(this.electronics))
                    {
                        return(null);
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " removes the electronics from the airlock assembly.", "<span class='notice'>You start to uninstall electronics from the airlock assembly...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || !Lang13.Bool(this.electronics))
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You remove the airlock electronics.</span>");
                        this.name        = "wired windoor assembly";
                        ae               = null;
                        ae               = this.electronics;
                        this.electronics = null;
                        ae.loc           = this.loc;
                    }
                }
                else if (A is Obj_Item_Weapon_Pen)
                {
                    t = GlobalFuncs.stripped_input(user, "Enter the name for the door.", this.name, this.created_name, 26);

                    if (!Lang13.Bool(t))
                    {
                        return(null);
                    }

                    if (!(Map13.GetDistance(this, Task13.User) <= 1) && this.loc != Task13.User)
                    {
                        return(null);
                    }
                    this.created_name = t;
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Crowbar)
                {
                    if (!Lang13.Bool(this.electronics))
                    {
                        Task13.User.WriteMsg("<span class='warning'>The assembly is missing electronics!</span>");
                        return(null);
                    }
                    Interface13.Browse(Task13.User, null, "window=windoor_access");
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " pries the windoor into the frame.", "<span class='notice'>You start prying the windoor into the frame...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.loc != null && Lang13.Bool(this.electronics))
                        {
                            this.density = true;
                            user.WriteMsg("<span class='notice'>You finish the windoor.</span>");

                            if (this.secure)
                            {
                                windoor = new Obj_Machinery_Door_Window_Brigdoor(this.loc);

                                if (this.facing == "l")
                                {
                                    windoor.icon_state = "leftsecureopen";
                                    windoor.base_state = "leftsecure";
                                }
                                else
                                {
                                    windoor.icon_state = "rightsecureopen";
                                    windoor.base_state = "rightsecure";
                                }
                                windoor.dir     = this.dir;
                                windoor.density = false;

                                if (this.electronics.one_access)
                                {
                                    windoor.req_one_access = this.electronics.accesses;
                                }
                                else
                                {
                                    windoor.req_access = this.electronics.accesses;
                                }
                                windoor.electronics  = this.electronics;
                                this.electronics.loc = windoor;

                                if (Lang13.Bool(this.created_name))
                                {
                                    windoor.name = this.created_name;
                                }
                                GlobalFuncs.qdel(this);
                                windoor.close();
                            }
                            else
                            {
                                windoor2 = new Obj_Machinery_Door_Window(this.loc);

                                if (this.facing == "l")
                                {
                                    windoor2.icon_state = "leftopen";
                                    windoor2.base_state = "left";
                                }
                                else
                                {
                                    windoor2.icon_state = "rightopen";
                                    windoor2.base_state = "right";
                                }
                                windoor2.dir         = this.dir;
                                windoor2.density     = false;
                                windoor2.req_access  = this.electronics.accesses;
                                windoor2.electronics = this.electronics;
                                this.electronics.loc = windoor2;

                                if (Lang13.Bool(this.created_name))
                                {
                                    windoor2.name = this.created_name;
                                }
                                GlobalFuncs.qdel(this);
                                windoor2.close();
                            }
                        }
                    }
                }
                else
                {
                    base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
                }
                break;
            }
            this.update_icon();
            return(null);
        }