Esempio n. 1
0
        // Function from file: energy.dm
        public Obj_Effect_Nettingportal(dynamic loc = null) : base((object)(loc))
        {
            dynamic teletarget = null;
            Obj_Machinery_Computer_Teleporter com = null;
            Mob_Living L  = null;
            Mob_Living L2 = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            this.SetLuminosity(3);
            teletarget = null;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_Computer_Teleporter)))
            {
                com = _a;


                if (Lang13.Bool(com.target))
                {
                    if (Lang13.Bool(com.power_station) && Lang13.Bool(com.power_station.teleporter_hub) && Lang13.Bool(com.power_station.engaged))
                    {
                        teletarget = com.target;
                    }
                }
            }

            if (Lang13.Bool(teletarget))
            {
                Task13.Schedule(30, (Task13.Closure)(() => {
                    foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.get_turf(this), typeof(Mob_Living)))
                    {
                        L = _b;

                        GlobalFuncs.do_teleport(L, teletarget, 2);
                    }
                    GlobalFuncs.qdel(this);
                    return;
                }));
            }
            else
            {
                Task13.Schedule(30, (Task13.Closure)(() => {
                    foreach (dynamic _c in Lang13.Enumerate(GlobalFuncs.get_turf(this), typeof(Mob_Living)))
                    {
                        L2 = _c;

                        GlobalFuncs.do_teleport(L2, L2, 15);
                    }
                    GlobalFuncs.qdel(this);
                    return;
                }));
            }
            return;
        }
Esempio n. 2
0
        // Function from file: teleportation.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            dynamic current_location = null;
            ByTable L = null;
            Obj_Machinery_Computer_Teleporter com = null;
            ByTable           turfs = null;
            dynamic           T     = null;
            dynamic           t1    = null;
            dynamic           T2    = null;
            Obj_Effect_Portal P     = null;

            current_location = GlobalFuncs.get_turf(user);

            if (!Lang13.Bool(current_location) || Convert.ToInt32(current_location.z) == 2 || Convert.ToDouble(current_location.z) >= 7 || !(user.loc is Tile))
            {
                user.WriteMsg(new Txt("<span class='notice'>").The(this).item().str(" is malfunctioning.</span>").ToString());
                return(null);
            }
            L = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_Computer_Teleporter)))
            {
                com = _a;


                if (Lang13.Bool(com.target))
                {
                    if (Lang13.Bool(com.power_station) && Lang13.Bool(com.power_station.teleporter_hub) && Lang13.Bool(com.power_station.engaged))
                    {
                        L["" + GlobalFuncs.get_area(com.target) + " (Active)"] = com.target;
                    }
                    else
                    {
                        L["" + GlobalFuncs.get_area(com.target) + " (Inactive)"] = com.target;
                    }
                }
            }
            turfs = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.ultra_range(10, null, true)))
            {
                T = _b;


                if (Convert.ToDouble(T.x) > Game13.map_size_x - 8 || Convert.ToDouble(T.x) < 8)
                {
                    continue;
                }

                if (Convert.ToDouble(T.y) > Game13.map_size_y - 8 || Convert.ToDouble(T.y) < 8)
                {
                    continue;
                }
                turfs.Add(T);
            }

            if (turfs.len != 0)
            {
                L["None (Dangerous)"] = Rand13.PickFromTable(turfs);
            }
            t1 = Interface13.Input(user, "Please select a teleporter to lock in on.", "Hand Teleporter", null, L, InputType.Any);

            if (((Mob)user).get_active_hand() != this || ((Mob)user).incapacitated())
            {
                return(null);
            }

            if (this.active_portals >= 3)
            {
                user.show_message(new Txt("<span class='notice'>").The(this).item().str(" is recharging!</span>").ToString());
                return(null);
            }
            T2 = L[t1];
            user.show_message("<span class='notice'>Locked In.</span>", 2);
            P = new Obj_Effect_Portal(GlobalFuncs.get_turf(this), T2, this);
            GlobalFuncs.try_move_adjacent(P);
            this.active_portals++;
            this.add_fingerprint(user);
            return(null);
        }