예제 #1
0
        // Function from file: rods.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_Metal new_item = null;
            Obj_Item_Stack_Rods        R        = null;
            bool    replace = false;
            dynamic S       = null;
            Obj_Item_Weapon_ReagentContainers_Food_Snacks_Customizable_Kebab A2 = null;


            if (A is Obj_Item_Weapon_Weldingtool)
            {
                WT = A;

                if ((this.get_amount() ?? 0) < 2)
                {
                    user.WriteMsg("<span class='warning'>You need at least two rods to do this!</span>");
                    return(null);
                }

                if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                {
                    new_item = new Obj_Item_Stack_Sheet_Metal(Task13.User.loc);
                    ((Ent_Static)user).visible_message("" + user.name + " shaped " + this + " into metal with the welding tool.", "<span class='notice'>You shape " + this + " into metal with the welding tool.</span>", "<span class='italics'>You hear welding.</span>");
                    R             = this;
                    Task13.Source = null;
                    replace       = ((Mob)user).get_inactive_hand() == R;
                    R.use(2);

                    if (!(R != null) && replace)
                    {
                        ((Mob)user).put_in_hands(new_item);
                    }
                }
                return(null);
            }

            if (A is Obj_Item_Weapon_ReagentContainers_Food_Snacks)
            {
                S = A;

                if (this.amount != 1)
                {
                    user.WriteMsg("<span class='warning'>You must use a single rod!</span>");
                }
                else if (Convert.ToDouble(S.w_class) > 2)
                {
                    user.WriteMsg("<span class='warning'>The ingredient is too big for " + this + "!</span>");
                }
                else
                {
                    A2 = new Obj_Item_Weapon_ReagentContainers_Food_Snacks_Customizable_Kebab(GlobalFuncs.get_turf(this));
                    A2.initialize_custom_food(this, S, user);
                }
                return(null);
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
예제 #2
0
        // Function from file: slime_extracts.dm
        public override void on_reaction(Reagents holder = null, double?created_volume = null)
        {
            Obj_Item_Stack_Sheet_Metal    M = null;
            Obj_Item_Stack_Sheet_Plasteel P = null;

            GlobalFuncs.feedback_add_details("slime_cores_used", "" + this.type);
            M        = new Obj_Item_Stack_Sheet_Metal();
            M.amount = 15;
            M.loc    = GlobalFuncs.get_turf(holder.my_atom);
            P        = new Obj_Item_Stack_Sheet_Plasteel();
            P.amount = 5;
            P.loc    = GlobalFuncs.get_turf(holder.my_atom);
            return;
        }
예제 #3
0
        // Function from file: swarmer.dm
        public void DismantleMachine(Obj_Machinery target = null)
        {
            dynamic D = null;
            Obj_Item_Stack_Sheet_Metal M = null;
            Obj_Item      I = null;
            dynamic       N = null;
            Obj_Machinery C = null;

            this.do_attack_animation(target);
            this.WriteMsg("<span class='info'>We begin to dismantle this machine. We will need to be uninterrupted.</span>");
            D         = GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Swarmer_Dismantle), GlobalFuncs.get_turf(target));
            D.pixel_x = target.pixel_x;
            D.pixel_y = target.pixel_y;
            D.pixel_z = target.pixel_z;

            if (GlobalFuncs.do_mob(this, target, 100))
            {
                this.WriteMsg("<span class='info'>Dismantling complete.</span>");
                M        = new Obj_Item_Stack_Sheet_Metal(target.loc);
                M.amount = 5;

                foreach (dynamic _a in Lang13.Enumerate(target.component_parts, typeof(Obj_Item)))
                {
                    I = _a;

                    I.loc = M.loc;
                }
                N         = GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Swarmer_Disintegration), GlobalFuncs.get_turf(target));
                N.pixel_x = target.pixel_x;
                N.pixel_y = target.pixel_y;
                N.pixel_z = target.pixel_z;
                target.dropContents();

                if (target is Obj_Machinery_Computer)
                {
                    C = target;

                    if (Lang13.Bool(((dynamic)C).circuit))
                    {
                        ((dynamic)C).circuit.loc = M.loc;
                    }
                }
                GlobalFuncs.qdel(target);
            }
            return;
        }
        // Function from file: mecha_construction_paths.dm
        public override bool custom_action(int?index = null, dynamic diff = null, dynamic used_atom = null, dynamic user = null)
        {
            Obj_Item_Stack_CableCoil      coil = null;
            Obj_Item_Stack_Sheet_Metal    MS   = null;
            Obj_Item_Stack_Sheet_Plasteel MS2  = null;


            if (!base.custom_action(index, (object)(diff), (object)(used_atom), (object)(user)))
            {
                return(false);
            }

            switch ((int?)(index))
            {
            case 14:
                ((Ent_Static)user).visible_message("" + user + " connects the " + this.holder + " hydraulic systems", "<span class='notice'>You connect the " + this.holder + " hydraulic systems.</span>");
                ((dynamic)this.holder).icon_state = "ripley1";
                break;

            case 13:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " activates the " + this.holder + " hydraulic systems.", "<span class='notice'>You activate the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "ripley2";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disconnects the " + this.holder + " hydraulic systems", "<span class='notice'>You disconnect the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "ripley0";
                }
                break;

            case 12:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " adds the wiring to the " + this.holder + ".", "<span class='notice'>You add the wiring to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley3";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " deactivates the " + this.holder + " hydraulic systems.", "<span class='notice'>You deactivate the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "ripley1";
                }
                break;

            case 11:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " adjusts the wiring of the " + this.holder + ".", "<span class='notice'>You adjust the wiring of the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley4";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the wiring from the " + this.holder + ".", "<span class='notice'>You remove the wiring from the " + this.holder + ".</span>");
                    coil        = new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(this.holder));
                    coil.amount = 4;
                    ((dynamic)this.holder).icon_state = "ripley2";
                }
                break;

            case 10:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the central control module into the " + this.holder + ".", "<span class='notice'>You install the central computer mainboard into the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "ripley5";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disconnects the wiring of the " + this.holder + ".", "<span class='notice'>You disconnect the wiring of the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley3";
                }
                break;

            case 9:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the mainboard.", "<span class='notice'>You secure the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "ripley6";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the central control module from the " + this.holder + ".", "<span class='notice'>You remove the central computer mainboard from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Circuitboard_Mecha_Ripley_Main(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "ripley4";
                }
                break;

            case 8:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the peripherals control module into the " + this.holder + ".", "<span class='notice'>You install the peripherals control module into the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "ripley7";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the mainboard.", "<span class='notice'>You unfasten the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "ripley5";
                }
                break;

            case 7:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the peripherals control module.", "<span class='notice'>You secure the peripherals control module.</span>");
                    ((dynamic)this.holder).icon_state = "ripley8";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the peripherals control module from the " + this.holder + ".", "<span class='notice'>You remove the peripherals control module from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Circuitboard_Mecha_Ripley_Peripherals(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "ripley6";
                }
                break;

            case 6:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the internal armor layer to the " + this.holder + ".", "<span class='notice'>You install the internal armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley9";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the peripherals control module.", "<span class='notice'>You unfasten the peripherals control module.</span>");
                    ((dynamic)this.holder).icon_state = "ripley7";
                }
                break;

            case 5:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the internal armor layer.", "<span class='notice'>You secure the internal armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "ripley10";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " pries internal armor layer from the " + this.holder + ".", "<span class='notice'>You pry internal armor layer from the " + this.holder + ".</span>");
                    MS        = new Obj_Item_Stack_Sheet_Metal(GlobalFuncs.get_turf(this.holder));
                    MS.amount = 5;
                    ((dynamic)this.holder).icon_state = "ripley8";
                }
                break;

            case 4:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " welds the internal armor layer to the " + this.holder + ".", "<span class='notice'>You weld the internal armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley11";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the internal armor layer.", "<span class='notice'>You unfasten the internal armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "ripley9";
                }
                break;

            case 3:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the external reinforced armor layer to the " + this.holder + ".", "<span class='notice'>You install the external reinforced armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley12";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " cuts the internal armor layer from the " + this.holder + ".", "<span class='notice'>You cut the internal armor layer from the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "ripley10";
                }
                break;

            case 2:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the external armor layer.", "<span class='notice'>You secure the external reinforced armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "ripley13";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " pries external armor layer from the " + this.holder + ".", "<span class='notice'>You pry external armor layer from the " + this.holder + ".</span>");
                    MS2        = new Obj_Item_Stack_Sheet_Plasteel(GlobalFuncs.get_turf(this.holder));
                    MS2.amount = 5;
                    ((dynamic)this.holder).icon_state = "ripley11";
                }
                break;

            case 1:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " welds the external armor layer to the " + this.holder + ".", "<span class='notice'>You weld the external armor layer to the " + this.holder + ".</span>");
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the external armor layer.", "<span class='notice'>You unfasten the external armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "ripley12";
                }
                break;
            }
            return(true);
        }
예제 #5
0
        // Function from file: buildandrepair.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_Metal M = null;
            dynamic B = null;
            dynamic C = null;
            Obj_Item_Stack_CableCoil A2 = null;
            dynamic G = null;
            Obj_Item_Stack_Sheet_Glass G2 = null;
            dynamic B2 = null;

            this.add_fingerprint(user);

            switch ((int)(this.state))
            {
            case 0:

                if (A is Obj_Item_Weapon_Wrench)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You start wrenching the frame into place...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You wrench the frame into place.</span>");
                        this.anchored = 1;
                        this.state    = 1;
                    }
                }

                if (A is Obj_Item_Weapon_Weldingtool)
                {
                    WT = A;

                    if (!((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                    {
                        if (!((Obj_Item_Weapon_Weldingtool)WT).isOn())
                        {
                            user.WriteMsg("<span class='warning'>The welding tool must be on to complete this task!</span>");
                        }
                        return(null);
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You start deconstructing the frame...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || !((Obj_Item_Weapon_Weldingtool)WT).isOn())
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You deconstruct the frame.</span>");
                        M = new Obj_Item_Stack_Sheet_Metal(this.loc, 5);
                        M.add_fingerprint(user);
                        GlobalFuncs.qdel(this);
                    }
                }
                break;

            case 1:

                if (A is Obj_Item_Weapon_Wrench)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You start to unfasten the frame...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You unfasten the frame.</span>");
                        this.anchored = 0;
                        this.state    = 0;
                    }
                }

                if (A is Obj_Item_Weapon_Circuitboard && !Lang13.Bool(this.circuit))
                {
                    B = A;

                    if (B.board_type == "computer")
                    {
                        if (!Lang13.Bool(user.drop_item()))
                        {
                            return(null);
                        }
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        user.WriteMsg("<span class='notice'>You place the circuit board inside the frame.</span>");
                        this.icon_state = "1";
                        this.circuit    = A;
                        ((Ent_Static)this.circuit).add_fingerprint(user);
                        A.loc = null;
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>This frame does not accept circuit boards of this type!</span>");
                    }
                }

                if (A is Obj_Item_Weapon_Screwdriver && Lang13.Bool(this.circuit))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You screw the circuit board into place.</span>");
                    this.state      = 2;
                    this.icon_state = "2";
                }

                if (A is Obj_Item_Weapon_Crowbar && Lang13.Bool(this.circuit))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You remove the circuit board.</span>");
                    this.state       = 1;
                    this.icon_state  = "0";
                    this.circuit.loc = this.loc;
                    ((Ent_Static)this.circuit).add_fingerprint(user);
                    this.circuit = null;
                }
                break;

            case 2:

                if (A is Obj_Item_Weapon_Screwdriver && Lang13.Bool(this.circuit))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You unfasten the circuit board.</span>");
                    this.state      = 1;
                    this.icon_state = "1";
                }

                if (A is Obj_Item_Stack_CableCoil)
                {
                    C = A;

                    if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5)
                    {
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        user.WriteMsg("<span class='notice'>You start adding cables to the frame...</span>");

                        if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                        {
                            if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5 && this.state == 2)
                            {
                                C.use(5);
                                user.WriteMsg("<span class='notice'>You add cables to the frame.</span>");
                                this.state      = 3;
                                this.icon_state = "3";
                            }
                        }
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>You need five lengths of cable to wire the frame!</span>");
                    }
                }
                break;

            case 3:

                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You remove the cables.</span>");
                    this.state      = 2;
                    this.icon_state = "2";
                    A2        = new Obj_Item_Stack_CableCoil(this.loc);
                    A2.amount = 5;
                    A2.add_fingerprint(user);
                }

                if (A is Obj_Item_Stack_Sheet_Glass)
                {
                    G = A;

                    if ((((Obj_Item_Stack)G).get_amount() ?? 0) < 2)
                    {
                        user.WriteMsg("<span class='warning'>You need two glass sheets to continue construction!</span>");
                        return(null);
                    }
                    else
                    {
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        user.WriteMsg("<span class='notice'>You start to put in the glass panel...</span>");

                        if (GlobalFuncs.do_after(user, 20, null, this))
                        {
                            if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 2 && this.state == 3)
                            {
                                G.use(2);
                                user.WriteMsg("<span class='notice'>You put in the glass panel.</span>");
                                this.state      = 4;
                                this.icon_state = "4";
                            }
                        }
                    }
                }
                break;

            case 4:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You remove the glass panel.</span>");
                    this.state      = 3;
                    this.icon_state = "3";
                    G2 = new Obj_Item_Stack_Sheet_Glass(this.loc, 2);
                    G2.add_fingerprint(user);
                }

                if (A is Obj_Item_Weapon_Screwdriver)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You connect the monitor.</span>");
                    B2 = Lang13.Call(this.circuit.build_path, this.loc, this.circuit);
                    this.transfer_fingerprints_to(B2);
                    GlobalFuncs.qdel(this);
                }
                break;
            }
            return(null);
        }
        // Function from file: constructable_frame.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic C = null;
            Obj_Item_Stack_Sheet_Metal M = null;
            dynamic B = null;
            Obj_Item_Stack_CableCoil A2 = null;
            Ent_Dynamic A3 = null;
            bool        component_check = false;
            dynamic     R                 = null;
            dynamic     new_machine       = null;
            Obj         O                 = null;
            Obj         O2                = null;
            dynamic     replacer          = null;
            ByTable     added_components  = null;
            dynamic     part_list         = null;
            Obj_Item_Weapon_StockParts co = null;
            dynamic path = null;
            dynamic part = null;
            Obj_Item_Weapon_StockParts part2 = null;
            dynamic I                   = null;
            dynamic CP                  = null;
            dynamic cable_color         = null;
            Obj_Item_Stack_CableCoil CC = null;


            if (A.crit_fail)
            {
                user.WriteMsg("<span class='warning'>This part is faulty, you cannot add this to the machine!</span>");
                return(null);
            }

            switch ((int)(this.state))
            {
            case 1:

                if (A is Obj_Item_Weapon_Circuitboard)
                {
                    user.WriteMsg("<span class='warning'>The frame needs wiring first!</span>");
                    return(null);
                }

                if (A is Obj_Item_Stack_CableCoil)
                {
                    C = A;

                    if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5)
                    {
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        user.WriteMsg("<span class='notice'>You start to add cables to the frame...</span>");

                        if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                        {
                            if ((((Obj_Item_Stack)C).get_amount() ?? 0) >= 5 && this.state == 1)
                            {
                                C.use(5);
                                user.WriteMsg("<span class='notice'>You add cables to the frame.</span>");
                                this.state      = 2;
                                this.icon_state = "box_1";
                            }
                        }
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>You need five length of cable to wire the frame!</span>");
                        return(null);
                    }
                }

                if (A is Obj_Item_Weapon_Screwdriver && !Lang13.Bool(this.anchored))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                    ((Ent_Static)user).visible_message("<span class='warning'>" + user + " disassembles the frame.</span>", "<span class='notice'>You start to disassemble the frame...</span>", "You hear banging and clanking.");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.state == 1)
                        {
                            user.WriteMsg("<span class='notice'>You disassemble the frame.</span>");
                            M = new Obj_Item_Stack_Sheet_Metal(this.loc, 5);
                            M.add_fingerprint(user);
                            GlobalFuncs.qdel(this);
                        }
                    }
                }

                if (A is Obj_Item_Weapon_Wrench)
                {
                    user.WriteMsg("<span class='notice'>You start " + (Lang13.Bool(this.anchored) ? "un" : "") + "securing " + this.name + "...</span>");
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 75, 1);

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.state == 1)
                        {
                            user.WriteMsg("<span class='notice'>You " + (Lang13.Bool(this.anchored) ? "un" : "") + "secure " + this.name + ".</span>");
                            this.anchored = !Lang13.Bool(this.anchored);
                        }
                    }
                }
                break;

            case 2:

                if (A is Obj_Item_Weapon_Wrench)
                {
                    user.WriteMsg("<span class='notice'>You start " + (Lang13.Bool(this.anchored) ? "un" : "") + "securing " + this.name + "...</span>");
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 75, 1);

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You " + (Lang13.Bool(this.anchored) ? "un" : "") + "secure " + this.name + ".</span>");
                        this.anchored = !Lang13.Bool(this.anchored);
                    }
                }

                if (A is Obj_Item_Weapon_Circuitboard)
                {
                    if (!Lang13.Bool(this.anchored))
                    {
                        user.WriteMsg("<span class='warning'>The frame needs to be secured first!</span>");
                        return(null);
                    }
                    B = A;

                    if (B.board_type == "machine")
                    {
                        if (!Lang13.Bool(user.drop_item()))
                        {
                            return(null);
                        }
                        GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                        user.WriteMsg("<span class='notice'>You add the circuit board to the frame.</span>");
                        this.circuit        = A;
                        A.loc               = this;
                        this.icon_state     = "box_2";
                        this.state          = 3;
                        this.components     = new ByTable();
                        this.req_components = this.circuit.req_components.Copy();
                        this.update_namelist();
                        this.update_req_desc();
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>This frame does not accept circuit boards of this type!</span>");
                    }
                }

                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You remove the cables.</span>");
                    this.state      = 1;
                    this.icon_state = "box_0";
                    A2        = new Obj_Item_Stack_CableCoil(this.loc);
                    A2.amount = 5;
                }
                break;

            case 3:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);
                    this.state       = 2;
                    this.circuit.loc = this.loc;
                    this.components.Remove(this.circuit);
                    this.circuit = null;

                    if (this.components.len == 0)
                    {
                        user.WriteMsg("<span class='notice'>You remove the circuit board.</span>");
                    }
                    else
                    {
                        user.WriteMsg("<span class='notice'>You remove the circuit board and other components.</span>");

                        foreach (dynamic _a in Lang13.Enumerate(this.components, typeof(Ent_Dynamic)))
                        {
                            A3 = _a;

                            A3.loc = this.loc;
                        }
                    }
                    this.desc           = Lang13.Initial(this, "desc");
                    this.req_components = null;
                    this.components     = null;
                    this.icon_state     = "box_1";
                }

                if (A is Obj_Item_Weapon_Screwdriver)
                {
                    component_check = true;

                    foreach (dynamic _b in Lang13.Enumerate(this.req_components))
                    {
                        R = _b;


                        if (Convert.ToDouble(this.req_components[R]) > 0)
                        {
                            component_check = false;
                            break;
                        }
                    }

                    if (component_check)
                    {
                        GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                        new_machine = Lang13.Call(this.circuit.build_path, this.loc, 1);
                        ((Obj_Machinery)new_machine).construction();

                        foreach (dynamic _c in Lang13.Enumerate(new_machine.component_parts, typeof(Obj)))
                        {
                            O = _c;

                            GlobalFuncs.qdel(O);
                        }
                        new_machine.component_parts = new ByTable();

                        foreach (dynamic _d in Lang13.Enumerate(this, typeof(Obj)))
                        {
                            O2 = _d;

                            O2.loc = null;
                            new_machine.component_parts.Add(O2);
                        }
                        this.circuit.loc = null;
                        ((Obj_Machinery)new_machine).RefreshParts();
                        GlobalFuncs.qdel(this);
                    }
                }

                if (A is Obj_Item_Weapon_Storage_PartReplacer && A.contents.len != 0 && this.get_req_components_amt() != 0)
                {
                    replacer         = A;
                    added_components = new ByTable();
                    part_list        = new ByTable();

                    foreach (dynamic _e in Lang13.Enumerate(replacer, typeof(Obj_Item_Weapon_StockParts)))
                    {
                        co = _e;

                        part_list += co;
                    }
                    part_list = GlobalFuncs.sortTim(part_list, typeof(GlobalFuncs).GetMethod("cmp_rped_sort"));

                    foreach (dynamic _f in Lang13.Enumerate(this.req_components))
                    {
                        path = _f;


                        while (Convert.ToDouble(this.req_components[path]) > 0 && Lang13.Bool(Lang13.FindIn(path, part_list)))
                        {
                            part = Lang13.FindIn(path, part_list);

                            if (!part.crit_fail)
                            {
                                added_components[part] = path;
                                ((Obj_Item_Weapon_Storage)replacer).remove_from_storage(part, this);
                                this.req_components[path]--;
                                part_list -= part;
                            }
                        }
                    }

                    foreach (dynamic _g in Lang13.Enumerate(added_components, typeof(Obj_Item_Weapon_StockParts)))
                    {
                        part2 = _g;

                        this.components.Add(part2);
                        user.WriteMsg("<span class='notice'>" + part2.name + " applied.</span>");
                    }
                    ((Obj_Item_Weapon_Storage_PartReplacer)replacer).play_rped_sound();
                    this.update_req_desc();
                    return(null);
                }

                if (A is Obj_Item && this.get_req_components_amt() != 0)
                {
                    foreach (dynamic _h in Lang13.Enumerate(this.req_components))
                    {
                        I = _h;


                        if (Lang13.Bool(I.IsInstanceOfType(A)) && Convert.ToDouble(this.req_components[I]) > 0)
                        {
                            if (A is Obj_Item_Stack_CableCoil)
                            {
                                CP          = A;
                                cable_color = CP.item_color;

                                if (Lang13.Bool(CP.use(1)))
                                {
                                    CC = new Obj_Item_Stack_CableCoil(this, 1, cable_color);
                                    this.components.Add(CC);
                                    this.req_components[I]--;
                                    this.update_req_desc();
                                }
                                else
                                {
                                    user.WriteMsg("<span class='warning'>You need more cable!</span>");
                                }
                                return(null);
                            }

                            if (!Lang13.Bool(user.drop_item()))
                            {
                                break;
                            }
                            A.loc = this;
                            this.components.Add(A);
                            this.req_components[I]--;
                            this.update_req_desc();
                            return(1);
                        }
                    }
                    user.WriteMsg("<span class='warning'>You cannot add that to the machine!</span>");
                    return(0);
                }
                break;
            }
            return(null);
        }
        // Function from file: mecha_construction_paths.dm
        public override bool custom_action(int?index = null, dynamic diff = null, dynamic used_atom = null, dynamic user = null)
        {
            Obj_Item_Stack_CableCoil coil = null;
            dynamic I  = null;
            dynamic I2 = null;
            dynamic I3 = null;
            dynamic I4 = null;
            Obj_Item_Stack_Sheet_Metal MS = null;


            if (!base.custom_action(index, (object)(diff), (object)(used_atom), (object)(user)))
            {
                return(false);
            }

            switch ((int?)(index))
            {
            case 20:
                ((Ent_Static)user).visible_message("" + user + " connects the " + this.holder + " hydraulic systems", "<span class='notice'>You connect the " + this.holder + " hydraulic systems.</span>");
                ((dynamic)this.holder).icon_state = "durand1";
                break;

            case 19:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " activates the " + this.holder + " hydraulic systems.", "<span class='notice'>You activate the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "durand2";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disconnects the " + this.holder + " hydraulic systems", "<span class='notice'>You disconnect the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "durand0";
                }
                break;

            case 18:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " adds the wiring to the " + this.holder + ".", "<span class='notice'>You add the wiring to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand3";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " deactivates the " + this.holder + " hydraulic systems.", "<span class='notice'>You deactivate the " + this.holder + " hydraulic systems.</span>");
                    ((dynamic)this.holder).icon_state = "durand1";
                }
                break;

            case 17:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " adjusts the wiring of the " + this.holder + ".", "<span class='notice'>You adjust the wiring of the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand4";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the wiring from the " + this.holder + ".", "<span class='notice'>You remove the wiring from the " + this.holder + ".</span>");
                    coil        = new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(this.holder));
                    coil.amount = 4;
                    ((dynamic)this.holder).icon_state = "durand2";
                }
                break;

            case 16:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the central control module into the " + this.holder + ".", "<span class='notice'>You install the central computer mainboard into the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "durand5";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disconnects the wiring of the " + this.holder + ".", "<span class='notice'>You disconnect the wiring of the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand3";
                }
                break;

            case 15:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the mainboard.", "<span class='notice'>You secure the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "durand6";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the central control module from the " + this.holder + ".", "<span class='notice'>You remove the central computer mainboard from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Circuitboard_Mecha_Durand_Main(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "durand4";
                }
                break;

            case 14:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the peripherals control module into the " + this.holder + ".", "<span class='notice'>You install the peripherals control module into the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "durand7";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the mainboard.", "<span class='notice'>You unfasten the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "durand5";
                }
                break;

            case 13:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the peripherals control module.", "<span class='notice'>You secure the peripherals control module.</span>");
                    ((dynamic)this.holder).icon_state = "durand8";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the peripherals control module from the " + this.holder + ".", "<span class='notice'>You remove the peripherals control module from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Circuitboard_Mecha_Durand_Peripherals(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "durand6";
                }
                break;

            case 12:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the weapon control module into the " + this.holder + ".", "<span class='notice'>You install the weapon control module into the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "durand9";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the peripherals control module.", "<span class='notice'>You unfasten the peripherals control module.</span>");
                    ((dynamic)this.holder).icon_state = "durand7";
                }
                break;

            case 11:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the weapon control module.", "<span class='notice'>You secure the weapon control module.</span>");
                    ((dynamic)this.holder).icon_state = "durand10";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the weapon control module from the " + this.holder + ".", "<span class='notice'>You remove the weapon control module from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Circuitboard_Mecha_Durand_Targeting(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "durand8";
                }
                break;

            case 10:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs scanner module to the " + this.holder + ".", "<span class='notice'>You install phasic scanner module to the " + this.holder + ".</span>");
                    I = used_atom;
                    ((Mob)user).unEquip(I);
                    I.loc = this.holder;
                    ((dynamic)this.holder).icon_state = "durand11";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the weapon control module.", "<span class='notice'>You unfasten the weapon control module.</span>");
                    ((dynamic)this.holder).icon_state = "durand9";
                }
                break;

            case 9:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the scanner module.", "<span class='notice'>You secure the scanner module.</span>");
                    ((dynamic)this.holder).icon_state = "durand12";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the scanner module from the " + this.holder + ".", "<span class='notice'>You remove the scanner module from the " + this.holder + ".</span>");
                    I2     = Lang13.FindIn(typeof(Obj_Item_Weapon_StockParts_ScanningModule), this.holder);
                    I2.loc = GlobalFuncs.get_turf(this.holder);
                    ((dynamic)this.holder).icon_state = "durand10";
                }
                break;

            case 8:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs capacitor to the " + this.holder + ".", "<span class='notice'>You install capacitor to the " + this.holder + ".</span>");
                    I3 = used_atom;
                    ((Mob)user).unEquip(I3);
                    I3.loc = this.holder;
                    ((dynamic)this.holder).icon_state = "durand13";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the scanner module.", "<span class='notice'>You unfasten the scanner module.</span>");
                    ((dynamic)this.holder).icon_state = "durand11";
                }
                break;

            case 7:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the capacitor.", "<span class='notice'>You secure the capacitor.</span>");
                    ((dynamic)this.holder).icon_state = "durand14";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the super capacitor from the " + this.holder + ".", "<span class='notice'>You remove the capacitor from the " + this.holder + ".</span>");
                    I4     = Lang13.FindIn(typeof(Obj_Item_Weapon_StockParts_Capacitor), this.holder);
                    I4.loc = GlobalFuncs.get_turf(this.holder);
                    ((dynamic)this.holder).icon_state = "durand12";
                }
                break;

            case 6:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the internal armor layer to the " + this.holder + ".", "<span class='notice'>You install the internal armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand15";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the super capacitor.", "<span class='notice'>You unfasten the capacitor.</span>");
                    ((dynamic)this.holder).icon_state = "durand13";
                }
                break;

            case 5:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the internal armor layer.", "<span class='notice'>You secure the internal armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "durand16";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " pries internal armor layer from the " + this.holder + ".", "<span class='notice'>You pry internal armor layer from the " + this.holder + ".</span>");
                    MS        = new Obj_Item_Stack_Sheet_Metal(GlobalFuncs.get_turf(this.holder));
                    MS.amount = 5;
                    ((dynamic)this.holder).icon_state = "durand14";
                }
                break;

            case 4:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " welds the internal armor layer to the " + this.holder + ".", "<span class='notice'>You weld the internal armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand17";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the internal armor layer.", "<span class='notice'>You unfasten the internal armor layer.</span>");
                    ((dynamic)this.holder).icon_state = "durand15";
                }
                break;

            case 3:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs Durand Armor Plates to the " + this.holder + ".", "<span class='notice'>You install Durand Armor Plates to the " + this.holder + ".</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "durand18";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " cuts the internal armor layer from the " + this.holder + ".", "<span class='notice'>You cut the internal armor layer from the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "durand16";
                }
                break;

            case 2:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures Durand Armor Plates.", "<span class='notice'>You secure Durand Armor Plates.</span>");
                    ((dynamic)this.holder).icon_state = "durand19";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " pries Durand Armor Plates from the " + this.holder + ".", "<span class='notice'>You pry Durand Armor Plates from the " + this.holder + ".</span>");
                    new Obj_Item_MechaParts_Part_DurandArmor(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "durand17";
                }
                break;

            case 1:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " welds Durand Armor Plates to the " + this.holder + ".", "<span class='notice'>You weld Durand Armor Plates to the " + this.holder + ".</span>");
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens Durand Armor Plates.", "<span class='notice'>You unfasten Durand Armor Plates.</span>");
                    ((dynamic)this.holder).icon_state = "durand18";
                }
                break;
            }
            return(true);
        }
예제 #8
0
        // Function from file: firedoor.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Item_Stack_CableCoil B = null;
            dynamic W  = null;
            dynamic B2 = null;
            dynamic W2 = null;
            Obj_Item_Stack_Sheet_Metal M = null;


            switch ((int)(this.constructionStep))
            {
            case 1:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Crowbar.ogg", 50, 1);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " starts prying something out from " + this + "...</span>", "<span class='notice'>You begin prying out the wire cover...</span>");

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

                    if (this.constructionStep != 1)
                    {
                        return(null);
                    }
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " pries out a metal plate from " + this + ", exposing the wires.</span>", "<span class='notice'>You remove the cover plate from " + this + ", exposing the wires.</span>");
                    this.constructionStep = 2;
                    this.update_icon();
                    return(null);
                }

                if (A is Obj_Item_Weapon_Wrench)
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/ratchet.ogg", 50, 1);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " starts bolting down " + this + "...</span>", "<span class='notice'>You begin bolting " + this + "...</span>");

                    if (!GlobalFuncs.do_after(user, 30 / A.toolspeed, null, this))
                    {
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " finishes the firelock.</span>", "<span class='notice'>You finish the firelock.</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);

                    if (this.reinforced)
                    {
                        new Obj_Machinery_Door_Firedoor_Heavy(GlobalFuncs.get_turf(this));
                    }
                    else
                    {
                        new Obj_Machinery_Door_Firedoor(GlobalFuncs.get_turf(this));
                    }
                    GlobalFuncs.qdel(this);
                    return(null);
                }
                break;

            case 2:

                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Wirecutter.ogg", 50, 1);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " starts cutting the wires from " + this + "...</span>", "<span class='notice'>You begin removing " + this + "'s wires...</span>");

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

                    if (this.constructionStep != 2)
                    {
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " removes the wires from " + this + ".</span>", "<span class='notice'>You remove the wiring from " + this + ", exposing the circuit board.</span>");
                    B        = new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(this));
                    B.amount = 5;
                    this.constructionStep = 3;
                    this.update_icon();
                    return(null);
                }

                if (A is Obj_Item_Weapon_Weldingtool)
                {
                    W = A;

                    if (((Obj_Item_Weapon_Weldingtool)W).remove_fuel(1, user))
                    {
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/welder.ogg", 50, 1);
                        ((Ent_Static)user).visible_message("<span class='notice'>" + user + " starts welding a metal plate into " + this + "...</span>", "<span class='notice'>You begin welding the cover plate back onto " + this + "...</span>");

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

                        if (this.constructionStep != 2)
                        {
                            return(null);
                        }
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/welder2.ogg", 50, 1);
                        ((Ent_Static)user).visible_message("<span class='notice'>" + user + " welds the metal plate into " + this + ".</span>", "<span class='notice'>You weld " + this + "'s cover plate into place, hiding the wires.</span>");
                    }
                    this.constructionStep = 1;
                    this.update_icon();
                    return(null);
                }
                break;

            case 3:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " begins removing the circuit board from " + this + "...</span>", "<span class='notice'>You begin prying out the circuit board from " + this + "...</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Crowbar.ogg", 50, 1);

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

                    if (this.constructionStep != 3)
                    {
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " removes " + this + "'s circuit board.</span>", "<span class='notice'>You remove the circuit board from " + this + ".</span>");
                    new Obj_Item_Weapon_Electronics_Firelock(GlobalFuncs.get_turf(this));
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Crowbar.ogg", 50, 1);
                    this.constructionStep = 4;
                    this.update_icon();
                    return(null);
                }

                if (A is Obj_Item_Stack_CableCoil)
                {
                    B2 = A;

                    if (Convert.ToDouble(B2.amount) < 5)
                    {
                        user.WriteMsg("<span class='warning'>You need more wires to add wiring to " + this + ".</span>");
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " begins wiring " + this + "...</span>", "<span class='notice'>You begin adding wires to " + this + "...</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);

                    if (!GlobalFuncs.do_after(user, 60, null, this))
                    {
                        return(null);
                    }

                    if (this.constructionStep != 3)
                    {
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " adds wires to " + this + ".</span>", "<span class='notice'>You wire " + this + ".</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);
                    B2.use(5);
                    this.constructionStep = 2;
                    this.update_icon();
                    return(null);
                }
                break;

            case 4:

                if (A is Obj_Item_Weapon_Weldingtool)
                {
                    W2 = A;

                    if (((Obj_Item_Weapon_Weldingtool)W2).remove_fuel(1, user))
                    {
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/welder.ogg", 50, 1);
                        ((Ent_Static)user).visible_message("<span class='notice'>" + user + " begins cutting apart " + this + "'s frame...</span>", "<span class='notice'>You begin slicing " + this + " apart...</span>");

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

                        if (this.constructionStep != 4)
                        {
                            return(null);
                        }
                        ((Ent_Static)user).visible_message("<span class='notice'>" + user + " cuts apart " + this + "!</span>", "<span class='notice'>You cut " + this + " into metal.</span>");
                        GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/welder2.ogg", 50, 1);
                        M        = new Obj_Item_Stack_Sheet_Metal(GlobalFuncs.get_turf(this));
                        M.amount = 3;
                        GlobalFuncs.qdel(this);
                    }
                    return(null);
                }

                if (A is Obj_Item_Weapon_Electronics_Firelock)
                {
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " starts adding " + A + " to " + this + "...</span>", "<span class='notice'>You begin adding a circuit board to " + this + "...</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);

                    if (!GlobalFuncs.do_after(user, 40, null, this))
                    {
                        return(null);
                    }

                    if (this.constructionStep != 4)
                    {
                        return(null);
                    }
                    user.drop_item();
                    GlobalFuncs.qdel(A);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " adds a circuit to " + this + ".</span>", "<span class='notice'>You insert and secure " + A + ".</span>");
                    GlobalFuncs.playsound(GlobalFuncs.get_turf(this), "sound/items/Deconstruct.ogg", 50, 1);
                    this.constructionStep = 3;
                    this.update_icon();
                    return(null);
                }
                break;
            }
            return(null);
        }
예제 #9
0
        // Function from file: girders.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Item_Stack_Sheet_Metal     M  = null;
            Obj_Structure_Girder           G  = null;
            Obj_Structure_Girder_Displaced D  = null;
            Obj_Item_Stack_Sheet_Metal     M2 = null;
            dynamic D2 = null;
            Obj_Structure_Girder G2 = null;
            dynamic S = null;
            Obj_Structure_Falsewall_Iron FW = null;
            dynamic T  = null;
            dynamic S2 = null;
            Obj_Structure_Falsewall F = null;
            dynamic T2 = null;
            Obj_Structure_Falsewall_Reinforced FW2 = null;
            dynamic T3 = null;
            Obj_Structure_Girder_Reinforced R = null;
            string  M3  = null;
            Type    F2  = null;
            dynamic FW3 = null;
            dynamic T4  = null;
            dynamic P   = null;

            this.add_fingerprint(user);

            if (A is Obj_Item_Weapon_Screwdriver)
            {
                if (this.state == 3)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("<span class='warning'>" + user + " disassembles the girder.</span>", "<span class='notice'>You start to disassemble the girder...</span>", "You hear clanking and banging noises.");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.state != 3)
                        {
                            return(null);
                        }
                        this.state = 4;
                        user.WriteMsg("<span class='notice'>You disassemble the girder.</span>");
                        M = new Obj_Item_Stack_Sheet_Metal(this.loc, 2);
                        M.add_fingerprint(user);
                        GlobalFuncs.qdel(this);
                    }
                }
                else if (this.state == 2)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    user.WriteMsg("<span class='notice'>You start unsecuring support struts...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (this.state != 2)
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You unsecure the support struts.</span>");
                        this.state = 1;
                    }
                }
            }
            else if (A is Obj_Item_Weapon_Wrench)
            {
                if (this.state == 3)
                {
                    if (!(this.loc is Tile_Simulated_Floor))
                    {
                        user.WriteMsg("<span class='warning'>A floor must be present to secure the girder!</span>");
                        return(null);
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                    user.WriteMsg("<span class='notice'>You start securing the girder...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You secure the girder.</span>");
                        G = new Obj_Structure_Girder(this.loc);
                        this.transfer_fingerprints_to(G);
                        GlobalFuncs.qdel(this);
                    }
                }
                else if (this.state == 0)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                    user.WriteMsg("<span class='notice'>You start unsecuring the girder...</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        user.WriteMsg("<span class='notice'>You unsecure the girder.</span>");
                        D = new Obj_Structure_Girder_Displaced(this.loc);
                        this.transfer_fingerprints_to(D);
                        GlobalFuncs.qdel(this);
                    }
                }
            }
            else if (A is Obj_Item_Weapon_Gun_Energy_Plasmacutter)
            {
                user.WriteMsg("<span class='notice'>You start slicing apart the girder...</span>");
                GlobalFuncs.playsound(this, "sound/items/welder.ogg", 100, 1);

                if (GlobalFuncs.do_after(user, 30, null, this))
                {
                    user.WriteMsg("<span class='notice'>You slice apart the girder.</span>");
                    M2 = new Obj_Item_Stack_Sheet_Metal(this.loc, 2);
                    M2.add_fingerprint(user);
                    GlobalFuncs.qdel(this);
                }
            }
            else if (A is Obj_Item_Weapon_Pickaxe_Drill_Jackhammer)
            {
                D2 = A;
                user.WriteMsg("<span class='notice'>You smash through the girder!</span>");
                new Obj_Item_Stack_Sheet_Metal(GlobalFuncs.get_turf(this));
                ((Obj_Item_Weapon_Pickaxe)D2).playDigSound();
                GlobalFuncs.qdel(this);
            }
            else if (A is Obj_Item_Weapon_Wirecutters && this.state == 1)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 100, 1);
                user.WriteMsg("<span class='notice'>You start removing support struts...</span>");

                if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                {
                    user.WriteMsg("<span class='notice'>You remove the support struts.</span>");
                    new Obj_Item_Stack_Sheet_Plasteel(GlobalFuncs.get_turf(this));
                    G2 = new Obj_Structure_Girder(this.loc);
                    this.transfer_fingerprints_to(G2);
                    GlobalFuncs.qdel(this);
                }
            }
            else if (A is Obj_Item_Stack)
            {
                if (this.loc is Tile_Simulated_Wall)
                {
                    user.WriteMsg("<span class='warning'>There is already a wall present!</span>");
                    return(null);
                }

                if (!(this.loc is Tile_Simulated_Floor))
                {
                    user.WriteMsg("<span class='warning'>A floor must be present to build a false wall!</span>");
                    return(null);
                }

                if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Falsewall), this.loc.contents)))
                {
                    user.WriteMsg("<span class='warning'>There is already a false wall present!</span>");
                    return(null);
                }

                if (A is Obj_Item_Stack_Rods)
                {
                    S = A;

                    if (this.state == 3)
                    {
                        if (Convert.ToDouble(S.amount) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need at least two rods to create a false wall!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start building a reinforced false wall...</span>");

                        if (GlobalFuncs.do_after(user, 20, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S) || Convert.ToDouble(S.amount) < 2)
                            {
                                return(null);
                            }
                            S.use(2);
                            user.WriteMsg("<span class='notice'>You create a false wall. Push on it to open or close the passage.</span>");
                            FW = new Obj_Structure_Falsewall_Iron(this.loc);
                            this.transfer_fingerprints_to(FW);
                            GlobalFuncs.qdel(this);
                        }
                    }
                    else
                    {
                        if (Convert.ToDouble(S.amount) < 5)
                        {
                            user.WriteMsg("<span class='warning'>You need at least five rods to add plating!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start adding plating...</span>");

                        if (GlobalFuncs.do_after(user, 40, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S) || Convert.ToDouble(S.amount) < 5)
                            {
                                return(null);
                            }
                            S.use(5);
                            user.WriteMsg("<span class='notice'>You add the plating.</span>");
                            T = GlobalFuncs.get_turf(this);
                            ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Wall_Mineral_Iron));
                            this.transfer_fingerprints_to(T);
                            GlobalFuncs.qdel(this);
                        }
                        return(null);
                    }
                }

                if (!(A is Obj_Item_Stack_Sheet))
                {
                    return(null);
                }
                S2 = A;

                dynamic _a = S2.type;                 // Was a switch-case, sorry for the mess.
                if (_a == typeof(Obj_Item_Stack_Sheet_Metal) || _a == typeof(Obj_Item_Stack_Sheet_Metal_Cyborg))
                {
                    if (this.state == 3)
                    {
                        if ((((Obj_Item_Stack)S2).get_amount() ?? 0) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need two sheets of metal to create a false wall!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start building a false wall...</span>");

                        if (GlobalFuncs.do_after(user, 20, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S2) || (((Obj_Item_Stack)S2).get_amount() ?? 0) < 2)
                            {
                                return(null);
                            }
                            S2.use(2);
                            user.WriteMsg("<span class='notice'>You create a false wall. Push on it to open or close the passage.</span>");
                            F = new Obj_Structure_Falsewall(this.loc);
                            this.transfer_fingerprints_to(F);
                            GlobalFuncs.qdel(this);
                        }
                    }
                    else
                    {
                        if ((((Obj_Item_Stack)S2).get_amount() ?? 0) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need two sheets of metal to finish a wall!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start adding plating...</span>");

                        if (GlobalFuncs.do_after(user, 40, null, this))
                        {
                            if (this.loc == null || (((Obj_Item_Stack)S2).get_amount() ?? 0) < 2)
                            {
                                return(null);
                            }
                            S2.use(2);
                            user.WriteMsg("<span class='notice'>You add the plating.</span>");
                            T2 = GlobalFuncs.get_turf(this);
                            ((Tile)T2).ChangeTurf(typeof(Tile_Simulated_Wall));
                            this.transfer_fingerprints_to(T2);
                            GlobalFuncs.qdel(this);
                        }
                        return(null);
                    }
                }
                else if (_a == typeof(Obj_Item_Stack_Sheet_Plasteel))
                {
                    if (this.state == 3)
                    {
                        if (Convert.ToDouble(S2.amount) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need at least two sheets to create a false wall!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start building a reinforced false wall...</span>");

                        if (GlobalFuncs.do_after(user, 20, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S2) || Convert.ToDouble(S2.amount) < 2)
                            {
                                return(null);
                            }
                            S2.use(2);
                            user.WriteMsg("<span class='notice'>You create a reinforced false wall. Push on it to open or close the passage.</span>");
                            FW2 = new Obj_Structure_Falsewall_Reinforced(this.loc);
                            this.transfer_fingerprints_to(FW2);
                            GlobalFuncs.qdel(this);
                        }
                    }
                    else if (this.state == 2)
                    {
                        if (Convert.ToDouble(S2.amount) < 1)
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start finalizing the reinforced wall...</span>");

                        if (GlobalFuncs.do_after(user, 50, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S2) || Convert.ToDouble(S2.amount) < 1)
                            {
                                return(null);
                            }
                            S2.use(1);
                            user.WriteMsg("<span class='notice'>You fully reinforce the wall.</span>");
                            T3 = GlobalFuncs.get_turf(this);
                            ((Tile)T3).ChangeTurf(typeof(Tile_Simulated_Wall_RWall));
                            this.transfer_fingerprints_to(T3);
                            GlobalFuncs.qdel(this);
                        }
                        return(null);
                    }
                    else
                    {
                        if (Convert.ToDouble(S2.amount) < 1)
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start reinforcing the girder...</span>");

                        if (GlobalFuncs.do_after(user, 60, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S2) || Convert.ToDouble(S2.amount) < 1)
                            {
                                return(null);
                            }
                            S2.use(1);
                            user.WriteMsg("<span class='notice'>You reinforce the girder.</span>");
                            R = new Obj_Structure_Girder_Reinforced(this.loc);
                            this.transfer_fingerprints_to(R);
                            GlobalFuncs.qdel(this);
                        }
                        return(null);
                    }
                }

                if (Lang13.Bool(S2.sheettype))
                {
                    M3 = S2.sheettype;

                    if (this.state == 3)
                    {
                        if (Convert.ToDouble(S2.amount) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need at least two sheets to create a false wall!</span>");
                            return(null);
                        }
                        S2.use(2);
                        user.WriteMsg("<span class='notice'>You create a false wall. Push on it to open or close the passage.</span>");
                        F2  = Lang13.FindClass("/obj/structure/falsewall/" + M3);
                        FW3 = Lang13.Call(F2, this.loc);
                        this.transfer_fingerprints_to(FW3);
                        GlobalFuncs.qdel(this);
                    }
                    else
                    {
                        if (Convert.ToDouble(S2.amount) < 2)
                        {
                            user.WriteMsg("<span class='warning'>You need at least two sheets to add plating!</span>");
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You start adding plating...</span>");

                        if (GlobalFuncs.do_after(user, 40, null, this))
                        {
                            if (!(this.loc != null) || !Lang13.Bool(S2) || Convert.ToDouble(S2.amount) < 2)
                            {
                                return(null);
                            }
                            S2.use(2);
                            user.WriteMsg("<span class='notice'>You add the plating.</span>");
                            T4 = GlobalFuncs.get_turf(this);
                            ((Tile)T4).ChangeTurf(Lang13.FindClass("/turf/simulated/wall/mineral/" + M3));
                            this.transfer_fingerprints_to(T4);
                            GlobalFuncs.qdel(this);
                        }
                        return(null);
                    }
                }
                this.add_hiddenprint(user);
            }
            else if (A is Obj_Item_Pipe)
            {
                P = A;

                if (new ByTable(new object [] { 0, 1, 5 }).Contains(P.pipe_type))
                {
                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    P.loc = this.loc;
                    user.WriteMsg(new Txt("<span class='notice'>You fit the pipe into ").the(this).item().str(".</span>").ToString());
                }
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            return(null);
        }
예제 #10
0
        // Function from file: tile_types.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_Metal new_item = null;
            Obj_Item_Stack_Tile        R        = null;
            bool                replace         = false;
            Type                sheet_type      = null;
            dynamic             new_item2       = null;
            Obj_Item_Stack_Tile R2       = null;
            bool                replace2 = false;


            if (A is Obj_Item_Weapon_Weldingtool)
            {
                WT = A;

                if ((this.get_amount() ?? 0) < 4)
                {
                    user.WriteMsg("<span class='warning'>You need at least four tiles to do this!</span>");
                    return(null);
                }

                if (((Obj_Item)WT).is_hot() != 0 && !Lang13.Bool(this.mineralType))
                {
                    user.WriteMsg("<span class='warning'>You can not reform this!</span>");
                    return(null);
                }

                if (((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                {
                    if (this.mineralType == "plasma")
                    {
                        this.atmos_spawn_air(5, 5);
                        ((Ent_Static)user).visible_message("<span class='warning'>" + user.name + " sets the plasma tiles on fire!</span>", "<span class='warning'>You set the plasma tiles on fire!</span>");
                        GlobalFuncs.qdel(this);
                        return(null);
                    }

                    if (this.mineralType == "metal")
                    {
                        new_item = new Obj_Item_Stack_Sheet_Metal(user.loc);
                        ((Ent_Static)user).visible_message("" + user.name + " shaped " + this + " into metal with the weldingtool.", "<span class='notice'>You shaped " + this + " into metal with the weldingtool.</span>", "<span class='italics'>You hear welding.</span>");
                        R             = this;
                        Task13.Source = null;
                        replace       = ((Mob)user).get_inactive_hand() == R;
                        R.use(4);

                        if (!(R != null) && replace)
                        {
                            ((Mob)user).put_in_hands(new_item);
                        }
                    }
                    else
                    {
                        sheet_type = Lang13.FindClass("/obj/item/stack/sheet/mineral/" + this.mineralType);
                        new_item2  = Lang13.Call(sheet_type, user.loc);
                        ((Ent_Static)user).visible_message("" + user.name + " shaped " + this + " into a sheet with the weldingtool.", "<span class='notice'>You shaped " + this + " into a sheet with the weldingtool.</span>", "<span class='italics'>You hear welding.</span>");
                        R2            = this;
                        Task13.Source = null;
                        replace2      = ((Mob)user).get_inactive_hand() == R2;
                        R2.use(4);

                        if (!(R2 != null) && replace2)
                        {
                            ((Mob)user).put_in_hands(new_item2);
                        }
                    }
                }
                return(null);
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            return(null);
        }