Пример #1
0
 // Function from file: work_tools.dm
 public Obj_Item_MechaParts_MechaEquipment_CableLayer(dynamic loc = null) : base((object)(loc))
 {
     this.cable        = new Obj_Item_Stack_CableCoil(this);
     this.cable.amount = 0;
     // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
     return;
 }
Пример #2
0
        // Function from file: cable.dm
        public Obj_Structure_Cable(dynamic loc = null) : base((object)(loc))
        {
            int        dash = 0;
            Ent_Static T    = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            dash    = String13.FindIgnoreCase(this.icon_state, "-", 1, 0);
            this.d1 = String13.ParseNumber(String13.SubStr(this.icon_state, 1, dash));
            this.d2 = String13.ParseNumber(String13.SubStr(this.icon_state, dash + 1, 0));
            T       = this.loc;

            if (this.level == 1)
            {
                this.hide(Lang13.Bool(((dynamic)T).intact));
            }
            GlobalVars.cable_list.Add(this);

            if (Lang13.Bool(this.d1))
            {
                this.stored = new Obj_Item_Stack_CableCoil(null, 2, this.cable_color);
            }
            else
            {
                this.stored = new Obj_Item_Stack_CableCoil(null, 1, this.cable_color);
            }
            return;
        }
Пример #3
0
        // Function from file: ores_coins.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic CC = null;
            Obj_Item_Stack_CableCoil CC2 = null;


            if (A is Obj_Item_Stack_CableCoil)
            {
                CC = A;

                if (this.string_attached == true)
                {
                    user.WriteMsg("<span class='warning'>There already is a string attached to this coin!</span>");
                    return(null);
                }

                if (((Obj_Item_Stack)CC).use(1) != 0)
                {
                    this.overlays.Add(new Image("icons/obj/economy.dmi", "coin_string_overlay"));
                    this.string_attached = true;
                    user.WriteMsg("<span class='notice'>You attach a string to the coin.</span>");
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need one length of cable to attach a string to the coin!</span>");
                    return(null);
                }
            }
            else if (A is Obj_Item_Weapon_Wirecutters)
            {
                if (!(this.string_attached == true))
                {
                    base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
                    return(null);
                }
                CC2        = new Obj_Item_Stack_CableCoil(user.loc);
                CC2.amount = 1;
                CC2.update_icon();
                this.overlays        = new ByTable();
                this.string_attached = null;
                user.WriteMsg("<span class='notice'>You detach the string from the coin.</span>");
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            return(null);
        }
Пример #4
0
        // Function from file: light.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   CC = null;
            Obj_Item_Stack_Sheet_Glass G  = null;
            dynamic M = null;
            Obj_Item_Stack_Tile_Light L = null;

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

            if (A is Obj_Item_Weapon_Wirecutters)
            {
                CC        = new Obj_Item_Stack_CableCoil(user.loc);
                CC.amount = 5;
                CC.add_fingerprint(user);
                this.amount--;
                G = new Obj_Item_Stack_Sheet_Glass(user.loc);
                G.add_fingerprint(user);

                if ((this.amount ?? 0) <= 0)
                {
                    ((Mob)user).unEquip(this, 1);
                    GlobalFuncs.qdel(this);
                }
            }

            if (A is Obj_Item_Stack_Sheet_Metal)
            {
                M = A;

                if (Lang13.Bool(M.use(1)))
                {
                    this.use(1);
                    L = new Obj_Item_Stack_Tile_Light(user.loc);
                    user.WriteMsg("<span class='notice'>You make a light tile.</span>");
                    L.add_fingerprint(user);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need one metal sheet to finish the light tile!</span>");
                    return(null);
                }
            }
            return(null);
        }
Пример #5
0
        public override bool f_action(dynamic target = null)
        {
            double?cur_amount = null;
            int    to_load    = 0;


            if (!this.action_checks(target))
            {
                return(false);
            }

            if (target is Obj_Item_Stack_CableCoil && Lang13.Bool(target.amount))
            {
                cur_amount = (this.cable != null ? this.cable.amount : 0);
                to_load    = Num13.MaxInt(((int)(this.max_cable - (cur_amount ?? 0))), 0);

                if (to_load != 0)
                {
                    to_load = Num13.MinInt(Convert.ToInt32(target.amount), to_load);

                    if (!(this.cable != null))
                    {
                        this.cable        = new Obj_Item_Stack_CableCoil(this);
                        this.cable.amount = 0;
                    }
                    this.cable.amount += to_load;
                    target.use(to_load);
                    this.occupant_message("<span class='notice'>" + to_load + " meters of cable successfully loaded.</span>");
                    GlobalFuncs.send_byjax(this.chassis.occupant, "exosuit.browser", new Txt().Ref(this).ToString(), this.get_equip_info());
                }
                else
                {
                    this.occupant_message("<span class='warning'>Reel is full.</span>");
                }
            }
            else
            {
                this.occupant_message("<span class='warning'>Unable to load " + target + " - no cable found.</span>");
            }
            return(false);
        }
Пример #6
0
        // Function from file: apc_frame.dm
        public override bool try_build(Tile_Simulated_Wall on_wall = null)
        {
            dynamic    loc = null;
            Ent_Static A   = null;
            Obj_Machinery_Power_Terminal T = null;
            Obj_Item_Stack_CableCoil     C = null;


            if (!base.try_build(on_wall))
            {
                return(false);
            }
            loc = GlobalFuncs.get_turf(Task13.User);
            A   = loc.loc;

            if (Lang13.Bool(((dynamic)A).get_apc()))
            {
                Task13.User.WriteMsg("<span class='warning'>This area already has APC!</span>");
                return(false);
            }

            foreach (dynamic _a in Lang13.Enumerate(loc, typeof(Obj_Machinery_Power_Terminal)))
            {
                T = _a;


                if (T.master != null)
                {
                    Task13.User.WriteMsg("<span class='warning'>There is another network terminal here!</span>");
                    return(false);
                }
                else
                {
                    C        = new Obj_Item_Stack_CableCoil(loc);
                    C.amount = 10;
                    Task13.User.WriteMsg("<span class='notice'>You cut the cables and disassemble the unused power terminal.</span>");
                    GlobalFuncs.qdel(T);
                }
            }
            return(true);
        }
Пример #7
0
        // Function from file: work_tools.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            double?m = null;
            Obj_Item_Stack_CableCoil CC = null;

            base.Topic(href, href_list, (object)(hsrc));

            if (Lang13.Bool(href_list["toggle"]))
            {
                this.set_ready_state(!this.equip_ready);
                this.occupant_message("" + this + " " + (this.equip_ready ? "dea" : "a") + "ctivated.");
                this.log_message("" + (this.equip_ready ? "Dea" : "A") + "ctivated.");
                return(null);
            }

            if (Lang13.Bool(href_list["cut"]))
            {
                if (this.cable != null && Lang13.Bool(this.cable.amount))
                {
                    m = Num13.Round(Convert.ToDouble(Interface13.Input(this.chassis.occupant, "Please specify the length of cable to cut", "Cut cable", Num13.MinInt(((int)(this.cable.amount ?? 0)), 30), null, InputType.Num)), 1);
                    m = Num13.MinInt(((int)(m ?? 0)), ((int)(this.cable.amount ?? 0)));

                    if (Lang13.Bool(m))
                    {
                        this.use_cable(m);
                        CC        = new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(this.chassis));
                        CC.amount = m;
                    }
                }
                else
                {
                    this.occupant_message("There's no more cable on the reel.");
                }
            }
            return(null);
        }
Пример #8
0
        // 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_Plasteel MS   = null;
            Obj_Item_Stack_Sheet_Plasteel MS2  = null;
            Obj_Item_Stack_Sheet_Plasteel MS3  = null;


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

            switch ((int?)(index))
            {
            case 15:
                ((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 = "fireripley1";
                break;

            case 14:

                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 = "fireripley2";
                }
                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 = "fireripley0";
                }
                break;

            case 13:

                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 = "fireripley3";
                }
                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 = "fireripley1";
                }
                break;

            case 12:

                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 = "fireripley4";
                }
                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 = "fireripley2";
                }
                break;

            case 11:

                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 = "fireripley5";
                }
                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 = "fireripley3";
                }
                break;

            case 10:

                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 = "fireripley6";
                }
                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 = "fireripley4";
                }
                break;

            case 9:

                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 = "fireripley7";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the mainboard.", "<span class='notice'>You unfasten the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "fireripley5";
                }
                break;

            case 8:

                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 = "fireripley8";
                }
                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 = "fireripley6";
                }
                break;

            case 7:

                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 = "fireripley9";
                }
                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 = "fireripley7";
                }
                break;

            case 6:

                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 = "fireripley10";
                }
                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_Plasteel(GlobalFuncs.get_turf(this.holder));
                    MS.amount = 5;
                    ((dynamic)this.holder).icon_state = "fireripley8";
                }
                break;

            case 5:

                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 = "fireripley11";
                }
                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 = "fireripley9";
                }
                break;

            case 4:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " starts to install the external armor layer to the " + this.holder + ".", "<span class='notice'>You install the external armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "fireripley12";
                }
                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 = "fireripley10";
                }
                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 = "fireripley13";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the external armor from the " + this.holder + ".", "<span class='notice'>You remove the external armor 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 = "fireripley11";
                }
                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 = "fireripley14";
                }
                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>");
                    MS3        = new Obj_Item_Stack_Sheet_Plasteel(GlobalFuncs.get_turf(this.holder));
                    MS3.amount = 5;
                    ((dynamic)this.holder).icon_state = "fireripley12";
                }
                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 = "fireripley13";
                }
                break;
            }
            return(true);
        }
Пример #9
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);
        }
Пример #10
0
        // Function from file: airalarm.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 cable = null;
            dynamic cable2 = null;


            switch ((int)(this.buildstage))
            {
            case 2:

                if (A is Obj_Item_Weapon_Wirecutters && Lang13.Bool(this.panel_open) && Lang13.Bool(((Wires)this.wires).is_all_cut()))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You cut the final wires.</span>");
                    cable           = new Obj_Item_Stack_CableCoil(this.loc);
                    cable.amount    = 5;
                    this.buildstage = 1;
                    this.update_icon();
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Screwdriver)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                    this.panel_open = !Lang13.Bool(this.panel_open) ?1:0;
                    user.WriteMsg("<span class='notice'>The wires have been " + (Lang13.Bool(this.panel_open) ? "exposed" : "unexposed") + ".</span>");
                    this.update_icon();
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Card_Id || A is Obj_Item_Device_Pda)
                {
                    if ((this.stat & 3) != 0)
                    {
                        user.WriteMsg("<span class='warning'>It does nothing!</span>");
                    }
                    else if (this.allowed(Task13.User) && !((Wires)this.wires).is_cut("idscan"))
                    {
                        this.locked = !this.locked;
                        user.WriteMsg("<span class='notice'>You " + (this.locked ? "lock" : "unlock") + " the air alarm interface.</span>");
                    }
                    else
                    {
                        user.WriteMsg("<span class='danger'>Access denied.</span>");
                    }
                    return(null);
                }
                else if (Lang13.Bool(this.panel_open) && Lang13.Bool(GlobalFuncs.is_wire_tool(A)))
                {
                    this.wires.interact(user);
                    return(null);
                }
                break;

            case 1:

                if (A is Obj_Item_Weapon_Crowbar)
                {
                    ((Ent_Static)user).visible_message("" + user.name + " removes the electronics from " + this.name + ".", "<span class='notice'>You start prying out the circuit...</span>");
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        if (this.buildstage == 1)
                        {
                            user.WriteMsg("<span class='notice'>You remove the air alarm electronics.</span>");
                            new Obj_Item_Weapon_Electronics_Airalarm(this.loc);
                            GlobalFuncs.playsound(this.loc, "sound/items/Deconstruct.ogg", 50, 1);
                            this.buildstage = 0;
                            this.update_icon();
                        }
                    }
                    return(null);
                }

                if (A is Obj_Item_Stack_CableCoil)
                {
                    cable2 = A;

                    if ((((Obj_Item_Stack)cable2).get_amount() ?? 0) < 5)
                    {
                        user.WriteMsg("<span class='warning'>You need five lengths of cable to wire the fire alarm!</span>");
                        return(null);
                    }
                    ((Ent_Static)user).visible_message("" + user.name + " wires the air alarm.", "<span class='notice'>You start wiring the air alarm...</span>");

                    if (GlobalFuncs.do_after(user, 20, null, this))
                    {
                        if ((((Obj_Item_Stack)cable2).get_amount() ?? 0) >= 5 && this.buildstage == 1)
                        {
                            cable2.use(5);
                            user.WriteMsg("<span class='notice'>You wire the air alarm.</span>");
                            this.wires.repair();
                            this.aidisabled = 0;
                            this.locked     = true;
                            this.mode       = 1;
                            this.shorted    = 0;
                            this.post_alert(0);
                            this.buildstage = 2;
                            this.update_icon();
                        }
                    }
                    return(null);
                }
                break;

            case 0:

                if (A is Obj_Item_Weapon_Electronics_Airalarm)
                {
                    if (((Mob)user).unEquip(A))
                    {
                        user.WriteMsg("<span class='notice'>You insert the circuit.</span>");
                        this.buildstage = 1;
                        this.update_icon();
                        GlobalFuncs.qdel(A);
                    }
                    return(null);
                }

                if (A is Obj_Item_Weapon_Wrench)
                {
                    user.WriteMsg(new Txt("<span class='notice'>You detach ").the(this).item().str(" from the wall.</span>").ToString());
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
                    new Obj_Item_Wallframe_Airalarm(user.loc);
                    GlobalFuncs.qdel(this);
                    return(null);
                }
                break;
            }
            return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
        }
        // 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);
        }
Пример #13
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);
        }
Пример #14
0
        // Function from file: firealarm.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 coil = null;
            dynamic coil2 = null;
            Obj_Item_Wallframe_Firealarm frame = null;

            this.add_fingerprint(user);

            if (A is Obj_Item_Weapon_Screwdriver && this.buildstage == 2)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                this.panel_open = !Lang13.Bool(this.panel_open) ?1:0;
                user.WriteMsg("<span class='notice'>The wires have been " + (Lang13.Bool(this.panel_open) ? "exposed" : "unexposed") + ".</span>");
                this.update_icon();
                return(null);
            }

            if (Lang13.Bool(this.panel_open))
            {
                switch ((int)(this.buildstage))
                {
                case 2:

                    if (A is Obj_Item_Device_Multitool)
                    {
                        this.detecting = !this.detecting;

                        if (this.detecting)
                        {
                            ((Ent_Static)user).visible_message("" + user + " has reconnected " + this + "'s detecting unit!", "<span class='notice'>You reconnect " + this + "'s detecting unit.</span>");
                        }
                        else
                        {
                            ((Ent_Static)user).visible_message("" + user + " has disconnected " + this + "'s detecting unit!", "<span class='notice'>You disconnect " + this + "'s detecting unit.</span>");
                        }
                        return(null);
                    }
                    else if (A is Obj_Item_Weapon_Wirecutters)
                    {
                        this.buildstage = 1;
                        GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 50, 1);
                        coil        = new Obj_Item_Stack_CableCoil();
                        coil.amount = 5;
                        coil.loc    = user.loc;
                        user.WriteMsg(new Txt("<span class='notice'>You cut the wires from ").the(this).item().str(".</span>").ToString());
                        this.update_icon();
                        return(null);
                    }
                    break;

                case 1:

                    if (A is Obj_Item_Stack_CableCoil)
                    {
                        coil2 = A;

                        if ((((Obj_Item_Stack)coil2).get_amount() ?? 0) < 5)
                        {
                            user.WriteMsg("<span class='warning'>You need more cable for this!</span>");
                        }
                        else
                        {
                            coil2.use(5);
                            this.buildstage = 2;
                            user.WriteMsg(new Txt("<span class='notice'>You wire ").the(this).item().str(".</span>").ToString());
                            this.update_icon();
                        }
                        return(null);
                    }
                    else if (A is Obj_Item_Weapon_Crowbar)
                    {
                        GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);
                        ((Ent_Static)user).visible_message("" + user.name + " removes the electronics from " + this.name + ".", "<span class='notice'>You start prying out the circuit...</span>");

                        if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                        {
                            if (this.buildstage == 1)
                            {
                                if ((this.stat & 1) != 0)
                                {
                                    user.WriteMsg("<span class='notice'>You remove the destroyed circuit.</span>");
                                }
                                else
                                {
                                    user.WriteMsg("<span class='notice'>You pry out the circuit.</span>");
                                    new Obj_Item_Weapon_Electronics_Firealarm(user.loc);
                                }
                                this.buildstage = 0;
                                this.update_icon();
                            }
                        }
                        return(null);
                    }
                    break;

                case 0:

                    if (A is Obj_Item_Weapon_Electronics_Firealarm)
                    {
                        user.WriteMsg("<span class='notice'>You insert the circuit.</span>");
                        GlobalFuncs.qdel(A);
                        this.buildstage = 1;
                        this.update_icon();
                        return(null);
                    }
                    else if (A is Obj_Item_Weapon_Wrench)
                    {
                        ((Ent_Static)user).visible_message("" + user + " removes the fire alarm assembly from the wall.", "<span class='notice'>You remove the fire alarm assembly from the wall.</span>");
                        frame     = new Obj_Item_Wallframe_Firealarm();
                        frame.loc = user.loc;
                        GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
                        GlobalFuncs.qdel(this);
                        return(null);
                    }
                    break;
                }
            }
            return(base.attackby((object)(A), (object)(user), _params, silent, replace_spent));
        }
Пример #15
0
        // Function from file: ai_core.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic WT = null;
            dynamic C  = null;
            Obj_Item_Stack_CableCoil A2 = null;
            dynamic G      = null;
            dynamic module = null;
            dynamic M      = null;


            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).isOn())
                    {
                        user.WriteMsg("<span class='warning'>The welder must be on for this task!</span>");
                        return(null);
                    }
                    GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You start to deconstruct the frame...</span>");

                    if (GlobalFuncs.do_after(user, 20 / A.toolspeed, null, this))
                    {
                        if (!(this != null) || !((Obj_Item_Weapon_Weldingtool)WT).remove_fuel(0, user))
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You deconstruct the frame.</span>");
                        new Obj_Item_Stack_Sheet_Plasteel(this.loc, 4);
                        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_Aicore && !Lang13.Bool(this.circuit))
                {
                    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;
                    A.loc           = this;
                }

                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;
                    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 to add cables to the frame...</span>");

                        if (GlobalFuncs.do_after(user, 20, 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 AI core!</span>");
                        return(null);
                    }
                }
                break;

            case 3:

                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    if (Lang13.Bool(this.brain))
                    {
                        user.WriteMsg("<span class='warning'>Get that brain out of there first!</span>");
                    }
                    else
                    {
                        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;
                    }
                }

                if (A is Obj_Item_Stack_Sheet_Rglass)
                {
                    G = A;

                    if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 2)
                    {
                        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";
                            }
                        }
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>You need two sheets of reinforced glass to insert them into AI core!</span>");
                        return(null);
                    }
                }

                if (A is Obj_Item_Weapon_AiModule)
                {
                    module = A;
                    ((Obj_Item_Weapon_AiModule)module).install(this.laws, user);
                }

                if (A is Obj_Item_Device_Mmi)
                {
                    M = A;

                    if (!Lang13.Bool(M.brainmob))
                    {
                        user.WriteMsg("<span class='warning'>Sticking an empty MMI into the frame would sort of defeat the purpose!</span>");
                        return(null);
                    }

                    if (Convert.ToInt32(M.brainmob.stat) == 2)
                    {
                        user.WriteMsg("<span class='warning'>Sticking a dead brain into the frame would sort of defeat the purpose!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(M.brainmob.client))
                    {
                        user.WriteMsg("<span class='warning'>Sticking an inactive brain into the frame would sort of defeat the purpose.</span>");
                        return(null);
                    }

                    if (GlobalVars.config != null && !GlobalVars.config.allow_ai)
                    {
                        user.WriteMsg("<span class='warning'>This MMI does not seem to fit!</span>");
                        return(null);
                    }

                    if (GlobalFuncs.jobban_isbanned(M.brainmob, "AI"))
                    {
                        user.WriteMsg("<span class='warning'>This MMI does not seem to fit!</span>");
                        return(null);
                    }

                    if (M.syndiemmi)
                    {
                        user.WriteMsg("<span class='warning'>This MMI does not seem to fit!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(M.brainmob.mind))
                    {
                        user.WriteMsg("<span class='warning'>This MMI is mindless!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    ((GameMode)GlobalVars.ticker.mode).remove_antag_for_borging(M.brainmob.mind);
                    M.loc      = this;
                    this.brain = M;
                    user.WriteMsg("<span class='notice'>Added a brain.</span>");
                    this.icon_state = "3b";
                }

                if (A is Obj_Item_Weapon_Crowbar && Lang13.Bool(this.brain))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 50, 1);
                    user.WriteMsg("<span class='notice'>You remove the brain.</span>");
                    this.brain.loc  = this.loc;
                    this.brain      = null;
                    this.icon_state = "3";
                }
                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;

                    if (Lang13.Bool(this.brain))
                    {
                        this.icon_state = "3b";
                    }
                    else
                    {
                        this.icon_state = "3";
                    }
                    new Obj_Item_Stack_Sheet_Rglass(this.loc, 2);
                    return(null);
                }

                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>");

                    if (!(this.laws.inherent.len != 0))
                    {
                        this.laws = null;
                    }
                    new Mob_Living_Silicon_Ai(this.loc, this.laws, this.brain);
                    GlobalFuncs.feedback_inc("cyborg_ais_created", 1);
                    GlobalFuncs.qdel(this);
                }
                break;
            }
            return(null);
        }
Пример #16
0
        // 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_Plasteel MS = null;


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

            switch ((int?)(index))
            {
            case 24:
                ((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 = "phazon1";
                break;

            case 23:

                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 = "phazon2";
                }
                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 = "phazon0";
                }
                break;

            case 22:

                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 = "phazon3";
                }
                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 = "phazon1";
                }
                break;

            case 21:

                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 = "phazon4";
                }
                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 = "phazon2";
                }
                break;

            case 20:

                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 = "phazon5";
                }
                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 = "phazon3";
                }
                break;

            case 19:

                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 = "phazon6";
                }
                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_Phazon_Main(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "phazon4";
                }
                break;

            case 18:

                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 = "phazon7";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the mainboard.", "<span class='notice'>You unfasten the mainboard.</span>");
                    ((dynamic)this.holder).icon_state = "phazon5";
                }
                break;

            case 17:

                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 = "phazon8";
                }
                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_Phazon_Peripherals(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "phazon6";
                }
                break;

            case 16:

                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 = "phazon9";
                }
                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 = "phazon7";
                }
                break;

            case 15:

                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 = "phazon10";
                }
                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_Phazon_Targeting(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "phazon8";
                }
                break;

            case 14:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs phasic scanner module to the " + this.holder + ".", "<span class='notice'>You install scanner module to the " + this.holder + ".</span>");
                    I = used_atom;
                    ((Mob)user).unEquip(I);
                    I.loc = this.holder;
                    ((dynamic)this.holder).icon_state = "phazon11";
                }
                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 = "phazon9";
                }
                break;

            case 13:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the phasic scanner module.", "<span class='notice'>You secure the scanner module.</span>");
                    ((dynamic)this.holder).icon_state = "phazon12";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the phasic 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 = "phazon10";
                }
                break;

            case 12:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs super 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 = "phazon13";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unfastens the phasic scanner module.", "<span class='notice'>You unfasten the scanner module.</span>");
                    ((dynamic)this.holder).icon_state = "phazon11";
                }
                break;

            case 11:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " secures the super capacitor.", "<span class='notice'>You secure the capacitor.</span>");
                    ((dynamic)this.holder).icon_state = "phazon14";
                }
                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 = "phazon12";
                }
                break;

            case 10:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the bluespace crystal.", "<span class='notice'>You install the bluespace crystal.</span>");
                    GlobalFuncs.qdel(used_atom);
                    ((dynamic)this.holder).icon_state = "phazon15";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " unsecures the super capacitor from the " + this.holder + ".", "<span class='notice'>You unsecure the capacitor from the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "phazon13";
                }
                break;

            case 9:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " connects the bluespace crystal.", "<span class='notice'>You connect the bluespace crystal.</span>");
                    ((dynamic)this.holder).icon_state = "phazon16";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " removes the bluespace crystal from the " + this.holder + ".", "<span class='notice'>You remove the bluespace crystal from the " + this.holder + ".</span>");
                    new Obj_Item_Weapon_Ore_BluespaceCrystal(GlobalFuncs.get_turf(this.holder));
                    ((dynamic)this.holder).icon_state = "phazon14";
                }
                break;

            case 8:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " engages the bluespace crystal.", "<span class='notice'>You engage the bluespace crystal.</span>");
                    ((dynamic)this.holder).icon_state = "phazon17";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disconnects the bluespace crystal from the " + this.holder + ".", "<span class='notice'>You disconnect the bluespace crystal from the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "phazon15";
                }
                break;

            case 7:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message("" + user + " installs the phase armor layer to the " + this.holder + ".", "<span class='notice'>You install the phase armor layer to the " + this.holder + ".</span>");
                    ((dynamic)this.holder).icon_state = "phazon18";
                }
                else
                {
                    ((Ent_Static)user).visible_message("" + user + " disengages the bluespace crystal.", "<span class='notice'>You disengage the bluespace crystal.</span>");
                    ((dynamic)this.holder).icon_state = "phazon16";
                }
                break;

            case 6:

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

            case 5:

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

            case 4:

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

            case 3:

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

            case 2:

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

            case 1:

                if (diff == -1)
                {
                    ((Ent_Static)user).visible_message(new Txt().item(user).str(" carefully inserts the anomaly core into ").the(this.holder).item().str(" and secures it.").ToString(), "<span class='notice'>You slowly place the anomaly core into its socket and close its chamber.</span>");
                    GlobalFuncs.qdel(used_atom);
                }
                break;
            }
            return(true);
        }