Ejemplo n.º 1
0
        // Function from file: turf.dm
        public void Assimilate_Air(  )
        {
            GasMixture total       = null;
            ByTable    total_gases = null;
            int        turf_count  = 0;
            dynamic    direction   = null;
            Tile       T           = null;
            Tile       S           = null;
            ByTable    S_gases     = null;
            dynamic    id          = null;
            ByTable    air_gases   = null;
            dynamic    id2         = null;


            if (this.air != null)
            {
                total       = new GasMixture();
                total_gases = total.gases;
                turf_count  = 0;

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

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

                    if (T is Tile_Space)
                    {
                        turf_count++;
                        continue;
                    }

                    if (T is Tile_Simulated_Floor)
                    {
                        S = T;

                        if (Lang13.Bool(((dynamic)S).air))
                        {
                            S_gases = ((dynamic)S).air.gases;

                            foreach (dynamic _a in Lang13.Enumerate(S_gases))
                            {
                                id = _a;

                                total.assert_gas(id);
                                total_gases[id][1] += S_gases[id][1];
                            }
                            total.temperature += ((dynamic)S).air.temperature;
                        }
                        turf_count++;
                    }
                }
                this.air.copy_from(total);

                if (turf_count != 0)
                {
                    air_gases = this.air.gases;

                    foreach (dynamic _c in Lang13.Enumerate(air_gases))
                    {
                        id2 = _c;

                        air_gases[id2][1] /= turf_count;
                    }
                    this.air.temperature /= turf_count;
                }
                GlobalVars.SSair.add_to_active(this);
            }
            return;
        }
Ejemplo n.º 2
0
        // Function from file: swapmaps.dm
        public ByTable ConsiderRegion(int X1 = 0, int Y1 = 0, int X2 = 0, int Y2 = 0, int?Z1 = null, int?Z2 = null)
        {
            ByTable _default = null;

            int     nextz = 0;
            Swapmap M     = null;
            int?    nz2   = null;


            while (true)
            {
                nextz = 0;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.swapmaps_loaded, typeof(Swapmap)))
                {
                    M = _a;


                    if ((M.z2 ?? 0) < (Z1 ?? 0) || Lang13.Bool(Z2) && (M.z1 ?? 0) > (Z2 ?? 0) || (M.z1 ?? 0) >= (Z1 ?? 0) + (this.z2 ?? 0) || M.x1 > X2 || M.x2 < X1 || M.x1 >= X1 + this.x2 || M.y1 > Y2 || M.y2 < Y1 || M.y1 >= Y1 + this.y2)
                    {
                        continue;
                    }
                    nz2 = (Lang13.Bool(Z2) ? Z2 : (Z1 ?? 0) + (this.z2 ?? 0) - 1 + (M.z2 ?? 0) - (M.z1 ?? 0));

                    if (M.x1 >= X1 + this.x2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, M.x1 - 1, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.x2 <= X2 - this.x2)
                    {
                        _default = this.ConsiderRegion(M.x2 + 1, Y1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }

                    if (M.y1 >= Y1 + this.y2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, X2, M.y1 - 1, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.y2 <= Y2 - this.y2)
                    {
                        _default = this.ConsiderRegion(X1, M.y2 + 1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    nextz = (nextz != 0 ? Num13.MinInt(nextz, (M.z2 ?? 0) + 1) : (M.z2 ?? 0) + 1);
                }

                if (!(M != null))
                {
                    if (nextz != 0)
                    {
                        Z1 = nextz;
                    }

                    if (!(nextz != 0) || Lang13.Bool(Z2) && (Z2 ?? 0) - (Z1 ?? 0) + 1 < (this.z2 ?? 0))
                    {
                        return(!Lang13.Bool(Z2) || (Z2 ?? 0) - (Z1 ?? 0) + 1 >= (this.z2 ?? 0) ? new ByTable(new object [] { X1, Y1, Z1 }) : null);
                    }
                    X1 = 1;
                    X2 = Game13.map_size_x;
                    Y1 = 1;
                    Y2 = Game13.map_size_y;
                }
            }
            return(_default);
        }
Ejemplo n.º 3
0
        // Function from file: swapmaps.dm
        public override void Write(SaveFile F = null)
        {
            double  x       = 0;
            double  y       = 0;
            double  z       = 0;
            dynamic n       = null;
            ByTable areas   = null;
            dynamic defarea = null;
            dynamic T       = null;
            string  oldcd   = null;
            Tile    T2      = null;

            defarea = Lang13.FindObj(Game13.default_zone);

            if (!Lang13.Bool(defarea))
            {
                defarea = Lang13.Call(Game13.default_zone);
            }
            areas = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(this.x1, this.y1, this.z1 ?? 0), Map13.GetTile(this.x2, this.y2, this.z2 ?? 0))))
            {
                T = _a;

                areas[T.loc] = null;
            }

            foreach (dynamic _b in Lang13.Enumerate(areas))
            {
                n = _b;

                areas.Remove(n);
                areas.Add(n);
            }
            areas.Remove(defarea);
            GlobalFuncs.InitializeSwapMaps();
            this.locked = true;
            F["id"]     = this.id;
            F["z"]      = (this.z2 ?? 0) - (this.z1 ?? 0) + 1;
            F["y"]      = this.y2 - this.y1 + 1;
            F["x"]      = this.x2 - this.x1 + 1;
            F["areas"]  = areas;

            foreach (dynamic _c in Lang13.IterateRange(1, areas.len))
            {
                n = _c;

                areas[areas[n]] = n;
            }
            oldcd = F.cd;

            foreach (dynamic _f in Lang13.IterateRange(this.z1, this.z2))
            {
                z = _f;

                F.cd = "" + (z - (this.z1 ?? 0) + 1);

                foreach (dynamic _e in Lang13.IterateRange(this.y1, this.y2))
                {
                    y = _e;

                    F.cd = "" + (y - this.y1 + 1);

                    foreach (dynamic _d in Lang13.IterateRange(this.x1, this.x2))
                    {
                        x = _d;

                        F.cd      = "" + (x - this.x1 + 1);
                        T2        = Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z)));
                        F["type"] = T2.type;

                        if (T2.loc != defarea)
                        {
                            F["AREA"] = areas[T2.loc];
                        }
                        T2.Write(F);
                        F.cd = "..";
                    }
                    F.cd = "..";
                }
                Task13.Sleep(0);
                F.cd = oldcd;
            }
            this.locked = false;
            GlobalFuncs.qdel(areas);
            return;
        }
Ejemplo n.º 4
0
        // Function from file: ticker.dm
        public bool setup(  )
        {
            ByTable  runnable_modes = null;
            dynamic  smode          = null;
            bool     can_continue   = false;
            dynamic  modes          = null;
            GameMode M                  = null;
            dynamic  holidayname        = null;
            Holiday  holiday            = null;
            Obj_Effect_Landmark_Start S = null;


            if (GlobalVars.master_mode == "random" || GlobalVars.master_mode == "secret")
            {
                runnable_modes = GlobalVars.config.get_runnable_modes();

                if (GlobalVars.master_mode == "secret")
                {
                    this.hide_mode = true;

                    if (GlobalVars.secret_force_mode != "secret")
                    {
                        smode = GlobalVars.config.pick_mode(GlobalVars.secret_force_mode);

                        if (!((GameMode)smode).can_start())
                        {
                            GlobalFuncs.message_admins(new Txt().blue().str("Unable to force secret ").item(GlobalVars.secret_force_mode).str(". ").item(smode.required_players).str(" players and ").item(smode.required_enemies).str(" eligible antagonists needed.").ToString());
                        }
                        else
                        {
                            this.mode = smode;
                        }
                    }
                }

                if (!Lang13.Bool(this.mode))
                {
                    if (!(runnable_modes.len != 0))
                    {
                        Game13.WriteMsg("<B>Unable to choose playable game mode.</B> Reverting to pre-game lobby.");
                        return(false);
                    }
                    this.mode = GlobalFuncs.pickweight(runnable_modes);
                }
            }
            else
            {
                this.mode = GlobalVars.config.pick_mode(GlobalVars.master_mode);

                if (!((GameMode)this.mode).can_start())
                {
                    Game13.WriteMsg("<B>Unable to start " + this.mode.name + ".</B> Not enough players, " + this.mode.required_players + " players and " + this.mode.required_enemies + " eligible antagonists needed. Reverting to pre-game lobby.");
                    GlobalFuncs.qdel(this.mode);
                    this.mode = null;
                    GlobalVars.SSjob.ResetOccupations();
                    return(false);
                }
            }
            can_continue = false;
            can_continue = ((GameMode)this.mode).pre_setup();
            GlobalVars.SSjob.DivideOccupations();

            if (!GlobalVars.Debug2)
            {
                if (!can_continue)
                {
                    GlobalFuncs.qdel(this.mode);
                    this.mode = null;
                    Game13.WriteMsg("<B>Error setting up " + GlobalVars.master_mode + ".</B> Reverting to pre-game lobby.");
                    GlobalVars.SSjob.ResetOccupations();
                    return(false);
                }
            }
            else
            {
                Game13.WriteMsg("<span class='notice'>DEBUG: Bypassing prestart checks...");
            }

            if (this.hide_mode)
            {
                modes = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(runnable_modes, typeof(GameMode)))
                {
                    M = _a;

                    modes += M.name;
                }
                modes = GlobalFuncs.sortList(modes);
                Game13.WriteMsg("<B>The current game mode is - Secret!</B>");
                Game13.WriteMsg("<B>Possibilities:</B> " + GlobalFuncs.english_list(modes));
            }
            else
            {
                ((GameMode)this.mode).announce();
            }
            this.current_state = 3;

            if (!GlobalVars.config.ooc_during_round)
            {
                GlobalFuncs.toggle_ooc(false);
            }
            GlobalVars.round_start_time     = Game13.time;
            GlobalVars.start_landmarks_list = GlobalFuncs.shuffle(GlobalVars.start_landmarks_list);
            this.create_characters();
            this.collect_minds();
            this.equip_characters();
            GlobalVars.data_core.manifest();
            GlobalVars.Master.RoundStart();
            Game13.WriteMsg("<FONT color='blue'><B>Welcome to " + GlobalFuncs.station_name() + ", enjoy your stay!</B></FONT>");
            Game13.WriteMsg(new Sound("sound/AI/welcome.ogg"));

            if (Lang13.Bool(GlobalVars.SSevent.holidays))
            {
                Game13.WriteMsg("<font color='blue'>and...</font>");

                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSevent.holidays))
                {
                    holidayname = _b;

                    holiday = GlobalVars.SSevent.holidays[holidayname];
                    Game13.WriteMsg("<h4>" + holiday.greet() + "</h4>");
                }
            }
            Task13.Schedule(0, (Task13.Closure)(() => {
                ((GameMode)this.mode).post_setup();

                foreach (dynamic _c in Lang13.Enumerate(GlobalVars.landmarks_list, typeof(Obj_Effect_Landmark_Start)))
                {
                    S = _c;


                    if (S.name != "AI")
                    {
                        GlobalFuncs.qdel(S);
                    }
                }

                if (!(GlobalVars.admins.len != 0))
                {
                    GlobalFuncs.send2irc("Server", "Round just started with no admins online!");
                }
                return;
            }));
            return(true);
        }
Ejemplo n.º 5
0
        // Function from file: photography.dm
        public void borgprint(  )
        {
            ByTable    nametemp  = null;
            dynamic    find      = null;
            Picture    selection = null;
            Ent_Static C         = null;
            Obj_Item_Device_Camera_Siliconcam targetcam = null;
            Picture t = null;
            Picture q = null;
            Obj_Item_Weapon_Photo p = null;

            nametemp  = new ByTable();
            C         = this.loc;
            targetcam = null;

            if (Convert.ToDouble(((dynamic)C).toner) < 20)
            {
                Task13.User.WriteMsg("Insufficent toner to print image.");
                return;
            }

            if (Lang13.Bool(((dynamic)C).connected_ai))
            {
                targetcam = ((dynamic)C).connected_ai.aicamera;
            }
            else
            {
                targetcam = ((dynamic)C).aicamera;
            }

            if (targetcam.aipictures.len == 0)
            {
                Task13.User.WriteMsg("<span class='userdanger'>No images saved</span>");
                return;
            }

            foreach (dynamic _a in Lang13.Enumerate(targetcam.aipictures, typeof(Picture)))
            {
                t = _a;

                nametemp.Add(t.fields["name"]);
            }
            find = Interface13.Input("Select image (numbered in order taken)", null, null, null, nametemp, InputType.Any);

            foreach (dynamic _b in Lang13.Enumerate(targetcam.aipictures, typeof(Picture)))
            {
                q = _b;


                if (q.fields["name"] == find)
                {
                    selection = q;
                    break;
                }
            }
            p = new Obj_Item_Weapon_Photo(C.loc);
            p.photocreate(selection.fields["icon"], selection.fields["img"], selection.fields["desc"], selection.fields["blueprints"]);
            p.pixel_x           = Rand13.Int(-10, 10);
            p.pixel_y           = Rand13.Int(-10, 10);
            ((dynamic)C).toner -= 20;
            this.visible_message("" + C.name + " spits out a photograph from a narrow slot on it's chassis.");
            Task13.User.WriteMsg("<span class='notice'>You print a photograph.</span>");
            return;
        }
        // Function from file: camera_advanced.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            dynamic L = null;
            dynamic camera_location = null;
            Obj_Machinery_Camera C  = null;


            if (Lang13.Bool(this.current_user))
            {
                a.WriteMsg("The console is already in use!");
                return(null);
            }

            if (!(a is Mob_Living_Carbon))
            {
                return(null);
            }

            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            L = a;

            if (!(this.eyeobj != null))
            {
                this.CreateEye();
            }

            if (!this.eyeobj.initialized)
            {
                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cameranet.cameras, typeof(Obj_Machinery_Camera)))
                {
                    C = _a;


                    if (!C.can_use())
                    {
                        continue;
                    }

                    if ((C.network & this.networks) != null)
                    {
                        camera_location = GlobalFuncs.get_turf(C);
                        break;
                    }
                }

                if (Lang13.Bool(camera_location))
                {
                    this.eyeobj.initialized = true;
                    this.give_eye_control(L);
                    this.eyeobj.setLoc(camera_location);
                }
                else
                {
                    ((Mob)a).unset_machine();
                }
            }
            else
            {
                this.give_eye_control(L);
                this.eyeobj.setLoc(this.eyeobj.loc);
            }
            return(null);
        }
Ejemplo n.º 7
0
        // Function from file: ticker.dm
        public bool declare_completion(  )
        {
            bool                     station_evacuated = false;
            int                      num_survivors     = 0;
            int                      num_escapees      = 0;
            dynamic                  Player            = null;
            StationState             end_state         = null;
            int                      station_integrity = 0;
            Mob_Living_Silicon_Ai    aiPlayer          = null;
            string                   robolist          = null;
            Mob_Living_Silicon_Robot robo              = null;
            Mob_Living_Silicon_Robot robo2             = null;
            dynamic                  handler           = null;
            ByTable                  total_antagonists = null;
            Mind                     Mind              = null;
            string                   temprole          = null;
            dynamic                  i      = null;
            string                   dellog = null;
            dynamic                  path   = null;


            if (GlobalVars.SSshuttle.emergency.mode >= 5)
            {
                station_evacuated = true;
            }
            num_survivors = 0;
            num_escapees  = 0;
            Game13.WriteMsg("<BR><BR><BR><FONT size=3><B>The round has ended.</B></FONT>");

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.mob_list))
            {
                Player = _a;


                if (Lang13.Bool(Player.mind) && !(Player is Mob_NewPlayer))
                {
                    if (Convert.ToInt32(Player.stat) != 2 && !(Player is Mob_Living_Carbon_Brain))
                    {
                        num_survivors++;

                        if (station_evacuated)
                        {
                            if (!((Ent_Static)Player).onCentcom() && !((Ent_Static)Player).onSyndieBase())
                            {
                                Player.WriteMsg("<font color='blue'><b>You managed to survive, but were marooned on " + GlobalFuncs.station_name() + "...</b></FONT>");
                            }
                            else
                            {
                                num_escapees++;
                                Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                            }
                        }
                        else
                        {
                            Player.WriteMsg("<font color='green'><b>You managed to survive the events on " + GlobalFuncs.station_name() + " as " + Player.real_name + ".</b></FONT>");
                        }
                    }
                    else
                    {
                        Player.WriteMsg("<font color='red'><b>You did not survive the events on " + GlobalFuncs.station_name() + "...</b></FONT>");
                    }
                }
            }
            end_state = new StationState();
            end_state.count();
            station_integrity = Num13.MinInt(((int)(Num13.Round(GlobalVars.start_state.score(end_state) * 100, 0.1))), 100);
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Shift Duration: <B>" + Num13.Floor(Game13.time / 36000) + ":" + GlobalFuncs.add_zero("" + Game13.time / 600 % 60, 2) + ":" + Game13.time / 100 % 6 + Game13.time / 100 % 10 + "</B>");
            Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Station Integrity: <B>" + (this.mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "" + station_integrity + "%") + "</B>");

            if (GlobalVars.joined_player_list.len != 0)
            {
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Total Population: <B>" + GlobalVars.joined_player_list.len + "</B>");

                if (station_evacuated)
                {
                    Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Evacuation Rate: <B>" + num_escapees + " (" + Num13.Round(num_escapees / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
                }
                Game13.WriteMsg("<BR>" + GlobalVars.TAB + "Survival Rate: <B>" + num_survivors + " (" + Num13.Round(num_survivors / GlobalVars.joined_player_list.len * 100, 0.1) + "%)</B>");
            }
            Game13.WriteMsg("<BR>");

            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Ai)))
            {
                aiPlayer = _c;


                if (aiPlayer.stat != 2 && aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws at the end of the round were:</b>");
                    aiPlayer.show_laws(true);
                }
                else if (aiPlayer.mind != null)
                {
                    Game13.WriteMsg("<b>" + aiPlayer.name + " (Played by: " + aiPlayer.mind.key + ")'s laws when it was deactivated were:</b>");
                    aiPlayer.show_laws(true);
                }
                Game13.WriteMsg("<b>Total law changes: " + aiPlayer.law_change_counter + "</b>");

                if (aiPlayer.connected_robots.len != 0)
                {
                    robolist = "<b>" + aiPlayer.real_name + "'s minions were:</b> ";

                    foreach (dynamic _b in Lang13.Enumerate(aiPlayer.connected_robots, typeof(Mob_Living_Silicon_Robot)))
                    {
                        robo = _b;


                        if (robo.mind != null)
                        {
                            robolist += "" + robo.name + (robo.stat != 0 ? " (Deactivated) (Played by: " + robo.mind.key + "), " : " (Played by: " + robo.mind.key + "), ");
                        }
                    }
                    Game13.WriteMsg("" + robolist);
                }
            }

            foreach (dynamic _d in Lang13.Enumerate(GlobalVars.mob_list, typeof(Mob_Living_Silicon_Robot)))
            {
                robo2 = _d;


                if (!Lang13.Bool(robo2.connected_ai) && robo2.mind != null)
                {
                    if (robo2.stat != 2)
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") survived as an AI-less borg! Its laws were:</b>");
                    }
                    else
                    {
                        Game13.WriteMsg("<b>" + robo2.name + " (Played by: " + robo2.mind.key + ") was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>");
                    }

                    if (robo2 != null)
                    {
                        robo2.laws.show_laws(typeof(Game13));
                    }
                }
            }
            this.mode.declare_completion();

            foreach (dynamic _e in Lang13.Enumerate(Lang13.GetTypes("/datum/game_mode/proc")))
            {
                handler = _e;


                if (String13.FindIgnoreCase("" + handler, "auto_declare_completion_", 1, 0) != 0)
                {
                    Lang13.Call(Lang13.BindFunc(this.mode, handler), this.force_ending);
                }
            }
            total_antagonists = new ByTable();

            foreach (dynamic _f in Lang13.Enumerate(this.minds, typeof(Mind)))
            {
                Mind = _f;

                temprole = Mind.special_role;

                if (Lang13.Bool(temprole))
                {
                    if (total_antagonists.Contains(temprole))
                    {
                        total_antagonists[temprole] += ", " + Mind.name + "(" + Mind.key + ")";
                    }
                    else
                    {
                        total_antagonists.Add(temprole);
                        total_antagonists[temprole] += ": " + Mind.name + "(" + Mind.key + ")";
                    }
                }
            }
            GlobalFuncs.log_game("Antagonists at round end were...");

            foreach (dynamic _g in Lang13.Enumerate(total_antagonists))
            {
                i = _g;

                GlobalFuncs.log_game("" + i + "s" + total_antagonists[i] + ".");
            }

            if (GlobalVars.SSgarbage.didntgc.len != 0)
            {
                dellog = "";

                foreach (dynamic _h in Lang13.Enumerate(GlobalVars.SSgarbage.didntgc))
                {
                    path = _h;

                    dellog += "Path : " + path + " \n";
                    dellog += "Failures : " + GlobalVars.SSgarbage.didntgc[path] + " \n";
                }
                Game13.log.WriteMsg(dellog);
            }
            return(true);
        }
Ejemplo n.º 8
0
        // Function from file: construction.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 T = null;
            Mob_Living_SimpleAnimal_Bot_Medbot S = null;

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

            if (A is Obj_Item_Weapon_Pen)
            {
                t = GlobalFuncs.stripped_input(user, "Enter new robot name", 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;
            }
            else
            {
                switch ((int)(this.build_step))
                {
                case 0:

                    if (A is Obj_Item_Device_Healthanalyzer)
                    {
                        if (!((Mob)user).unEquip(A))
                        {
                            return(null);
                        }
                        GlobalFuncs.qdel(A);
                        this.build_step++;
                        user.WriteMsg("<span class='notice'>You add the health sensor to " + this + ".</span>");
                        this.name = "First aid/robot arm/health analyzer assembly";
                        this.overlays.Add(new Image("icons/obj/aibots.dmi", "na_scanner"));
                    }
                    break;

                case 1:

                    if (A is Obj_Item_Device_Assembly_ProxSensor)
                    {
                        if (!((Mob)user).unEquip(A))
                        {
                            return(null);
                        }
                        GlobalFuncs.qdel(A);
                        this.build_step++;
                        user.WriteMsg("<span class='notice'>You complete the Medibot. Beep boop!</span>");
                        T      = GlobalFuncs.get_turf(this);
                        S      = new Mob_Living_SimpleAnimal_Bot_Medbot(T);
                        S.skin = this.skin;
                        S.name = this.created_name;
                        ((Mob)user).unEquip(this, 1);
                        GlobalFuncs.qdel(this);
                    }
                    break;
                }
            }
            return(null);
        }
Ejemplo n.º 9
0
        // Function from file: swarmer.dm
        public void DisperseTarget(Mob_Living target = null)
        {
            int        cycle           = 0;
            Tile       random_location = null;
            Tile       F           = null;
            GasMixture A           = null;
            ByTable    A_gases     = null;
            int?       trace_gases = null;
            dynamic    id          = null;
            double     pressure    = 0;
            Obj_Item_Weapon_Restraints_Handcuffs_Cable_Zipties Z = null;
            Mob_Living H = null;


            if (target != this)
            {
                this.WriteMsg("<span class='info'>Attempting to remove this being from our presence.</span>");

                if (this.z != 1)
                {
                    this.WriteMsg("<span class='warning'>Our bluespace transceiver cannot locate a viable bluespace link, our teleportation abilities are useless in this area.</span>");
                    return;
                }

                if (GlobalFuncs.do_mob(this, target, 30))
                {
                    cycle = 0;

                    while (cycle < 100)
                    {
                        random_location = Map13.GetTile(Rand13.Int(37, 202), Rand13.Int(75, 192), 1);

                        if (random_location is Tile_Simulated_Floor)
                        {
                            F = random_location;

                            if (Lang13.Bool(((dynamic)F).air))
                            {
                                A           = ((dynamic)F).air;
                                A_gases     = A.gases;
                                trace_gases = null;

                                foreach (dynamic _a in Lang13.Enumerate(A_gases))
                                {
                                    id = _a;


                                    if (GlobalVars.hardcoded_gases.Contains(id))
                                    {
                                        continue;
                                    }
                                    trace_gases = GlobalVars.TRUE;
                                    break;
                                }

                                if (Lang13.Bool(A_gases["o2"]) && Convert.ToDouble(A_gases["o2"][1]) >= 16 && !Lang13.Bool(A_gases["plasma"]) && (!Lang13.Bool(A_gases["co2"]) || Convert.ToDouble(A_gases["co2"][1]) < 10) && !Lang13.Bool(trace_gases))
                                {
                                    if (Convert.ToDouble(A.temperature) > 270 && Convert.ToDouble(A.temperature) < 360)
                                    {
                                        pressure = A.return_pressure();

                                        if (pressure > 20 && pressure < 550)
                                        {
                                            if (target is Mob_Living_Carbon_Human)
                                            {
                                                Z = new Obj_Item_Weapon_Restraints_Handcuffs_Cable_Zipties(this);
                                                H = target;
                                                Z.apply_cuffs(H, this);
                                            }
                                            GlobalFuncs.do_teleport(target, F, 0);
                                            GlobalFuncs.playsound(this, "sound/effects/sparks4.ogg", 50, 1);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        cycle++;
                    }
                    return;
                }
            }
            return;
        }
Ejemplo n.º 10
0
        // Function from file: gibber.dm
        public void startgibbing(dynamic user = null)
        {
            int        offset              = 0;
            dynamic    sourcename          = null;
            dynamic    sourcejob           = null;
            dynamic    gibee               = null;
            double     sourcenutriment     = 0;
            double?    sourcetotalreagents = null;
            Type       gibtype             = null;
            ByTable    allmeat             = null;
            dynamic    allskin             = null;
            dynamic    gibee2              = null;
            dynamic    C            = null;
            double     i            = 0;
            dynamic    newmeat      = null;
            dynamic    newskin      = null;
            double?    i2           = null;
            ByTable    nearby_turfs = null;
            Ent_Static meatslab     = null;
            dynamic    skin         = null;
            double     turfs        = 0;
            dynamic    gibturf      = null;


            if (this.operating)
            {
                return;
            }

            if (!Lang13.Bool(this.occupant))
            {
                this.visible_message("<span class='italics'>You hear a loud metallic grinding sound.</span>");
                return;
            }
            this.f_use_power(1000);
            this.visible_message("<span class='italics'>You hear a loud squelchy grinding sound.</span>");
            GlobalFuncs.playsound(this.loc, "sound/machines/juicer.ogg", 50, 1);
            this.operating = true;
            this.update_icon();
            offset = (Rand13.PercentChance(50) ? -2 : 2);
            Icon13.Animate(new ByTable().Set(1, this).Set("pixel_x", this.pixel_x + offset).Set("time", 0.2).Set("loop", 200));
            sourcename = this.occupant.real_name;

            if (this.occupant is Mob_Living_Carbon_Human)
            {
                gibee     = this.occupant;
                sourcejob = gibee.job;
            }
            sourcenutriment     = this.occupant.nutrition / 15;
            sourcetotalreagents = this.occupant.reagents.total_volume;
            gibtype             = typeof(Obj_Effect_Decal_Cleanable_Blood_Gibs);
            allmeat             = new ByTable(this.meat_produced);

            if (this.occupant is Mob_Living_Carbon_Human)
            {
                gibee2 = this.occupant;

                if (Lang13.Bool(gibee2.dna) && Lang13.Bool(gibee2.dna.species))
                {
                    this.typeofmeat = gibee2.dna.species.meat;
                    this.typeofskin = gibee2.dna.species.skinned_type;
                }
                else
                {
                    this.typeofmeat = typeof(Obj_Item_Weapon_ReagentContainers_Food_Snacks_Meat_Slab_Human);
                    this.typeofskin = typeof(Obj_Item_Stack_Sheet_Animalhide_Human);
                }
            }
            else if (this.occupant is Mob_Living_Carbon)
            {
                C = this.occupant;
                this.typeofmeat = C.type_of_meat;
                gibtype         = C.gib_type;
            }

            foreach (dynamic _a in Lang13.IterateRange(1, this.meat_produced))
            {
                i = _a;

                newmeat             = Lang13.Call(this.typeofmeat);
                newskin             = Lang13.Call(this.typeofskin);
                newmeat.name        = sourcename + newmeat.name;
                newmeat.subjectname = sourcename;

                if (Lang13.Bool(sourcejob))
                {
                    newmeat.subjectjob = sourcejob;
                }
                newmeat.reagents.add_reagent("nutriment", sourcenutriment / this.meat_produced);
                ((Reagents)this.occupant.reagents).trans_to(newmeat, Num13.Round((sourcetotalreagents ?? 0) / this.meat_produced, 1));
                allmeat[i] = newmeat;
                allskin    = newskin;
            }
            GlobalFuncs.add_logs(user, this.occupant, "gibbed");
            ((Mob)this.occupant).death(true);
            ((Mob)this.occupant).ghostize();
            GlobalFuncs.qdel(this.occupant);
            Task13.Schedule(((int)(this.gibtime)), (Task13.Closure)(() => {
                GlobalFuncs.playsound(this.loc, "sound/effects/splat.ogg", 50, 1);
                this.operating = false;

                foreach (dynamic _c in Lang13.IterateRange(1, this.meat_produced))
                {
                    i2 = _c;

                    nearby_turfs = Map13.FetchInRangeExcludeThis(GlobalFuncs.get_turf(this), 3);
                    meatslab     = allmeat[i2];
                    skin         = allskin;
                    meatslab.loc = this.loc;
                    skin.loc     = this.loc;
                    ((dynamic)meatslab).throw_at_fast(Rand13.PickFromTable(nearby_turfs), i2, 3);
                    ((Ent_Dynamic)skin).throw_at_fast(Rand13.PickFromTable(nearby_turfs), i2, 3);

                    foreach (dynamic _b in Lang13.IterateRange(1, this.meat_produced * 3))
                    {
                        turfs = _b;

                        gibturf = Rand13.PickFromTable(nearby_turfs);

                        if (Map13.FetchViewers(null, gibturf).Contains(!gibturf.density && this != null))
                        {
                            Lang13.Call(gibtype, gibturf, i2);
                        }
                    }
                }
                this.pixel_x   = Convert.ToInt32(Lang13.Initial(this, "pixel_x"));
                this.operating = false;
                this.update_icon();
                return;
            }));
            return;
        }
        public override bool f_action(dynamic target = null)
        {
            dynamic    WT          = null;
            int        direction   = 0;
            dynamic    T           = null;
            Tile       T1          = null;
            Tile       T2          = null;
            ByTable    the_targets = null;
            int?       a           = null;
            dynamic    W           = null;
            dynamic    my_target   = null;
            Reagents   R           = null;
            int?       b           = null;
            dynamic    W_turf      = null;
            Ent_Static atm         = null;


            if (!this.action_checks(target) || Map13.GetDistance(this.chassis, target) > 3)
            {
                return(false);
            }

            if (target is Obj_Structure_ReagentDispensers_Watertank && Map13.GetDistance(this.chassis, target) <= 1)
            {
                WT = target;
                ((Reagents)WT.reagents).trans_to(this, 1000);
                this.occupant_message("<span class='notice'>Extinguisher refilled.</span>");
                GlobalFuncs.playsound(this.chassis, "sound/effects/refill.ogg", 50, 1, -6);
            }
            else
            {
                if ((this.reagents.total_volume ?? 0) > 0)
                {
                    GlobalFuncs.playsound(this.chassis, "sound/effects/extinguish.ogg", 75, 1, -3);
                    direction   = Map13.GetDistance(this.chassis, target);
                    T           = GlobalFuncs.get_turf(target);
                    T1          = Map13.GetStep(T, Num13.Rotate(direction, 90));
                    T2          = Map13.GetStep(T, Num13.Rotate(direction, -90));
                    the_targets = new ByTable(new object [] { T, T1, T2 });
                    Task13.Schedule(0, (Task13.Closure)(() => {
                        a = null;
                        a = 0;

                        while ((a ?? 0) < 5)
                        {
                            W = GlobalFuncs.PoolOrNew(typeof(Obj_Effect_ParticleEffect_Water), GlobalFuncs.get_turf(this.chassis));

                            if (!Lang13.Bool(W))
                            {
                                return;
                            }
                            my_target  = Rand13.PickFromTable(the_targets);
                            R          = new Reagents(5);
                            W.reagents = R;
                            R.my_atom  = W;
                            this.reagents.trans_to(W, 1);
                            b = null;
                            b = 0;

                            while ((b ?? 0) < 4)
                            {
                                if (!Lang13.Bool(W))
                                {
                                    return;
                                }
                                Map13.StepTowardsSimple(W, my_target);

                                if (!Lang13.Bool(W))
                                {
                                    return;
                                }
                                W_turf = GlobalFuncs.get_turf(W);
                                ((Reagents)W.reagents).reaction(W_turf);

                                foreach (dynamic _a in Lang13.Enumerate(W_turf, typeof(Ent_Static)))
                                {
                                    atm = _a;

                                    ((Reagents)W.reagents).reaction(atm);
                                }

                                if (W.loc == my_target)
                                {
                                    break;
                                }
                                Task13.Sleep(2);
                                b++;
                            }
                            a++;
                        }
                        return;
                    }));
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 12
0
        // Function from file: gibber.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic G = null;
            Mob     C = null;


            if (A is Obj_Item_Weapon_Grab)
            {
                G = A;

                if (!(G.affecting is Mob_Living_Carbon))
                {
                    user.WriteMsg("<span class='danger'>This item is not suitable for the gibber!</span>");
                    return(null);
                }
                C = G.affecting;

                if (C.buckled != null || Lang13.Bool(C.buckled_mob))
                {
                    user.WriteMsg("<span class='warning'>" + C + " is attached to something!</span>");
                    return(null);
                }

                if (C.abiotic(true) && !this.ignore_clothing)
                {
                    user.WriteMsg("<span class='danger'>Subject may not have abiotic items on.</span>");
                    return(null);
                }
                ((Ent_Static)user).visible_message("<span class='danger'>" + user + " starts to put " + G.affecting + " into the gibber!</span>");
                this.add_fingerprint(user);

                if (GlobalFuncs.do_after(user, this.gibtime, null, this) && Lang13.Bool(G) && Lang13.Bool(G.affecting) && G.affecting == C && !(C.buckled != null) && !Lang13.Bool(C.buckled_mob) && !Lang13.Bool(this.occupant))
                {
                    ((Ent_Static)user).visible_message("<span class='danger'>" + user + " stuffs " + G.affecting + " into the gibber!</span>");
                    C.reset_perspective(this);
                    C.loc         = this;
                    this.occupant = C;
                    GlobalFuncs.qdel(G);
                    this.update_icon();
                }
            }

            if (this.default_deconstruction_screwdriver(user, "grinder_open", "grinder", A))
            {
                return(null);
            }

            if (this.exchange_parts(user, A))
            {
                return(null);
            }

            if (this.default_pry_open(A))
            {
                return(null);
            }

            if (this.default_unfasten_wrench(user, A))
            {
                return(null);
            }
            this.default_deconstruction_crowbar(A);
            return(null);
        }
Ejemplo n.º 13
0
 public dynamic Columns(dynamic column = null)
 {
     return(DB13.op(this, 16, (Lang13.Bool(Lang13.IsNumber(column)) ? column - 1 : column)));
 }
        public override bool f_action(dynamic target = null)
        {
            dynamic target_obj          = null;
            Tile_Simulated_Mineral M    = null;
            dynamic             ore_box = null;
            Obj_Item_Weapon_Ore ore     = null;
            Tile_Simulated_Floor_Plating_Asteroid M2 = null;
            dynamic             ore_box2             = null;
            Obj_Item_Weapon_Ore ore2 = null;


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

            if (target is Tile && !(target is Tile_Simulated))
            {
                return(false);
            }

            if (target is Obj)
            {
                target_obj = target;

                if (target_obj.unacidable)
                {
                    return(false);
                }
            }
            ((Ent_Static)target).visible_message("<span class='warning'>" + this.chassis + " starts to drill " + target + ".</span>", "<span class='userdanger'>" + this.chassis + " starts to drill " + target + "...</span>", "<span class='italics'>You hear drilling.</span>");

            if (this.do_after_cooldown(target))
            {
                if (target is Tile_Simulated_Wall_RWall)
                {
                    if (this is Obj_Item_MechaParts_MechaEquipment_Drill_Diamonddrill)
                    {
                        if (this.do_after_cooldown(target))
                        {
                            this.log_message("Drilled through " + target);
                            ((Ent_Static)target).ex_act(3);
                        }
                    }
                    else
                    {
                        this.occupant_message("<span class='danger'>" + target + " is too durable to drill through.</span>");
                    }
                }
                else if (target is Tile_Simulated_Mineral)
                {
                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(1, this.chassis), typeof(Tile_Simulated_Mineral)))
                    {
                        M = _a;


                        if ((Map13.GetDistance(this.chassis, M) & this.chassis.dir) != 0)
                        {
                            M.gets_drilled(this.chassis.occupant);
                        }
                    }
                    this.log_message("Drilled through " + target);

                    if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Item_MechaParts_MechaEquipment_HydraulicClamp), this.chassis.equipment)))
                    {
                        ore_box = Lang13.FindIn(typeof(Obj_Structure_OreBox), ((dynamic)this.chassis).cargo);

                        if (Lang13.Bool(ore_box))
                        {
                            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRange(this.chassis, 1), typeof(Obj_Item_Weapon_Ore)))
                            {
                                ore = _b;


                                if ((Map13.GetDistance(this.chassis, ore) & this.chassis.dir) != 0)
                                {
                                    ore.Move(ore_box);
                                }
                            }
                        }
                    }
                }
                else if (target is Tile_Simulated_Floor_Plating_Asteroid)
                {
                    foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInRange(this.chassis, 1), typeof(Tile_Simulated_Floor_Plating_Asteroid)))
                    {
                        M2 = _c;


                        if ((Map13.GetDistance(this.chassis, M2) & this.chassis.dir) != 0)
                        {
                            M2.gets_dug();
                        }
                    }
                    this.log_message("Drilled through " + target);

                    if (Lang13.Bool(Lang13.FindIn(typeof(Obj_Item_MechaParts_MechaEquipment_HydraulicClamp), this.chassis.equipment)))
                    {
                        ore_box2 = Lang13.FindIn(typeof(Obj_Structure_OreBox), ((dynamic)this.chassis).cargo);

                        if (Lang13.Bool(ore_box2))
                        {
                            foreach (dynamic _d in Lang13.Enumerate(Map13.FetchInRange(this.chassis, 1), typeof(Obj_Item_Weapon_Ore)))
                            {
                                ore2 = _d;


                                if ((Map13.GetDistance(this.chassis, ore2) & this.chassis.dir) != 0)
                                {
                                    ore2.Move(ore_box2);
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.log_message("Drilled through " + target);

                    if (target is Mob_Living)
                    {
                        if (this is Obj_Item_MechaParts_MechaEquipment_Drill_Diamonddrill)
                        {
                            this.drill_mob(target, this.chassis.occupant, 120);
                        }
                        else
                        {
                            this.drill_mob(target, this.chassis.occupant);
                        }
                    }
                    else
                    {
                        ((Ent_Static)target).ex_act(2);
                    }
                }
            }
            return(false);
        }
        // Function from file: destructive_analyzer.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            ByTable temp_tech = null;


            if (this.shocked)
            {
                this.shock(user, 50);
            }

            if (this.default_deconstruction_screwdriver(user, "d_analyzer_t", "d_analyzer", A))
            {
                if (Lang13.Bool(this.linked_console))
                {
                    this.linked_console.linked_destroy = null;
                    this.linked_console = null;
                }
                return(null);
            }

            if (this.exchange_parts(user, A))
            {
                return(null);
            }
            this.default_deconstruction_crowbar(A);

            if (this.disabled)
            {
                return(null);
            }

            if (!Lang13.Bool(this.linked_console))
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " must be linked to an R&D console first!</span>");
                return(null);
            }

            if (this.busy)
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " is busy right now.</span>");
                return(null);
            }

            if (A is Obj_Item && !Lang13.Bool(this.loaded_item))
            {
                if (!Lang13.Bool(A.origin_tech))
                {
                    user.WriteMsg("<span class='warning'>This doesn't seem to have a tech origin!</span>");
                    return(null);
                }
                temp_tech = this.ConvertReqString2List(A.origin_tech);

                if (temp_tech.len == 0)
                {
                    user.WriteMsg("<span class='warning'>You cannot deconstruct this item!</span>");
                    return(null);
                }

                if (!Lang13.Bool(user.drop_item()))
                {
                    user.WriteMsg(new Txt("<span class='warning'>").The(A).item().str(" is stuck to your hand, you cannot put it in the ").item(this.name).str("!</span>").ToString());
                    return(null);
                }
                this.busy        = true;
                this.loaded_item = A;
                A.loc            = this;
                user.WriteMsg("<span class='notice'>You add the " + A.name + " to the " + this.name + "!</span>");
                Icon13.Flick("d_analyzer_la", this);
                Task13.Schedule(10, (Task13.Closure)(() => {
                    this.icon_state = "d_analyzer_l";
                    this.busy       = false;
                    return;
                }));
            }
            return(null);
        }
Ejemplo n.º 16
0
        // Function from file: megaphone.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            string message = null;


            if (Lang13.Bool(user.client))
            {
                if ((user.client.prefs.muted & 1) != 0)
                {
                    ((dynamic)this).WriteMsg("<span class='warning'>You cannot speak in IC (muted).</span>");
                    return(null);
                }
            }

            if (!(user is Mob_Living_Carbon_Human))
            {
                user.WriteMsg("<span class='warning'>You don't know how to use this!</span>");
                return(null);
            }

            if (this.spamcheck > Game13.time)
            {
                user.WriteMsg(new Txt("<span class='warning'>").The(this).item().str(" needs to recharge!</span>").ToString());
                return(null);
            }
            message = String13.SubStr(GlobalFuncs.sanitize(Interface13.Input(user, "Shout a message?", "Megaphone", null, null, InputType.Str)), 1, 1024);

            if (!Lang13.Bool(message))
            {
                return(null);
            }
            message = GlobalFuncs.capitalize(message);

            if (!((Ent_Dynamic)user).can_speak(message))
            {
                user.WriteMsg("<span class='warning'>You find yourself unable to speak at all!</span>");
                return(null);
            }

            if (this.loc == user && Lang13.Bool(user.stat) == false)
            {
                if (this.emagged)
                {
                    if (this.insults != 0)
                    {
                        ((Ent_Static)user).audible_message("<B>" + ((Ent_Dynamic)user).GetVoice() + "</B> broadcasts, <FONT size=3>\"" + Rand13.PickFromTable(this.insultmsg) + "\"</FONT>");
                        this.insults--;
                    }
                    else
                    {
                        user.WriteMsg("<span class='warning'>*BZZZZzzzzzt*</span>");
                    }
                }
                else
                {
                    ((Ent_Static)user).audible_message("<B>" + ((Ent_Dynamic)user).GetVoice() + "</B> broadcasts, <FONT size=3>\"" + message + "\"</FONT>");
                }
                GlobalFuncs.playsound(this.loc, "sound/items/megaphone.ogg", 100, 0, 1);
                this.spamcheck = Game13.time + 50;
                return(null);
            }
            return(null);
        }
Ejemplo n.º 17
0
 // Function from file: photography.dm
 public void show(dynamic user = null)
 {
     Interface13.CacheBrowseResource(user, this.img, "tmp_photo.png");
     Interface13.Browse(user, "<html><head><title>" + this.name + "</title></head>" + "<body style='overflow:hidden;margin:0;text-align:center'>" + "<img src='tmp_photo.png' width='192' style='-ms-interpolation-mode:nearest-neighbor' />" + ("" + (Lang13.Bool(this.scribble) ? "<br>Written on the back:<br><i>" + this.scribble + "</i>" : "")) + "</body></html>", "window=book;size=192x" + (Lang13.Bool(this.scribble) ? 400 : 192));
     GlobalFuncs.onclose(user, "" + this.name);
     return;
 }
        // Function from file: solar.dm
        public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null)
        {
            int?_default = null;

            double?adjust  = null;
            double?adjust2 = null;
            double?mode    = null;


            if (Lang13.Bool(base.ui_act(action, _params, ui, state)))
            {
                return(_default);
            }

            switch ((string)(action))
            {
            case "direction":
                adjust = String13.ParseNumber(_params["adjust"]);

                if (Lang13.Bool(adjust))
                {
                    this.currentdir = Num13.MaxInt(0, Num13.MinInt(((int)(((adjust ?? 0) + (this.currentdir ?? 0) + 360) % 360)), 359));
                    this.targetdir  = this.currentdir;
                    this.set_panels(this.currentdir);
                    _default = GlobalVars.TRUE;
                }
                break;

            case "rate":
                adjust2 = String13.ParseNumber(_params["adjust"]);

                if (Lang13.Bool(adjust2))
                {
                    this.trackrate = Num13.MaxInt(-7200, Num13.MinInt(((int)(this.trackrate + (adjust2 ?? 0))), 7200));

                    if (this.trackrate != 0)
                    {
                        this.nexttime = Game13.time + 36000 / Math.Abs(this.trackrate);
                    }
                    _default = GlobalVars.TRUE;
                }
                break;

            case "tracking":
                mode = String13.ParseNumber(_params["mode"]);

                if (Lang13.Bool(mode))
                {
                    this.track = mode;
                    _default   = GlobalVars.TRUE;
                }

                if (mode == 2 && this.connected_tracker != null)
                {
                    this.connected_tracker.set_angle(GlobalVars.SSsun.angle);
                    this.set_panels(this.currentdir);
                }
                else if (mode == 1)
                {
                    this.targetdir = this.currentdir;

                    if (this.trackrate != 0)
                    {
                        this.nexttime = Game13.time + 36000 / Math.Abs(this.trackrate);
                    }
                    this.set_panels(this.targetdir);
                }
                break;

            case "refresh":
                this.search_for_connected();

                if (this.connected_tracker != null && this.track == 2)
                {
                    this.connected_tracker.set_angle(GlobalVars.SSsun.angle);
                }
                this.set_panels(this.currentdir);
                _default = GlobalVars.TRUE;
                break;
            }
            return(_default);
        }
Ejemplo n.º 19
0
        // Function from file: mutations.dm
        public override dynamic on_losing(dynamic owner = null)
        {
            dynamic _default = null;


            if (Lang13.Bool(owner) && owner is Mob_Living_Carbon_Monkey && Convert.ToInt32(owner.stat) != 2 && Lang13.Bool(owner.dna.mutations.Remove(this)))
            {
                _default = ((Mob_Living_Carbon)owner).humanize(311);
            }
            return(_default);
        }
Ejemplo n.º 20
0
        // Function from file: revolver.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic H         = null;
            dynamic AC        = null;
            dynamic affecting = null;
            string  limb_name = null;


            if (proximity_flag == true)
            {
                if (!user.contents.Contains(target) && target is Mob)
                {
                    if (user.a_intent == "harm")
                    {
                        return(false);
                    }
                }
            }

            if (user is Mob_Living)
            {
                if (!this.can_trigger_gun(user))
                {
                    return(false);
                }
            }

            if (target != user)
            {
                if (target is Mob)
                {
                    user.WriteMsg("<span class='warning'>A mechanism prevents you from shooting anyone but yourself!</span>");
                }
                return(false);
            }

            if (user is Mob_Living_Carbon_Human)
            {
                H = user;

                if (!this.spun)
                {
                    user.WriteMsg("<span class='warning'>You need to spin the revolver's chamber first!</span>");
                    return(false);
                }
                this.spun = false;

                if (Lang13.Bool(this.chambered))
                {
                    AC = this.chambered;

                    if (Lang13.Bool(AC.fire(user, user)))
                    {
                        GlobalFuncs.playsound(user, this.fire_sound, 50, 1);
                        affecting = ((Mob_Living_Carbon_Human)H).get_organ(GlobalFuncs.check_zone(user.zone_selected));
                        limb_name = ((Obj_Item_Organ_Limb)affecting).getDisplayName();

                        if (affecting.name == "head" || affecting.name == "eyes" || affecting.name == "mouth")
                        {
                            user.apply_damage(300, "brute", affecting);
                            ((Ent_Static)user).visible_message(new Txt("<span class='danger'>").item(user.name).str(" fires ").item(this).str(" at ").his_her_its_their().str(" head!</span>").ToString(), "<span class='userdanger'>You fire " + this + " at your head!</span>", "<span class='italics'>You hear a gunshot!</span>");
                        }
                        else
                        {
                            ((Ent_Static)user).visible_message(new Txt("<span class='danger'>").item(user.name).str(" cowardly fires ").item(this).str(" at ").his_her_its_their().str(" ").item(limb_name).str("!</span>").ToString(), "<span class='userdanger'>You cowardly fire " + this + " at your " + limb_name + "!</span>", "<span class='italics'>You hear a gunshot!</span>");
                        }
                        return(false);
                    }
                }
                ((Ent_Static)user).visible_message("<span class='danger'>*click*</span>");
                GlobalFuncs.playsound(user, "sound/weapons/empty.ogg", 100, 1);
            }
            return(false);
        }
Ejemplo n.º 21
0
        // Function from file: ticker.dm
        public void station_explosion_cinematic(dynamic station_missed = null, dynamic _override = null)
        {
            station_missed = station_missed ?? 0;

            HtmlInterface     hi          = null;
            Obj_Structure_Bed temp_buckle = null;
            dynamic           M           = null;
            dynamic           M2          = null;
            dynamic           T           = null;


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

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.html_interfaces, typeof(HtmlInterface)))
            {
                hi = _a;

                hi.closeAll();
            }
            this.cinematic = new Obj_Screen(this)
            {
                icon          = "icons/effects/station_explosion.dmi",
                icon_state    = "station_intact",
                layer         = 20,
                mouse_opacity = 0,
                screen_loc    = "1,0"
            };
            temp_buckle = new Obj_Structure_Bed(this);

            if (Lang13.Bool(station_missed))
            {
                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.mob_list))
                {
                    M = _b;

                    M.buckled = temp_buckle;

                    if (Lang13.Bool(M.client))
                    {
                        M.client.screen += this.cinematic;
                    }
                }
            }
            else
            {
                foreach (dynamic _c in Lang13.Enumerate(GlobalVars.mob_list))
                {
                    M2 = _c;

                    M2.buckled = temp_buckle;

                    if (Lang13.Bool(M2.client))
                    {
                        M2.client.screen += this.cinematic;
                    }

                    if (Convert.ToInt32(M2.stat) != 2)
                    {
                        T = GlobalFuncs.get_turf(M2);

                        if (Lang13.Bool(T) && Lang13.Bool(T.z) == true)
                        {
                            ((Mob)M2).death(false);
                        }
                    }
                }
            }

            dynamic _f = station_missed;             // Was a switch-case, sorry for the mess.

            if (_f == 1)
            {
                if (Lang13.Bool(this.mode) && !Lang13.Bool(_override))
                {
                    _override = this.mode.name;
                }

                dynamic _d = _override;                 // Was a switch-case, sorry for the mess.
                if (_d == "nuclear emergency")
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                    Icon13.Flick("station_intact_fade_red", this.cinematic);
                    this.cinematic.icon_state = "summary_nukefail";
                }
                else if (_d == "gang war")
                {
                    this.cinematic.icon_state = "intro_malf_still";
                    Icon13.Flick("intro_malf", this.cinematic);
                    Task13.Sleep(70);
                }
                else if (_d == "fake")
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Game13.WriteMsg(new Sound("sound/items/bikehorn.ogg"));
                    Icon13.Flick("summary_selfdes", this.cinematic);
                }
                else
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                }
            }
            else if (_f == 2)
            {
                Task13.Sleep(50);
                Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
            }
            else
            {
                if (Lang13.Bool(this.mode) && !Lang13.Bool(_override))
                {
                    _override = this.mode.name;
                }

                dynamic _e = _override;                 // Was a switch-case, sorry for the mess.
                if (_e == "nuclear emergency")
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Icon13.Flick("station_explode_fade_red", this.cinematic);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                    this.cinematic.icon_state = "summary_nukewin";
                }
                else if (_e == "AI malfunction")
                {
                    Icon13.Flick("intro_malf", this.cinematic);
                    Task13.Sleep(76);
                    Icon13.Flick("station_explode_fade_red", this.cinematic);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                    this.cinematic.icon_state = "summary_malf";
                }
                else if (_e == "blob")
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Icon13.Flick("station_explode_fade_red", this.cinematic);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                    this.cinematic.icon_state = "summary_selfdes";
                }
                else if (_e == "no_core")
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Icon13.Flick("station_intact", this.cinematic);
                    Game13.WriteMsg(new Sound("sound/ambience/signal.ogg"));
                    Task13.Sleep(100);

                    if (this.cinematic != null)
                    {
                        GlobalFuncs.qdel(this.cinematic);
                        this.cinematic = null;
                    }

                    if (temp_buckle != null)
                    {
                        GlobalFuncs.qdel(temp_buckle);
                    }
                    return;
                }
                else
                {
                    Icon13.Flick("intro_nuke", this.cinematic);
                    Task13.Sleep(35);
                    Icon13.Flick("station_explode_fade_red", this.cinematic);
                    Game13.WriteMsg(new Sound("sound/effects/explosionfar.ogg"));
                    this.cinematic.icon_state = "summary_selfdes";
                }
            }
            Task13.Schedule(300, (Task13.Closure)(() => {
                if (this.cinematic != null)
                {
                    GlobalFuncs.qdel(this.cinematic);
                }

                if (temp_buckle != null)
                {
                    GlobalFuncs.qdel(temp_buckle);
                }
                return;
            }));
            return;
        }
Ejemplo n.º 22
0
        // Function from file: mutations.dm
        public virtual dynamic on_acquiring(dynamic owner = null)
        {
            ByTable mut_overlay = null;


            if (!Lang13.Bool(owner) || !(owner is Mob_Living_Carbon_Human) || Convert.ToInt32(owner.stat) == 2 || Lang13.Bool(owner.dna.mutations.Contains(this)))
            {
                return(1);
            }

            if (this.species_allowed.len != 0 && !(this.species_allowed.Find(owner.dna.species.id) != 0))
            {
                return(1);
            }

            if (this.health_req != 0 && Convert.ToDouble(owner.health) < this.health_req)
            {
                return(1);
            }
            owner.dna.mutations.Add(this);

            if (Lang13.Bool(this.text_gain_indication))
            {
                owner.WriteMsg(this.text_gain_indication);
            }

            if (this.visual_indicators.len != 0)
            {
                mut_overlay = new ByTable(new object [] { this.get_visual_indicator(owner) });

                if (Lang13.Bool(owner.overlays_standing[this.layer_used]))
                {
                    mut_overlay = owner.overlays_standing[this.layer_used];
                    mut_overlay.Or(this.get_visual_indicator(owner));
                }
                owner.remove_overlay(this.layer_used);
                owner.overlays_standing[this.layer_used] = mut_overlay;
                owner.apply_overlay(this.layer_used);
            }
            return(null);
        }
Ejemplo n.º 23
0
        // Function from file: ticker.dm
        public override void fire(  )
        {
            Mob_NewPlayer player = null;


            switch ((int)(this.current_state))
            {
            case 0:
                this.timeLeft = (GlobalVars.config.lobby_countdown ?? 0) * 10;
                Game13.WriteMsg("<b><font color='blue'>Welcome to the pre-game lobby!</font></b>");
                Game13.WriteMsg("Please, setup your character and select ready. Game will start in " + GlobalVars.config.lobby_countdown + " seconds");
                this.current_state = 1;
                break;

            case 1:
                this.totalPlayers      = 0;
                this.totalPlayersReady = 0;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_NewPlayer)))
                {
                    player = _a;

                    this.totalPlayers++;

                    if (Lang13.Bool(player.ready))
                    {
                        this.totalPlayersReady++;
                    }
                }

                if (Convert.ToDouble(this.timeLeft) < 0)
                {
                    return;
                }
                this.timeLeft -= this.wait;

                if (Convert.ToDouble(this.timeLeft) <= 300 && !this.tipped)
                {
                    this.send_random_tip();
                    this.tipped = true;
                }

                if (Convert.ToDouble(this.timeLeft) <= 0)
                {
                    this.current_state = 2;
                }
                break;

            case 2:

                if (!this.setup())
                {
                    this.current_state = 0;
                }
                break;

            case 3:
                ((Game_Data)this.mode).process(this.wait * 0.1);
                this.check_queue();
                this.check_maprotate();

                if (!this.mode.explosion_in_progress && ((GameMode)this.mode).check_finished() || Lang13.Bool(this.force_ending))
                {
                    this.current_state = 4;
                    GlobalFuncs.toggle_ooc(true);
                    this.declare_completion(  );
                    Task13.Schedule(50, (Task13.Closure)(() => {
                        if (this.mode.station_was_nuked)
                        {
                            Game13.Reboot("Station destroyed by Nuclear Device.", "end_proper", "nuke");
                        }
                        else
                        {
                            Game13.Reboot("Round ended.", "end_proper", "proper completion");
                        }
                        return;
                    }));
                }
                break;
            }
            return;
        }
Ejemplo n.º 24
0
        // Function from file: robot_parts.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic M = null;
            Obj_Item_Weapon_Ed209Assembly B = null;
            dynamic M2 = null;
            dynamic BM = null;
            Mob_Living_Silicon_Robot O = null;

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

            if (A is Obj_Item_Stack_Sheet_Metal && !Lang13.Bool(this.l_arm) && !Lang13.Bool(this.r_arm) && !Lang13.Bool(this.l_leg) && !Lang13.Bool(this.r_leg) && !Lang13.Bool(this.chest) && !Lang13.Bool(this.head))
            {
                M = A;

                if (Lang13.Bool(M.use(1)))
                {
                    B     = new Obj_Item_Weapon_Ed209Assembly();
                    B.loc = GlobalFuncs.get_turf(this);
                    user.WriteMsg("<span class='notice'>You arm the robot frame.</span>");

                    if (((Mob)user).get_inactive_hand() == this)
                    {
                        ((Mob)user).unEquip(this);
                        ((Mob)user).put_in_inactive_hand(B);
                    }
                    GlobalFuncs.qdel(this);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need one sheet of metal to start building ED-209!</span>");
                    return(null);
                }
            }

            if (A is Obj_Item_RobotParts_LLeg)
            {
                if (Lang13.Bool(this.l_leg))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.l_leg = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_RLeg)
            {
                if (Lang13.Bool(this.r_leg))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.r_leg = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_LArm)
            {
                if (Lang13.Bool(this.l_arm))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.l_arm = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_RArm)
            {
                if (Lang13.Bool(this.r_arm))
                {
                    return(null);
                }

                if (!((Mob)user).unEquip(A))
                {
                    return(null);
                }
                A.loc      = this;
                this.r_arm = A;
                this.updateicon();
            }

            if (A is Obj_Item_RobotParts_Chest)
            {
                if (Lang13.Bool(this.chest))
                {
                    return(null);
                }

                if (Lang13.Bool(A.wired) && Lang13.Bool(A.cell))
                {
                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }
                    A.loc      = this;
                    this.chest = A;
                    this.updateicon();
                }
                else if (!Lang13.Bool(A.wired))
                {
                    user.WriteMsg("<span class='warning'>You need to attach wires to it first!</span>");
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need to attach a cell to it first!</span>");
                }
            }

            if (A is Obj_Item_RobotParts_Head)
            {
                if (Lang13.Bool(this.head))
                {
                    return(null);
                }

                if (Lang13.Bool(A.flash2) && Lang13.Bool(A.flash1))
                {
                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }
                    A.loc     = this;
                    this.head = A;
                    this.updateicon();
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need to attach a flash to it first!</span>");
                }
            }

            if (A is Obj_Item_Device_Multitool)
            {
                if (this.check_completion())
                {
                    this.Interact(user);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>The endoskeleton must be assembled before debugging can begin!</span>");
                }
            }

            if (A is Obj_Item_Device_Mmi)
            {
                M2 = A;

                if (this.check_completion())
                {
                    if (!(this.loc is Tile))
                    {
                        user.WriteMsg("<span class='warning'>You can't put the MMI in, the frame has to be standing on the ground to be perfectly precise!</span>");
                        return(null);
                    }

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

                    if (!Lang13.Bool(BM.key) || !Lang13.Bool(BM.mind))
                    {
                        user.WriteMsg("<span class='warning'>The mmi indicates that their mind is completely unresponsive; there's no point!</span>");
                        return(null);
                    }

                    if (!Lang13.Bool(BM.client))
                    {
                        user.WriteMsg("<span class='warning'>The mmi indicates that their mind is currently inactive; it might change!</span>");
                        return(null);
                    }

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

                    if (GlobalFuncs.jobban_isbanned(BM, "Cyborg"))
                    {
                        user.WriteMsg("<span class='warning'>This MMI does not seem to fit!</span>");
                        return(null);
                    }
                    O = new Mob_Living_Silicon_Robot(GlobalFuncs.get_turf(this.loc));

                    if (!(O != null))
                    {
                        return(null);
                    }

                    if (!((Mob)user).unEquip(A))
                    {
                        return(null);
                    }

                    if (M2.syndiemmi)
                    {
                        this.aisync  = false;
                        this.lawsync = false;
                        O.laws       = new AiLaws_SyndicateOverride();
                    }
                    O.invisibility = 0;
                    O.custom_name  = this.created_name;
                    O.locked       = this.panel_locked;

                    if (!this.aisync)
                    {
                        this.lawsync   = false;
                        O.connected_ai = null;
                    }
                    else
                    {
                        O.notify_ai(1);

                        if (Lang13.Bool(this.forced_ai))
                        {
                            O.connected_ai = this.forced_ai;
                        }
                    }

                    if (!this.lawsync && !M2.syndiemmi)
                    {
                        O.lawupdate = false;
                        O.make_laws();
                    }
                    ((GameMode)GlobalVars.ticker.mode).remove_antag_for_borging(BM.mind);
                    ((Mind)BM.mind).transfer_to(O);

                    if (O.mind != null && Lang13.Bool(O.mind.special_role))
                    {
                        O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.");
                        O.WriteMsg("<span class='userdanger'>You have been robotized!</span>");
                        O.WriteMsg("<span class='danger'>You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.</span>");
                    }
                    O.job  = "Cyborg";
                    O.cell = this.chest.cell;
                    this.chest.cell.loc = O;
                    this.chest.cell     = null;
                    A.loc = O;

                    if (Lang13.Bool(O.mmi))
                    {
                        GlobalFuncs.qdel(O.mmi);
                    }
                    O.mmi = A;
                    O.updatename();
                    GlobalFuncs.feedback_inc("cyborg_birth", 1);
                    this.loc     = O;
                    O.robot_suit = this;

                    if (!this.locomotion)
                    {
                        O.lockcharge = true;
                        O.update_canmove();
                        O.WriteMsg("<span class='warning'>Error: Servo motors unresponsive.</span>");
                    }
                }
                else
                {
                    user.WriteMsg("<span class='warning'>The MMI must go in after everything else!</span>");
                }
            }

            if (A is Obj_Item_Weapon_Pen)
            {
                user.WriteMsg("<span class='warning'>You need to use a multitool to name " + this + "!</span>");
            }
            return(null);
        }
Ejemplo n.º 25
0
        // Function from file: sortingmachinery.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic O = null;
            Obj_Item_SmallDelivery P = null;
            int     i  = 0;
            dynamic O2 = null;
            Obj_Structure_BigDelivery P2 = null;
            dynamic O3 = null;
            Obj_Structure_BigDelivery P3 = null;


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

            if (!(target is Obj))
            {
                return(false);
            }

            if (target is Obj_Item_SmallDelivery || target is Obj_Structure_BigDelivery || target is Obj_Item_Weapon_Evidencebag || target is Obj_Structure_Closet_BodyBag)
            {
                return(false);
            }

            if (Lang13.Bool(target.anchored))
            {
                return(false);
            }

            if (Lang13.Bool(user.Contains(target)))
            {
                return(false);
            }

            if (target is Obj_Item && !(target is Obj_Item_Weapon_Storage && !(target is Obj_Item_Weapon_Storage_Box)))
            {
                O = target;

                if (this.use(1) != 0)
                {
                    P = new Obj_Item_SmallDelivery(GlobalFuncs.get_turf(O.loc));

                    if (!(O.loc is Tile))
                    {
                        if (Lang13.Bool(user.client))
                        {
                            user.client.screen -= O;
                        }
                    }
                    P.wrapped = O;
                    O.loc     = P;
                    i         = Num13.Floor(Convert.ToDouble(O.w_class));

                    if (new ByTable(new object [] { 1, 2, 3, 4, 5 }).Contains(i))
                    {
                        P.icon_state = "deliverycrate" + i;
                        P.w_class    = i;
                    }
                    P.add_fingerprint(Task13.User);
                    ((Ent_Static)O).add_fingerprint(Task13.User);
                    this.add_fingerprint(Task13.User);
                }
                else
                {
                    return(false);
                }
            }
            else if (target is Obj_Structure_Closet_Crate)
            {
                O2 = target;

                if (Lang13.Bool(O2.opened))
                {
                    return(false);
                }

                if (this.use(3) != 0)
                {
                    P2            = new Obj_Structure_BigDelivery(GlobalFuncs.get_turf(O2.loc));
                    P2.icon_state = "deliverycrate";
                    P2.wrapped    = O2;
                    O2.loc        = P2;
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need more paper!</span>");
                    return(false);
                }
            }
            else if (target is Obj_Structure_Closet)
            {
                O3 = target;

                if (Lang13.Bool(O3.opened))
                {
                    return(false);
                }

                if (this.use(3) != 0)
                {
                    P3         = new Obj_Structure_BigDelivery(GlobalFuncs.get_turf(O3.loc));
                    P3.wrapped = O3;
                    O3.welded  = 1;
                    O3.loc     = P3;
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You need more paper!</span>");
                    return(false);
                }
            }
            else
            {
                user.WriteMsg("<span class='warning'>The object you are trying to wrap is unsuitable for the sorting machinery!</span>");
                return(false);
            }
            ((Ent_Static)user).visible_message("" + user + " wraps " + target + ".");
            user.attack_log += "[" + GlobalFuncs.time_stamp() + "] <font color='blue'>Has used " + this.name + " on " + target + "</font>";

            if ((this.amount ?? 0) <= 0 && !(this.loc != null))
            {
                new Obj_Item_Weapon_CTube(GlobalFuncs.get_turf(user));
            }
            return(false);
        }
Ejemplo n.º 26
0
        // Function from file: robot_parts.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Mob     living_user  = null;
            dynamic item_in_hand = null;
            string  new_name     = null;


            if (Lang13.Bool(Task13.User.lying) || Task13.User.stat != 0 || Task13.User.stunned != 0 || !this.Adjacent(Task13.User))
            {
                return(null);
            }
            living_user  = Task13.User;
            item_in_hand = living_user.get_active_hand();

            if (!(item_in_hand is Obj_Item_Device_Multitool))
            {
                living_user.WriteMsg("<span class='warning'>You need a multitool!</span>");
                return(null);
            }

            if (Lang13.Bool(href_list["Name"]))
            {
                new_name = GlobalFuncs.reject_bad_name(Interface13.Input(Task13.User, "Enter new designation. Set to blank to reset to default.", "Cyborg Debug", this.created_name, null, InputType.Any), true);

                if (!(Map13.GetDistance(this, Task13.User) <= 1) && this.loc != Task13.User)
                {
                    return(null);
                }

                if (Lang13.Bool(new_name))
                {
                    this.created_name = new_name;
                }
                else
                {
                    this.created_name = "";
                }
            }
            else if (Lang13.Bool(href_list["Master"]))
            {
                this.forced_ai = GlobalFuncs.select_active_ai(Task13.User);

                if (!Lang13.Bool(this.forced_ai))
                {
                    Task13.User.WriteMsg("<span class='error'>No active AIs detected.</span>");
                }
            }
            else if (Lang13.Bool(href_list["Law"]))
            {
                this.lawsync = !this.lawsync;
            }
            else if (Lang13.Bool(href_list["AI"]))
            {
                this.aisync = !this.aisync;
            }
            else if (Lang13.Bool(href_list["Loco"]))
            {
                this.locomotion = !this.locomotion;
            }
            else if (Lang13.Bool(href_list["Panel"]))
            {
                this.panel_locked = !this.panel_locked;
            }
            this.add_fingerprint(Task13.User);
            this.Interact(Task13.User);
            return(null);
        }
Ejemplo n.º 27
0
        // Function from file: swapmaps.dm
        public override void Read(SaveFile F = null, dynamic __id = null, dynamic locorner = null)
        {
            double     x       = 0;
            double     y       = 0;
            double     z       = 0;
            dynamic    n       = null;
            dynamic    areas   = null;
            dynamic    defarea = null;
            dynamic    dummy   = null;
            string     oldcd   = null;
            dynamic    tp      = null;
            dynamic    T       = null;
            Ent_Static A       = null;
            Obj        O       = null;
            dynamic    M       = null;

            defarea = Lang13.FindObj(Game13.default_zone);
            this.id = __id;

            if (Lang13.Bool(locorner))
            {
                this.ischunk = true;
                this.x1      = Convert.ToInt32(locorner.x);
                this.y1      = Convert.ToInt32(locorner.y);
                this.z1      = Lang13.IntNullable(locorner.z);
            }

            if (!Lang13.Bool(defarea))
            {
                defarea = Lang13.Call(Game13.default_zone);
            }

            if (!Lang13.Bool(__id))
            {
                this.id = F.ReadItem("id", this.id);
            }
            else
            {
                dummy = F.ReadItem("id", dummy);
            }
            this.z2     = F.ReadItem("z", this.z2);
            this.y2     = F.ReadItem("y", this.y2);
            this.x2     = F.ReadItem("x", this.x2);
            areas       = F.ReadItem("areas", areas);
            this.locked = true;
            this.AllocateSwapMap();
            oldcd = F.cd;

            foreach (dynamic _e in Lang13.IterateRange(this.z1, this.z2))
            {
                z = _e;

                F.cd = "" + (z - (this.z1 ?? 0) + 1);

                foreach (dynamic _d in Lang13.IterateRange(this.y1, this.y2))
                {
                    y = _d;

                    F.cd = "" + (y - this.y1 + 1);

                    foreach (dynamic _c in Lang13.IterateRange(this.x1, this.x2))
                    {
                        x = _c;

                        F.cd = "" + (x - this.x1 + 1);
                        tp   = null;
                        tp   = F.ReadItem("type", tp);
                        T    = Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z)));
                        T.loc.contents.Remove(T);
                        T = Lang13.Call(tp, Map13.GetTile(((int)(x)), ((int)(y)), ((int)(z))));

                        if (F.dir.Contains("AREA"))
                        {
                            n = F.ReadItem("AREA", n);
                            A = areas[n];
                            A.contents.Add(T);
                        }
                        else
                        {
                            defarea.contents.Add(T);
                        }

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

                            GlobalFuncs.qdel(O);
                        }

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


                            if (!Lang13.Bool(M.key))
                            {
                                GlobalFuncs.qdel(M);
                            }
                            else
                            {
                                M.loc = null;
                            }
                        }
                        ((Base_Data)T).Read(F);
                        F.cd = "..";
                    }
                    F.cd = "..";
                }
                Task13.Sleep(0);
                F.cd = oldcd;
            }
            this.locked = false;
            GlobalFuncs.qdel(areas);
            return;
        }
Ejemplo n.º 28
0
        // Function from file: robot_parts.dm
        public void Interact(dynamic user = null)
        {
            string  t1    = null;
            Browser popup = null;

            t1    = new Txt("Designation: <A href='?src=").Ref(this).str(";Name=1'>").item((Lang13.Bool(this.created_name) ? "" + this.created_name : "Default Cyborg")).str("</a><br>\n").ToString();
            t1   += new Txt("Master AI: <A href='?src=").Ref(this).str(";Master=1'>").item((Lang13.Bool(this.forced_ai) ? "" + this.forced_ai.name : "Automatic")).str("</a><br><br>\n").ToString();
            t1   += new Txt("LawSync Port: <A href='?src=").Ref(this).str(";Law=1'>").item((this.lawsync ? "Open" : "Closed")).str("</a><br>\n").ToString();
            t1   += new Txt("AI Connection Port: <A href='?src=").Ref(this).str(";AI=1'>").item((this.aisync ? "Open" : "Closed")).str("</a><br>\n").ToString();
            t1   += new Txt("Servo Motor Functions: <A href='?src=").Ref(this).str(";Loco=1'>").item((this.locomotion ? "Unlocked" : "Locked")).str("</a><br>\n").ToString();
            t1   += new Txt("Panel Lock: <A href='?src=").Ref(this).str(";Panel=1'>").item((this.panel_locked ? "Engaged" : "Disengaged")).str("</a><br>\n").ToString();
            popup = new Browser(user, "robotdebug", "Cyborg Boot Debug", 310, 220);
            popup.set_content(t1);
            popup.open();
            return;
        }
Ejemplo n.º 29
0
        // Function from file: swapmaps.dm
        public override dynamic Destroy(  )
        {
            ByTable    areas = null;
            Ent_Static A     = null;
            Obj        O     = null;
            dynamic    M     = null;
            dynamic    a     = null;


            if (!this.ischunk)
            {
                GlobalVars.swapmaps_loaded.Remove(this);
                GlobalVars.swapmaps_byname.Remove(this.id);

                if ((this.z2 ?? 0) > GlobalVars.swapmaps_compiled_maxz || this.y2 > GlobalVars.swapmaps_compiled_maxy || this.x2 > GlobalVars.swapmaps_compiled_maxx)
                {
                    areas = new ByTable();

                    foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(this.x1, this.y1, this.z1 ?? 0), Map13.GetTile(this.x2, this.y2, this.z2 ?? 0)), typeof(Ent_Static)))
                    {
                        A = _c;


                        foreach (dynamic _a in Lang13.Enumerate(A, typeof(Obj)))
                        {
                            O = _a;

                            GlobalFuncs.qdel(O);
                        }

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


                            if (!Lang13.Bool(M.key))
                            {
                                GlobalFuncs.qdel(M);
                            }
                            else
                            {
                                M.loc = null;
                            }
                        }
                        areas[A.loc] = null;
                        GlobalFuncs.qdel(A);
                    }

                    foreach (dynamic _d in Lang13.Enumerate(areas))
                    {
                        a = _d;


                        if (Lang13.Bool(a) && !(a.contents.len != 0))
                        {
                            GlobalFuncs.qdel(a);
                        }
                    }

                    if (this.x2 >= Game13.map_size_x || this.y2 >= Game13.map_size_y || (this.z2 ?? 0) >= Game13.map_size_z)
                    {
                        this.CutXYZ();
                    }
                    GlobalFuncs.qdel(areas);
                }
            }
            base.Destroy();
            return(4);
        }
Ejemplo n.º 30
0
        // Function from file: LINDA_system.dm
        public void atmos_spawn_air(int flag = 0, double?amount = null)
        {
            GasMixture G         = null;
            ByTable    new_gases = null;


            if (!Lang13.Bool(this.text) || !Lang13.Bool(amount) || !(this.air != null))
            {
                return;
            }
            G         = new GasMixture();
            new_gases = G.gases;

            if ((flag & 2) != 0)
            {
                G.temperature = 293.41;
            }

            if ((flag & 1) != 0)
            {
                G.temperature += 1000;
            }

            if ((flag & 4) != 0)
            {
                G.assert_gas("plasma");
                new_gases["plasma"][1] += amount;
            }

            if ((flag & 8) != 0)
            {
                G.assert_gas("o2");
                new_gases["o2"][1] += amount;
            }

            if ((flag & 16) != 0)
            {
                G.assert_gas("co2");
                new_gases["co2"][1] += amount;
            }

            if ((flag & 32) != 0)
            {
                G.assert_gas("n2");
                new_gases["n2"][1] += amount;
            }

            if ((flag & 64) != 0)
            {
                G.assert_gas("n2o");
                new_gases["n2o"][1] += amount;
            }

            if ((flag & 256) != 0)
            {
                G.assert_gases("o2", "n2");
                new_gases["o2"][1] += (amount ?? 0) * 21.83659553527832;
                new_gases["n2"][1] += (amount ?? 0) * 82.14720153808594;
            }
            this.air.merge(G);
            GlobalVars.SSair.add_to_active(this, false);
            return;
        }