// 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);
        }
Exemple #2
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);
        }
Exemple #3
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);
        }