// Function from file: interactive.dm
        public void doorscan(dynamic obj = null)
        {
            dynamic            dir = null;
            Tile               T   = null;
            Obj_Machinery_Door D   = null;


            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.cardinal))
            {
                dir = _b;

                T = Map13.GetStep(this, Convert.ToInt32(dir));

                if (T != null)
                {
                    foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Door)))
                    {
                        D = _a;


                        if (D.check_access(this.MYID) && !(D is Obj_Machinery_Door_Poddoor) && D.density)
                        {
                            Task13.Schedule(1, (Task13.Closure)(() => {
                                D.open();
                                Task13.Sleep(5);
                                this.walk2derpless(Map13.GetStep(D, Convert.ToInt32(dir)));
                                return;
                            }));
                        }
                    }
                }
            }
            return;
        }
Example #2
0
        // Function from file: blueprints.dm
        public void set_area_machinery_title(Ent_Static A = null, string title = null, string oldtitle = null)
        {
            dynamic RA = null;
            Obj_Machinery_Airalarm  M  = null;
            Obj_Machinery_Power_Apc M2 = null;
            Obj_Machinery_Atmospherics_Components_Unary_VentScrubber M3 = null;
            Obj_Machinery_Atmospherics_Components_Unary_VentPump     M4 = null;
            Obj_Machinery_Door M5 = null;


            if (!Lang13.Bool(oldtitle))
            {
                return;
            }

            foreach (dynamic _f in Lang13.Enumerate(((dynamic)A).related))
            {
                RA = _f;


                foreach (dynamic _a in Lang13.Enumerate(RA, typeof(Obj_Machinery_Airalarm)))
                {
                    M = _a;

                    M.name = GlobalFuncs.replacetext(M.name, oldtitle, title);
                }

                foreach (dynamic _b in Lang13.Enumerate(RA, typeof(Obj_Machinery_Power_Apc)))
                {
                    M2 = _b;

                    M2.name = GlobalFuncs.replacetext(M2.name, oldtitle, title);
                }

                foreach (dynamic _c in Lang13.Enumerate(RA, typeof(Obj_Machinery_Atmospherics_Components_Unary_VentScrubber)))
                {
                    M3 = _c;

                    M3.name = GlobalFuncs.replacetext(M3.name, oldtitle, title);
                }

                foreach (dynamic _d in Lang13.Enumerate(RA, typeof(Obj_Machinery_Atmospherics_Components_Unary_VentPump)))
                {
                    M4 = _d;

                    M4.name = GlobalFuncs.replacetext(M4.name, oldtitle, title);
                }

                foreach (dynamic _e in Lang13.Enumerate(RA, typeof(Obj_Machinery_Door)))
                {
                    M5 = _e;

                    M5.name = GlobalFuncs.replacetext(M5.name, oldtitle, title);
                }
            }
            return;
        }
Example #3
0
        // Function from file: medical_tools.dm
        public bool load_syringe(dynamic S = null)
        {
            Obj_Structure      D  = null;
            Obj_Machinery_Door D2 = null;


            if (this.syringes.len < this.max_syringes)
            {
                if (Map13.GetDistance(this, S) >= 2)
                {
                    this.occupant_message("The syringe is too far away.");
                    return(false);
                }

                foreach (dynamic _a in Lang13.Enumerate(S.loc, typeof(Obj_Structure)))
                {
                    D = _a;


                    if (!D.CanPass(S, this.loc))
                    {
                        this.occupant_message("Unable to load syringe.");
                        return(false);
                    }
                }

                foreach (dynamic _b in Lang13.Enumerate(S.loc, typeof(Obj_Machinery_Door)))
                {
                    D2 = _b;


                    if (!D2.CanPass(S, this.loc))
                    {
                        this.occupant_message("Unable to load syringe.");
                        return(false);
                    }
                }
                ((Reagents)S.reagents).trans_to(this, S.reagents.total_volume);
                ((Ent_Dynamic)S).forceMove(this);
                this.syringes.Add(S);
                this.occupant_message("Syringe loaded.");
                this.update_equip_info();
                return(true);
            }
            this.occupant_message("The " + this + " syringe chamber is full.");
            return(false);
        }
        // Function from file: tgstation.dme
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic              T    = null;
            Obj_Machinery_Door   door = null;
            Obj_Structure_Closet C    = null;

            thearea.WriteMsg(new Sound("sound/magic/Knock.ogg"));

            foreach (dynamic _c in Lang13.Enumerate(targets))
            {
                T = _c;


                foreach (dynamic _a in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Door)))
                {
                    door = _a;

                    Task13.Schedule(1, (Task13.Closure)(() => {
                        if (door is Obj_Machinery_Door_Airlock)
                        {
                            ((dynamic)door).locked = 0;
                        }
                        door.open();
                        return;
                    }));
                }

                foreach (dynamic _b in Lang13.Enumerate(T.contents, typeof(Obj_Structure_Closet)))
                {
                    C = _b;

                    Task13.Schedule(1, (Task13.Closure)(() => {
                        C.locked = false;
                        C.open();
                        return;
                    }));
                }
            }
            return(false);
        }
Example #5
0
        // Function from file: checkForMultipleDoors.dm
        public bool checkForMultipleDoors(  )
        {
            Obj_Machinery_Door D = null;


            if (!(this.loc != null))
            {
                return(false);
            }

            foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Machinery_Door)))
            {
                D = _a;


                if (!(D is Obj_Machinery_Door_Window) && D.density && D != this)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #6
0
        // Function from file: door_assembly.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            string             t          = null;
            dynamic            WT         = null;
            dynamic            icontype   = null;
            ByTable            optionlist = null;
            bool               has_solid  = false;
            bool               has_glass  = false;
            dynamic            WT2        = null;
            Type               M          = null;
            bool               door_check = false;
            Obj_Machinery_Door D          = null;
            dynamic            C          = null;
            dynamic            ae         = null;
            dynamic            G          = null;
            string             M2         = null;
            dynamic            door       = null;


            if (A is Obj_Item_Weapon_Pen)
            {
                t = GlobalFuncs.stripped_input(user, "Enter the name for the door.", this.name, this.created_name, 26);

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

                if (!(Map13.GetDistance(this, Task13.User) <= 1) && this.loc != Task13.User)
                {
                    return(null);
                }
                this.created_name = t;
                return(null);
            }
            else if (A is Obj_Item_Weapon_AirlockPainter)
            {
                WT = A;

                if (Lang13.Bool(WT.can_use(user)))
                {
                    if (Lang13.Bool(this.mineral) && this.mineral == "glass")
                    {
                        optionlist = new ByTable(new object [] { "Public", "Public2", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Science", "Mining" });
                    }
                    else
                    {
                        optionlist = new ByTable(new object [] { "Public", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Science", "Mining", "Maintenance", "External", "High Security" });
                    }
                    icontype = Interface13.Input(user, "Please select a paintjob for this airlock.", null, null, optionlist, InputType.Any);

                    if (!(Map13.GetDistance(this, Task13.User) <= 1) && this.loc != Task13.User || !Lang13.Bool(WT.use(user)))
                    {
                        return(null);
                    }
                    has_solid = false;
                    has_glass = false;

                    dynamic _a = icontype;                     // Was a switch-case, sorry for the mess.
                    if (_a == "Public")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/public.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "";
                        this.icontext      = "";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Public2")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station2/glass.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station2/overlays.dmi";
                        this.typetext      = "";
                        this.icontext      = "";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Engineering")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/engineering.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "engineering";
                        this.icontext      = "eng";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Atmospherics")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/atmos.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "atmos";
                        this.icontext      = "atmo";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Security")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/security.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "security";
                        this.icontext      = "sec";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Command")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/command.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "command";
                        this.icontext      = "com";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Medical")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/medical.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "medical";
                        this.icontext      = "med";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Research")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/research.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "research";
                        this.icontext      = "res";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Science")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/science.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "research";
                        this.icontext      = "res";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Mining")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/mining.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "mining";
                        this.icontext      = "min";
                        has_solid          = true;
                        has_glass          = true;
                    }
                    else if (_a == "Maintenance")
                    {
                        this.icon          = "icons/obj/doors/airlocks/station/maintenance.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/station/overlays.dmi";
                        this.typetext      = "maintenance";
                        this.icontext      = "mai";
                        has_solid          = true;
                        has_glass          = false;
                    }
                    else if (_a == "External")
                    {
                        this.icon          = "icons/obj/doors/airlocks/external/external.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/external/overlays.dmi";
                        this.typetext      = "external";
                        this.icontext      = "ext";
                        has_solid          = true;
                        has_glass          = false;
                    }
                    else if (_a == "High Security")
                    {
                        this.icon          = "icons/obj/doors/airlocks/highsec/highsec.dmi";
                        this.overlays_file = "icons/obj/doors/airlocks/highsec/overlays.dmi";
                        this.typetext      = "highsecurity";
                        this.icontext      = "highsec";
                        has_solid          = true;
                        has_glass          = false;
                    }

                    if (has_solid)
                    {
                        this.airlock_type = Lang13.FindClass("/obj/machinery/door/airlock/" + this.typetext);
                    }
                    else
                    {
                        this.airlock_type = typeof(Obj_Machinery_Door_Airlock);
                    }

                    if (has_glass)
                    {
                        this.glass_type = Lang13.FindClass("/obj/machinery/door/airlock/glass_" + this.typetext);
                    }
                    else
                    {
                        this.glass_type = typeof(Obj_Machinery_Door_Airlock_Glass);
                    }

                    if (Lang13.Bool(this.mineral) && this.mineral != "glass")
                    {
                        this.mineral = null;
                    }
                    user.WriteMsg("<span class='notice'>You change the paintjob on the airlock assembly.</span>");
                }
            }
            else if (A is Obj_Item_Weapon_Weldingtool && !Lang13.Bool(this.anchored))
            {
                WT2 = A;

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

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (!((Obj_Item_Weapon_Weldingtool)WT2).isOn())
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You disassemble the airlock assembly.</span>");
                        new Obj_Item_Stack_Sheet_Metal(GlobalFuncs.get_turf(this), 4);

                        if (Lang13.Bool(this.mineral))
                        {
                            if (this.mineral == "glass")
                            {
                                if (this.heat_proof_finished)
                                {
                                    new Obj_Item_Stack_Sheet_Rglass(GlobalFuncs.get_turf(this));
                                }
                                else
                                {
                                    new Obj_Item_Stack_Sheet_Glass(GlobalFuncs.get_turf(this));
                                }
                            }
                            else
                            {
                                M = Lang13.FindClass("/obj/item/stack/sheet/mineral/" + this.mineral);
                                Lang13.Call(M, GlobalFuncs.get_turf(this));
                                Lang13.Call(M, GlobalFuncs.get_turf(this));
                            }
                        }
                        GlobalFuncs.qdel(this);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else if (A is Obj_Item_Weapon_Wrench && !Lang13.Bool(this.anchored))
            {
                door_check = true;

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


                    if (!D.sub_door)
                    {
                        door_check = false;
                        break;
                    }
                }

                if (door_check)
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                    ((Ent_Static)user).visible_message("" + user + " secures the airlock assembly to the floor.", "<span class='notice'>You start to secure the airlock assembly to the floor...</span>", "<span class='italics'>You hear wrenching.</span>");

                    if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                    {
                        if (Lang13.Bool(this.anchored))
                        {
                            return(null);
                        }
                        user.WriteMsg("<span class='notice'>You secure the airlock assembly.</span>");
                        this.name     = "secured airlock assembly";
                        this.anchored = 1;
                    }
                }
                else
                {
                    user.WriteMsg("There is another door here!");
                }
            }
            else if (A is Obj_Item_Weapon_Wrench && Lang13.Bool(this.anchored))
            {
                GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 100, 1);
                ((Ent_Static)user).visible_message("" + user + " unsecures the airlock assembly from the floor.", "<span class='notice'>You start to unsecure the airlock assembly from the floor...</span>", "<span class='italics'>You hear wrenching.</span>");

                if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                {
                    if (!Lang13.Bool(this.anchored))
                    {
                        return(null);
                    }
                    user.WriteMsg("<span class='notice'>You unsecure the airlock assembly.</span>");
                    this.name     = "airlock assembly";
                    this.anchored = 0;
                }
            }
            else if (A is Obj_Item_Stack_CableCoil && this.state == 0 && Lang13.Bool(this.anchored))
            {
                C = A;

                if ((((Obj_Item_Stack)C).get_amount() ?? 0) < 1)
                {
                    user.WriteMsg("<span class='warning'>You need one length of cable to wire the airlock assembly!</span>");
                    return(null);
                }
                ((Ent_Static)user).visible_message("" + user + " wires the airlock assembly.", "<span class='notice'>You start to wire the airlock assembly...</span>");

                if (GlobalFuncs.do_after(user, 40, null, this))
                {
                    if ((((Obj_Item_Stack)C).get_amount() ?? 0) < 1 || this.state != 0)
                    {
                        return(null);
                    }
                    C.use(1);
                    this.state = 1;
                    user.WriteMsg("<span class='notice'>You wire the airlock assembly.</span>");
                    this.name = "wired airlock assembly";
                }
            }
            else if (A is Obj_Item_Weapon_Wirecutters && this.state == 1)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 100, 1);
                ((Ent_Static)user).visible_message("" + user + " cuts the wires from the airlock assembly.", "<span class='notice'>You start to cut the wires from the airlock assembly...</span>");

                if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                {
                    if (this.state != 1)
                    {
                        return(null);
                    }
                    user.WriteMsg("<span class='notice'>You cut the wires from the airlock assembly.</span>");
                    new Obj_Item_Stack_CableCoil(GlobalFuncs.get_turf(user), 1);
                    this.state = 0;
                    this.name  = "secured airlock assembly";
                }
            }
            else if (A is Obj_Item_Weapon_Electronics_Airlock && this.state == 1)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                ((Ent_Static)user).visible_message("" + user + " installs the electronics into the airlock assembly.", "<span class='notice'>You start to install electronics into the airlock assembly...</span>");

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

                    if (!Lang13.Bool(user.drop_item()))
                    {
                        return(null);
                    }
                    A.loc = this;
                    user.WriteMsg("<span class='notice'>You install the airlock electronics.</span>");
                    this.state       = 2;
                    this.name        = "near finished airlock assembly";
                    this.electronics = A;
                }
            }
            else if (A is Obj_Item_Weapon_Crowbar && this.state == 2)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);
                ((Ent_Static)user).visible_message("" + user + " removes the electronics from the airlock assembly.", "<span class='notice'>You start to remove electronics from the airlock assembly...</span>");

                if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                {
                    if (this.state != 2)
                    {
                        return(null);
                    }
                    user.WriteMsg("<span class='notice'>You remove the airlock electronics.</span>");
                    this.state = 1;
                    this.name  = "wired airlock assembly";
                    ae         = null;

                    if (!Lang13.Bool(this.electronics))
                    {
                        ae = new Obj_Item_Weapon_Electronics_Airlock(this.loc);
                    }
                    else
                    {
                        ae = this.electronics;
                        this.electronics = null;
                        ae.loc           = this.loc;
                    }
                }
            }
            else if (A is Obj_Item_Stack_Sheet && !Lang13.Bool(this.mineral))
            {
                G = A;

                if (Lang13.Bool(G))
                {
                    if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 1)
                    {
                        if (G is Obj_Item_Stack_Sheet_Rglass || G is Obj_Item_Stack_Sheet_Glass)
                        {
                            GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);
                            ((Ent_Static)user).visible_message("" + user + " adds " + G.name + " to the airlock assembly.", "<span class='notice'>You start to install " + G.name + " into the airlock assembly...</span>");

                            if (GlobalFuncs.do_after(user, 40, null, this))
                            {
                                if ((((Obj_Item_Stack)G).get_amount() ?? 0) < 1 || Lang13.Bool(this.mineral))
                                {
                                    return(null);
                                }

                                if (G.type == typeof(Obj_Item_Stack_Sheet_Rglass))
                                {
                                    user.WriteMsg("<span class='notice'>You install reinforced glass windows into the airlock assembly.</span>");
                                    this.heat_proof_finished = true;
                                    this.name = "near finished heat-proofed window airlock assembly";
                                }
                                else
                                {
                                    user.WriteMsg("<span class='notice'>You install regular glass windows into the airlock assembly.</span>");
                                    this.name = "near finished window airlock assembly";
                                }
                                G.use(1);
                                this.mineral  = "glass";
                                this.material = "glass";

                                if (new ByTable(new object [] { "eng", "atmo", "sec", "com", "med", "res", "min" }).Contains(this.icontext))
                                {
                                    this.airlock_type = Lang13.FindClass("/obj/machinery/door/airlock/" + this.typetext);
                                    this.glass_type   = Lang13.FindClass("/obj/machinery/door/airlock/glass_" + this.typetext);
                                }
                                else
                                {
                                    this.airlock_type = typeof(Obj_Machinery_Door_Airlock);
                                    this.glass_type   = typeof(Obj_Machinery_Door_Airlock_Glass);
                                    this.typetext     = "";
                                    this.icontext     = "";
                                }
                            }
                        }
                        else if (G is Obj_Item_Stack_Sheet_Mineral)
                        {
                            M2 = G.sheettype;

                            if ((((Obj_Item_Stack)G).get_amount() ?? 0) >= 2)
                            {
                                GlobalFuncs.playsound(this.loc, "sound/items/Crowbar.ogg", 100, 1);
                                ((Ent_Static)user).visible_message("" + user + " adds " + G.name + " to the airlock assembly.", "<span class='notice'>You start to install " + G.name + " into the airlock assembly...</span>");

                                if (GlobalFuncs.do_after(user, 40, null, this))
                                {
                                    if ((((Obj_Item_Stack)G).get_amount() ?? 0) < 2 || Lang13.Bool(this.mineral))
                                    {
                                        return(null);
                                    }
                                    user.WriteMsg("<span class='notice'>You install " + M2 + " plating into the airlock assembly.</span>");
                                    G.use(2);
                                    this.mineral      = "" + M2;
                                    this.name         = "near finished " + M2 + " airlock assembly";
                                    this.airlock_type = Lang13.FindClass("/obj/machinery/door/airlock/" + M2);
                                    this.glass_type   = typeof(Obj_Machinery_Door_Airlock_Glass);
                                }
                            }
                        }
                    }
                }
            }
            else if (A is Obj_Item_Weapon_Screwdriver && this.state == 2)
            {
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                ((Ent_Static)user).visible_message("" + user + " finishes the airlock.", "<span class='notice'>You start finishing the airlock...</span>");

                if (GlobalFuncs.do_after(user, 40 / A.toolspeed, null, this))
                {
                    if (this.loc != null && this.state == 2)
                    {
                        user.WriteMsg("<span class='notice'>You finish the airlock.</span>");
                        door = null;

                        if (this.mineral == "glass")
                        {
                            door = Lang13.Call(this.glass_type, this.loc);
                        }
                        else
                        {
                            door = Lang13.Call(this.airlock_type, this.loc);
                        }
                        door.electronics = this.electronics;
                        door.heat_proof  = this.heat_proof_finished;

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

                        if (Lang13.Bool(this.created_name))
                        {
                            door.name = this.created_name;
                        }
                        this.electronics.loc = door;
                        GlobalFuncs.qdel(this);
                    }
                }
            }
            else
            {
                base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            }
            this.update_icon();
            return(null);
        }
Example #7
0
        // Function from file: RCD.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic                       S          = null;
            dynamic                       F          = null;
            bool                          door_check = false;
            Obj_Machinery_Door            D          = null;
            dynamic                       T          = null;
            dynamic                       W          = null;
            dynamic                       F2         = null;
            dynamic                       G          = null;
            Obj_Structure_Grille          GRILLE     = null;
            Obj_Structure_Grille          G2         = null;
            Obj_Structure_Window_Fulltile WD         = null;


            if (!(proximity_flag == true))
            {
                return(false);
            }

            if (target is Zone_Shuttle || target is Tile_Space_Transit)
            {
                return(false);
            }

            if (!(target is Tile || target is Obj_Machinery_Door_Airlock || target is Obj_Structure_Grille || target is Obj_Structure_Window))
            {
                return(false);
            }

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

                if (target is Tile_Space)
                {
                    S = target;

                    if (this.useResource(this.floorcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start building floor...</span>");
                        this.activate();
                        ((Tile)S).ChangeTurf(typeof(Tile_Simulated_Floor_Plating));
                        return(true);
                    }
                    return(false);
                }

                if (target is Tile_Simulated_Floor)
                {
                    F = target;

                    if (this.checkResource(this.wallcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start building wall...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.walldelay, null, target))
                        {
                            if (!this.useResource(this.wallcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            ((Tile)F).ChangeTurf(typeof(Tile_Simulated_Wall));
                            return(true);
                        }
                    }
                    return(false);
                }
                break;

            case 2:

                if (target is Tile_Simulated_Floor)
                {
                    if (this.checkResource(this.airlockcost, user))
                    {
                        door_check = true;

                        foreach (dynamic _a in Lang13.Enumerate(target, typeof(Obj_Machinery_Door)))
                        {
                            D = _a;


                            if (!D.sub_door)
                            {
                                door_check = false;
                                break;
                            }
                        }

                        if (door_check)
                        {
                            user.WriteMsg("<span class='notice'>You start building airlock...</span>");
                            GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                            if (GlobalFuncs.do_after(user, this.airlockdelay, null, target))
                            {
                                if (!this.useResource(this.airlockcost, user))
                                {
                                    return(false);
                                }
                                this.activate();
                                T             = Lang13.Call(this.airlock_type, target);
                                T.electronics = new Obj_Item_Weapon_Electronics_Airlock(this.loc);

                                if (this.conf_access != null)
                                {
                                    T.electronics.accesses = this.conf_access.Copy();
                                }
                                T.electronics.one_access = this.use_one_access;

                                if (T.electronics.one_access)
                                {
                                    T.req_one_access = T.electronics.accesses;
                                }
                                else
                                {
                                    T.req_access = T.electronics.accesses;
                                }

                                if (!((Obj_Machinery_Door)T).checkForMultipleDoors())
                                {
                                    GlobalFuncs.qdel(T);
                                    this.useResource(-this.airlockcost, user);
                                    return(false);
                                }
                                T.autoclose = true;
                                return(true);
                            }
                            return(false);
                        }
                        else
                        {
                            user.WriteMsg("<span class='warning'>There is another door here!</span>");
                            return(false);
                        }
                    }
                    return(false);
                }
                break;

            case 3:

                if (target is Tile_Simulated_Wall)
                {
                    W = target;

                    if (W is Tile_Simulated_Wall_RWall && !this.canRturf)
                    {
                        return(false);
                    }

                    if (this.checkResource(this.deconwallcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start deconstructing wall...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.deconwalldelay, null, target))
                        {
                            if (!this.useResource(this.deconwallcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            ((Tile)W).ChangeTurf(typeof(Tile_Simulated_Floor_Plating));
                            return(true);
                        }
                    }
                    return(false);
                }

                if (target is Tile_Simulated_Floor)
                {
                    F2 = target;

                    if (F2 is Tile_Simulated_Floor_Engine && !this.canRturf)
                    {
                        return(false);
                    }

                    if (Lang13.Bool(((dynamic)F2.baseturf).IsInstanceOfType(F2)))
                    {
                        user.WriteMsg("<span class='notice'>You can't dig any deeper!</span>");
                        return(false);
                    }
                    else if (this.checkResource(this.deconfloorcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start deconstructing floor...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.deconfloordelay, null, target))
                        {
                            if (!this.useResource(this.deconfloorcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            ((Tile)F2).ChangeTurf(F2.baseturf);
                            return(true);
                        }
                    }
                    return(false);
                }

                if (target is Obj_Machinery_Door_Airlock)
                {
                    if (this.checkResource(this.deconairlockcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start deconstructing airlock...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.deconairlockdelay, null, target))
                        {
                            if (!this.useResource(this.deconairlockcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            GlobalFuncs.qdel(target);
                            return(true);
                        }
                    }
                    return(false);
                }

                if (target is Obj_Structure_Window)
                {
                    if (this.checkResource(this.deconwindowcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start deconstructing the window...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.deconwindowdelay, null, target))
                        {
                            if (!this.useResource(this.deconwindowcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            GlobalFuncs.qdel(target);
                            return(true);
                        }
                    }
                    return(false);
                }

                if (target is Obj_Structure_Grille)
                {
                    G = target;

                    if (!((Obj_Structure_Grille)G).shock(user, 90))
                    {
                        if (this.useResource(this.decongrillecost, user))
                        {
                            user.WriteMsg("<span class='notice'>You start deconstructing the grille...</span>");
                            this.activate();
                            GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);
                            GlobalFuncs.qdel(target);
                            return(true);
                        }
                        return(false);
                    }
                }
                break;

            case 4:

                if (target is Tile_Simulated_Floor)
                {
                    if (this.checkResource(this.grillecost, user))
                    {
                        foreach (dynamic _b in Lang13.Enumerate(target, typeof(Obj_Structure_Grille)))
                        {
                            GRILLE = _b;

                            user.WriteMsg("<span class='warning'>There is already a grille there!</span>");
                            return(false);
                        }
                        user.WriteMsg("<span class='notice'>You start building a grille...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.grilledelay, null, target))
                        {
                            if (!this.useResource(this.grillecost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            G2          = new Obj_Structure_Grille(target);
                            G2.anchored = 1;
                            return(true);
                        }
                        return(false);
                    }
                    return(false);
                }

                if (target is Obj_Structure_Grille)
                {
                    if (this.checkResource(this.windowcost, user))
                    {
                        user.WriteMsg("<span class='notice'>You start building a window...</span>");
                        GlobalFuncs.playsound(this.loc, "sound/machines/click.ogg", 50, 1);

                        if (GlobalFuncs.do_after(user, this.windowdelay, null, target))
                        {
                            if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Window), target.loc)))
                            {
                                return(false);
                            }

                            if (!this.useResource(this.windowcost, user))
                            {
                                return(false);
                            }
                            this.activate();
                            WD          = new Obj_Structure_Window_Fulltile(target.loc);
                            WD.anchored = 1;
                            return(true);
                        }
                        return(false);
                    }
                    return(false);
                }
                break;

            default:
                user.WriteMsg("ERROR: RCD in MODE: " + this.mode + " attempted use by " + user + ". Send this text #coderbus or an admin.");
                return(false);

                break;
            }
            return(false);
        }