Esempio n. 1
0
        // Function from file: items.dm
        public void begin_event(  )
        {
            Obj_Structure_Window W = null;
            dynamic M = null;

            this.eventstarted = true;

            foreach (dynamic _a in Lang13.Enumerate(this.currentarea, typeof(Obj_Structure_Window)))
            {
                W = _a;


                if (Lang13.Bool(W.flags & 128))
                {
                    GlobalFuncs.qdel(W);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(this.currentarea))
            {
                M = _b;

                M.WriteMsg("FIGHT!");
            }
            return;
        }
Esempio n. 2
0
        // Function from file: AStar.dm
        public bool LinkBlockedWithAccess(Tile T = null, dynamic caller = null, dynamic ID = null)
        {
            int adir = 0;
            int rdir = 0;
            Obj_Structure_Window W = null;
            Obj O = null;

            adir = Map13.GetDistance(this, T);
            rdir = Map13.GetDistance(T, this);

            foreach (dynamic _a in Lang13.Enumerate(this, typeof(Obj_Structure_Window)))
            {
                W = _a;


                if (!W.CanAStarPass(ID, adir))
                {
                    return(true);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(T, typeof(Obj)))
            {
                O = _b;


                if (!O.CanAStarPass(ID, rdir, caller))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
        // Function from file: blueprints.dm
        public dynamic detect_room(dynamic first = null)
        {
            ByTable                   found     = null;
            ByTable                   pending   = null;
            ByTable                   border    = null;
            Ent_Static                T         = null;
            dynamic                   dir       = null;
            bool                      skip      = false;
            Obj_Structure_Window      W         = null;
            Obj_Machinery_Door_Window D         = null;
            Tile                      NT        = null;
            Ent_Static                A         = null;
            dynamic                   V         = null;
            dynamic                   F         = null;
            dynamic                   direction = null;
            Tile                      U         = null;

            found   = new ByTable();
            pending = new ByTable(new object [] { first });
            border  = new ByTable();

            while (pending.len != 0)
            {
                if (found.len + pending.len > 300)
                {
                    return(GlobalVars.ROOM_ERR_TOOLARGE);
                }
                T = pending[1];
                pending.Remove(T);

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

                    skip = false;

                    foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj_Structure_Window)))
                    {
                        W = _a;


                        if (dir == W.dir || new ByTable(new object [] { GlobalVars.NORTHEAST, GlobalVars.SOUTHEAST, GlobalVars.NORTHWEST, GlobalVars.SOUTHWEST }).Contains(W.dir))
                        {
                            skip = true;
                            break;
                        }
                    }

                    if (skip)
                    {
                        continue;
                    }

                    foreach (dynamic _b in Lang13.Enumerate(T, typeof(Obj_Machinery_Door_Window)))
                    {
                        D = _b;


                        if (dir == D.dir)
                        {
                            skip = true;
                            break;
                        }
                    }

                    if (skip)
                    {
                        continue;
                    }
                    NT = Map13.GetStep(T, Convert.ToInt32(dir));

                    if (!(NT is Tile) || found.Contains(NT) || pending.Contains(NT))
                    {
                        continue;
                    }

                    switch ((int)(this.check_tile_is_border(NT, dir)))
                    {
                    case 1:
                        pending.Add(NT);
                        break;

                    case 2:
                        A = NT.loc;

                        if (!Lang13.Bool(found[A.name]))
                        {
                            found[A.name] = NT.loc;
                        }
                        break;

                    case 3:
                        border[NT] += dir;
                        break;

                    case 4:
                        return(GlobalVars.ROOM_ERR_SPACE);

                        break;
                    }
                }
                found.Add(T);
            }

            foreach (dynamic _f in Lang13.Enumerate(border))
            {
                V = _f;

                F = V;

                foreach (dynamic _e in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    direction = _e;


                    if (direction == border[F])
                    {
                        continue;
                    }
                    U = Map13.GetStep(F, Convert.ToInt32(direction));

                    if (border.Contains(U) || found.Contains(U))
                    {
                        continue;
                    }

                    if (this.check_tile_is_border(U, direction) == GlobalVars.BORDER_2NDTILE)
                    {
                        found.Add(U);
                    }
                }
                found.Or(F);
            }
            return(found);
        }
Esempio n. 4
0
        // Function from file: blueprints.dm
        public int check_tile_is_border(Tile T2 = null, dynamic dir = null)
        {
            Obj_Structure_Window      W = null;
            Obj_Machinery_Door_Window D = null;


            if (T2 is Tile_Space)
            {
                return(GlobalVars.BORDER_SPACE);
            }

            if (this.get_area_type(T2.loc) != GlobalVars.AREA_SPACE)
            {
                return(GlobalVars.BORDER_BETWEEN);
            }

            if (T2 is Tile_Simulated_Wall)
            {
                return(GlobalVars.BORDER_2NDTILE);
            }

            if (!(T2 is Tile_Simulated))
            {
                return(GlobalVars.BORDER_BETWEEN);
            }

            foreach (dynamic _a in Lang13.Enumerate(T2, typeof(Obj_Structure_Window)))
            {
                W = _a;


                if (Num13.Rotate(dir, 180) == W.dir)
                {
                    return(GlobalVars.BORDER_BETWEEN);
                }

                if (new ByTable(new object [] { GlobalVars.NORTHEAST, GlobalVars.SOUTHEAST, GlobalVars.NORTHWEST, GlobalVars.SOUTHWEST }).Contains(W.dir))
                {
                    return(GlobalVars.BORDER_2NDTILE);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(T2, typeof(Obj_Machinery_Door_Window)))
            {
                D = _b;


                if (Num13.Rotate(dir, 180) == D.dir)
                {
                    return(GlobalVars.BORDER_BETWEEN);
                }
            }

            if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Machinery_Door), T2)))
            {
                return(GlobalVars.BORDER_2NDTILE);
            }

            if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Falsewall), T2)))
            {
                return(GlobalVars.BORDER_2NDTILE);
            }
            return(GlobalVars.BORDER_NONE ?1:0);
        }
        // Function from file: revenant_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic T     = null;
            dynamic floor = null;
            Obj_Structure_Closet        closet       = null;
            Obj_Structure_Bodycontainer corpseholder = null;
            Obj_Machinery_DnaScannernew dna          = null;
            Obj_Structure_Window        window       = null;
            Obj_Machinery_Light         light        = null;


            if (this.attempt_cast(thearea))
            {
                foreach (dynamic _f in Lang13.Enumerate(targets))
                {
                    T = _f;

                    Task13.Schedule(0, (Task13.Closure)(() => {
                        if (Lang13.Bool(T.flags & 1))
                        {
                            T.flags -= 1;
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), T);
                        }

                        if (!(T is Tile_Simulated_Floor_Plating) && !(T is Tile_Simulated_Floor_Engine_Cult) && T is Tile_Simulated_Floor && Rand13.PercentChance(15))
                        {
                            floor = T;

                            if (floor.intact)
                            {
                                floor.builtin_tile.loc = floor;
                            }
                            floor.broken = 0;
                            floor.burnt  = false;
                            ((Tile_Simulated_Floor)floor).make_plating(true);
                        }

                        if (!(T is Tile_Simulated_Wall_Shuttle) && !(T is Tile_Simulated_Wall_Cult) && !(T is Tile_Simulated_Wall_Rust) && !(T is Tile_Simulated_Wall_RWall) && T is Tile_Simulated_Wall && Rand13.PercentChance(15))
                        {
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), T);
                            ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Wall_Rust));
                        }

                        if (!(T is Tile_Simulated_Wall_RWall_Rust) && T is Tile_Simulated_Wall_RWall && Rand13.PercentChance(15))
                        {
                            GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant), T);
                            ((Tile)T).ChangeTurf(typeof(Tile_Simulated_Wall_RWall_Rust));
                        }

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

                            closet.open();
                        }

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


                            if (corpseholder.connected.loc == corpseholder)
                            {
                                corpseholder.open();
                            }
                        }

                        foreach (dynamic _c in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_DnaScannernew)))
                        {
                            dna = _c;

                            dna.open_machine();
                        }

                        foreach (dynamic _d in Lang13.Enumerate(T.contents, typeof(Obj_Structure_Window)))
                        {
                            window = _d;

                            window.hit(Rand13.Int(50, 90));

                            if (window != null && window.fulltile)
                            {
                                GlobalFuncs.PoolOrNew(typeof(Obj_Effect_Overlay_Temp_Revenant_Cracks), window.loc);
                            }
                        }

                        foreach (dynamic _e in Lang13.Enumerate(T.contents, typeof(Obj_Machinery_Light)))
                        {
                            light = _e;

                            light.flicker(20);
                        }
                        return;
                    }));
                }
            }
            return(false);
        }
        // Function from file: shadowling_abilities.dm
        public override bool cast(dynamic targets = null, dynamic thearea = null, dynamic user = null)
        {
            thearea = thearea ?? Task13.User;

            dynamic T      = null;
            dynamic target = null;
            dynamic M      = null;
            dynamic S      = null;
            EffectSystem_SparkSpread sp = null;
            Obj_Structure_Window     W  = null;


            if (!this.shadowling_check(thearea))
            {
                this.revert_cast();
                return(false);
            }
            ((Ent_Static)thearea).audible_message("<span class='warning'><b>" + thearea + " lets out a horrible scream!</b></span>");

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


                foreach (dynamic _a in Lang13.Enumerate(T.contents))
                {
                    target = _a;


                    if (GlobalFuncs.is_shadow_or_thrall(target))
                    {
                        if (target == thearea)
                        {
                            continue;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (target is Mob_Living_Carbon)
                    {
                        M = target;
                        M.WriteMsg("<span class='danger'><b>A spike of pain drives into your head and scrambles your thoughts!</b></span>");
                        M.confused += 10;
                        ((Mob)M).setEarDamage(M.ear_damage + 3);
                    }
                    else if (target is Mob_Living_Silicon)
                    {
                        S = target;
                        S.WriteMsg("<span class='warning'><b>ERROR $!(@ ERROR )#^! SENSORY OVERLOAD [$(!@#</b></span>");
                        S.WriteMsg("sound/misc/interference.ogg");
                        GlobalFuncs.playsound(S, "sound/machines/warning-buzzer.ogg", 50, 1);
                        sp = new EffectSystem_SparkSpread();
                        sp.set_up(5, 1, S);
                        sp.start();
                        ((Mob)S).Weaken(6);
                    }
                }

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

                    W.hit(Rand13.Int(80, 100));
                }
            }
            return(false);
        }
Esempio n. 7
0
        // Function from file: glass.dm
        public bool construct_window(dynamic user = null)
        {
            string  title                    = null;
            ByTable directions               = null;
            int     i                        = 0;
            Obj_Structure_Window win         = null;
            dynamic dir_to_set               = null;
            dynamic direction                = null;
            bool    found                    = false;
            Obj_Structure_Window          WT = null;
            Obj_Structure_Window          W  = null;
            Obj_Structure_Window_Fulltile W2 = null;


            if (!Lang13.Bool(user) || !(this != null))
            {
                return(false);
            }

            if (!(user.loc is Tile))
            {
                return(false);
            }

            if (!((Mob)user).IsAdvancedToolUser())
            {
                user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>");
                return(false);
            }

            if (this.zero_amount())
            {
                return(false);
            }
            title  = "Sheet-Glass";
            title += new Txt(" (").item(this.get_amount()).str(" sheet").s().str(" left)").ToString();

            switch ((string)(Interface13.Alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel")))
            {
            case "One Direction":

                if (!(this != null))
                {
                    return(true);
                }

                if (this.loc != user)
                {
                    return(true);
                }
                directions = new ByTable(GlobalVars.cardinal);
                i          = 0;

                foreach (dynamic _a in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window)))
                {
                    win = _a;

                    i++;

                    if (i >= 4)
                    {
                        user.WriteMsg("<span class='warning'>There are too many windows in this location.</span>");
                        return(true);
                    }
                    directions.Remove(win.dir);

                    if (!GlobalVars.cardinal.Contains(win.ini_dir))
                    {
                        user.WriteMsg("<span class='danger'>Can't let you do that.</span>");
                        return(true);
                    }
                }
                dir_to_set = 2;

                foreach (dynamic _c in Lang13.Enumerate(new ByTable(new object [] { user.dir, Num13.Rotate(user.dir, 90), Num13.Rotate(user.dir, 180), Num13.Rotate(user.dir, 270) })))
                {
                    direction = _c;

                    found = false;

                    foreach (dynamic _b in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window)))
                    {
                        WT = _b;


                        if (WT.dir == direction)
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        dir_to_set = direction;
                        break;
                    }
                }
                W          = null;
                W          = new Obj_Structure_Window(user.loc, false);
                W.dir      = Convert.ToInt32(dir_to_set);
                W.ini_dir  = W.dir;
                W.anchored = 0;
                W.air_update_turf(true);
                this.use(1);
                W.add_fingerprint(user);
                break;

            case "Full Window":

                if (!(this != null))
                {
                    return(true);
                }

                if (this.loc != user)
                {
                    return(true);
                }

                if ((this.get_amount() ?? 0) < 2)
                {
                    user.WriteMsg("<span class='warning'>You need more glass to do that!</span>");
                    return(true);
                }

                if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Window), user.loc)))
                {
                    user.WriteMsg("<span class='warning'>There is a window in the way!</span>");
                    return(true);
                }
                W2          = null;
                W2          = new Obj_Structure_Window_Fulltile(user.loc, false);
                W2.anchored = 0;
                W2.air_update_turf(true);
                W2.add_fingerprint(user);
                this.use(2);
                break;
            }
            return(false);
        }
Esempio n. 8
0
        // Function from file: grille.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic R                    = null;
            dynamic ST                   = null;
            double? dir_to_set           = null;
            Obj_Structure_Window WINDOW  = null;
            Obj_Structure_Window WINDOW2 = null;
            Obj_Structure_Window WD      = null;

            ((Mob)user).changeNext_move(8);
            this.add_fingerprint(user);

            if (A is Obj_Item_Weapon_Wirecutters)
            {
                if (!this.shock(user, 100))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Wirecutter.ogg", 100, 1);
                    this.Deconstruct();
                }
            }
            else if (A is Obj_Item_Weapon_Screwdriver && (this.loc is Tile_Simulated || Lang13.Bool(this.anchored)))
            {
                if (!this.shock(user, 90))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 100, 1);
                    this.anchored = !Lang13.Bool(this.anchored);
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " " + (Lang13.Bool(this.anchored) ? "fastens" : "unfastens") + " " + this + ".</span>", "<span class='notice'>You " + (Lang13.Bool(this.anchored) ? "fasten " + this + " to" : "unfasten " + this + " from") + " the floor.</span>");
                    return(null);
                }
            }
            else if (A is Obj_Item_Stack_Rods && this.destroyed)
            {
                R = A;

                if (!this.shock(user, 90))
                {
                    ((Ent_Static)user).visible_message("<span class='notice'>" + user + " rebuilds the broken grille.</span>", "<span class='notice'>You rebuild the broken grille.</span>");
                    this.health     = 10;
                    this.density    = true;
                    this.destroyed  = false;
                    this.icon_state = "grille";
                    R.use(1);
                    return(null);
                }
            }
            else if (A is Obj_Item_Weapon_Rcd && this.loc is Tile_Simulated)
            {
                return(null);
            }
            else if (A is Obj_Item_Stack_Sheet_Rglass || A is Obj_Item_Stack_Sheet_Glass)
            {
                if (!this.destroyed)
                {
                    ST = A;

                    if ((((Obj_Item_Stack)ST).get_amount() ?? 0) < 2)
                    {
                        user.WriteMsg("<span class='warning'>You need at least two sheets of glass for that!</span>");
                        return(null);
                    }
                    dir_to_set = GlobalVars.SOUTHWEST;

                    if (!Lang13.Bool(this.anchored))
                    {
                        user.WriteMsg("<span class='warning'>" + this + " needs to be fastened to the floor first!</span>");
                        return(null);
                    }

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

                        user.WriteMsg("<span class='warning'>There is already a window there!</span>");
                        return(null);
                    }
                    user.WriteMsg("<span class='notice'>You start placing the window...</span>");

                    if (GlobalFuncs.do_after(user, 20, null, this))
                    {
                        if (!(this.loc != null) || !Lang13.Bool(this.anchored))
                        {
                            return(null);
                        }

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

                            return(null);
                        }
                        WD = null;

                        if (A is Obj_Item_Stack_Sheet_Rglass)
                        {
                            WD = new Obj_Structure_Window_Reinforced_Fulltile(this.loc);
                        }
                        else
                        {
                            WD = new Obj_Structure_Window_Fulltile(this.loc);
                        }
                        WD.dir      = ((int)(dir_to_set ?? 0));
                        WD.ini_dir  = dir_to_set;
                        WD.anchored = 0;
                        WD.state    = 0;
                        ST.use(2);
                        user.WriteMsg("<span class='notice'>You place " + WD + " on " + this + ".</span>");
                    }
                    return(null);
                }
            }
            else if (A is Obj_Item_Weapon_Shard)
            {
                GlobalFuncs.playsound(this.loc, "sound/effects/grillehit.ogg", 80, 1);
                this.health -= Convert.ToDouble(A.force * 0.1);
            }
            else if (!this.shock(user, 70))
            {
                dynamic _c = A.damtype;                 // Was a switch-case, sorry for the mess.
                if (_c == "stamina")
                {
                    return(null);
                }
                else if (_c == "fire")
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/welder.ogg", 80, 1);
                }
                else
                {
                    GlobalFuncs.playsound(this.loc, "sound/effects/grillehit.ogg", 80, 1);
                }
                this.health -= Convert.ToDouble(A.force * 0.3);
            }
            this.healthcheck();
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
Esempio n. 9
0
        // Function from file: glass.dm
        public bool construct_window(dynamic user = null)
        {
            string  title            = null;
            ByTable directions       = null;
            int     i                = 0;
            Obj_Structure_Window win = null;
            dynamic dir_to_set       = null;
            dynamic direction        = null;
            bool    found            = false;
            Obj_Structure_Window                     WT = null;
            Obj_Structure_Window_Reinforced          W  = null;
            Obj_Structure_Window_Reinforced_Fulltile W2 = null;
            Obj_Structure_WindoorAssembly            WA = null;
            Obj_Machinery_Door_Window                W3 = null;
            Obj_Structure_WindoorAssembly            WD = null;


            if (!Lang13.Bool(user) || !(this != null))
            {
                return(false);
            }

            if (!(user.loc is Tile))
            {
                return(false);
            }

            if (!((Mob)user).IsAdvancedToolUser())
            {
                user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>");
                return(false);
            }
            title  = "Sheet Reinf. Glass";
            title += new Txt(" (").item(this.get_amount()).str(" sheet").s().str(" left)").ToString();

            dynamic _g = Interface13.Input(title, "Would you like full tile glass a one direction glass pane or a windoor?", null, null, new ByTable(new object [] { "One Direction", "Full Window", "Windoor", "Cancel" }), InputType.Any);               // Was a switch-case, sorry for the mess.

            if (_g == "One Direction")
            {
                if (!(this != null))
                {
                    return(true);
                }

                if (this.loc != user)
                {
                    return(true);
                }
                directions = new ByTable(GlobalVars.cardinal);
                i          = 0;

                foreach (dynamic _a in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window)))
                {
                    win = _a;

                    i++;

                    if (i >= 4)
                    {
                        user.WriteMsg("<span class='danger'>There are too many windows in this location.</span>");
                        return(true);
                    }
                    directions.Remove(win.dir);

                    if (!GlobalVars.cardinal.Contains(win.ini_dir))
                    {
                        user.WriteMsg("<span class='danger'>Can't let you do that.</span>");
                        return(true);
                    }
                }
                dir_to_set = 2;

                foreach (dynamic _c in Lang13.Enumerate(new ByTable(new object [] { user.dir, Num13.Rotate(user.dir, 90), Num13.Rotate(user.dir, 180), Num13.Rotate(user.dir, 270) })))
                {
                    direction = _c;

                    found = false;

                    foreach (dynamic _b in Lang13.Enumerate(user.loc, typeof(Obj_Structure_Window)))
                    {
                        WT = _b;


                        if (WT.dir == direction)
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        dir_to_set = direction;
                        break;
                    }
                }
                W          = null;
                W          = new Obj_Structure_Window_Reinforced(user.loc, true);
                W.state    = 0;
                W.dir      = Convert.ToInt32(dir_to_set);
                W.ini_dir  = W.dir;
                W.anchored = 0;
                W.add_fingerprint(user);
                this.use(1);
            }
            else if (_g == "Full Window")
            {
                if (!(this != null))
                {
                    return(true);
                }

                if (this.loc != user)
                {
                    return(true);
                }

                if ((this.get_amount() ?? 0) < 2)
                {
                    user.WriteMsg("<span class='warning'>You need more glass to do that!</span>");
                    return(true);
                }

                if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_Window), user.loc)))
                {
                    user.WriteMsg("<span class='warning'>There is a window in the way!</span>");
                    return(true);
                }
                W2          = null;
                W2          = new Obj_Structure_Window_Reinforced_Fulltile(user.loc, true);
                W2.state    = 0;
                W2.anchored = 0;
                W2.add_fingerprint(user);
                this.use(2);
            }
            else if (_g == "Windoor")
            {
                if (!(this != null) || this.loc != user || !(user.loc is Tile))
                {
                    return(true);
                }

                foreach (dynamic _d in Lang13.Enumerate(user.loc, typeof(Obj_Structure_WindoorAssembly)))
                {
                    WA = _d;


                    if (WA.dir == Convert.ToInt32(user.dir))
                    {
                        user.WriteMsg("<span class='warning'>There is already a windoor assembly in that location!</span>");
                        return(true);
                    }
                }

                foreach (dynamic _e in Lang13.Enumerate(user.loc, typeof(Obj_Machinery_Door_Window)))
                {
                    W3 = _e;


                    if (W3.dir == Convert.ToInt32(user.dir))
                    {
                        user.WriteMsg("<span class='warning'>There is already a windoor in that location!</span>");
                        return(true);
                    }
                }

                if ((this.get_amount() ?? 0) < 5)
                {
                    user.WriteMsg("<span class='warning'>You need more glass to do that!</span>");
                    return(true);
                }
                WD          = new Obj_Structure_WindoorAssembly(user.loc);
                WD.state    = "01";
                WD.anchored = 0;
                WD.add_fingerprint(user);
                this.use(5);

                dynamic _f = user.dir;                 // Was a switch-case, sorry for the mess.
                if (_f == 2)
                {
                    WD.dir     = ((int)(GlobalVars.SOUTH));
                    WD.ini_dir = GlobalVars.SOUTH;
                }
                else if (_f == 4)
                {
                    WD.dir     = ((int)(GlobalVars.EAST));
                    WD.ini_dir = GlobalVars.EAST;
                }
                else if (_f == 8)
                {
                    WD.dir     = ((int)(GlobalVars.WEST));
                    WD.ini_dir = GlobalVars.WEST;
                }
                else
                {
                    WD.dir     = ((int)(GlobalVars.NORTH));
                    WD.ini_dir = GlobalVars.NORTH;
                }
            }
            else
            {
                return(true);
            }
            return(false);
        }