// Function from file: camera_bug.dm
        public ByTable get_cameras(  )
        {
            Obj_Machinery_Camera camera = null;


            if (Game13.time > (this.last_net_update ?1:0) + 100)
            {
                this.bugged_cameras = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cameranet.cameras, typeof(Obj_Machinery_Camera)))
                {
                    camera = _a;


                    if (camera.stat != 0 || !camera.can_use())
                    {
                        continue;
                    }

                    if (Lang13.Length(new ByTable(new object [] { "SS13", "MINE" }) & camera.network) != 0)
                    {
                        this.bugged_cameras[camera.c_tag] = camera;
                    }
                }
            }
            GlobalFuncs.sortList(this.bugged_cameras);
            return(this.bugged_cameras);
        }
Exemple #2
0
        // Function from file: camera.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            ByTable camera_list      = null;
            dynamic Num              = null;
            Obj_Machinery_Camera CAM = null;


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

            if (!(this.network != null))
            {
                throw new Exception("No camera network");
                ((Mob)a).unset_machine();
                return(null);
            }

            if (!(this.network is ByTable))
            {
                throw new Exception("Camera network is not a list");
                ((Mob)a).unset_machine();
                return(null);
            }

            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                ((Mob)a).unset_machine();
                return(null);
            }
            camera_list = this.get_available_cameras();

            if (!this.watchers.Contains(a))
            {
                foreach (dynamic _a in Lang13.Enumerate(camera_list))
                {
                    Num = _a;

                    CAM = camera_list[Num];

                    if (CAM is Obj_Machinery_Camera)
                    {
                        if (CAM.can_use())
                        {
                            this.watchers[a] = CAM;
                            break;
                        }
                    }
                }

                if (!this.watchers.Contains(a))
                {
                    ((Mob)a).unset_machine();
                    return(null);
                }
            }
            this.use_camera_console(a);
            return(null);
        }
Exemple #3
0
 // Function from file: cameranet.dm
 public void removeCamera(Obj_Machinery_Camera c = null)
 {
     if (c.can_use())
     {
         this.majorChunkChange(c, 0);
     }
     return;
 }
Exemple #4
0
 // Function from file: cameranet.dm
 public void updatePortableCamera(Obj_Machinery_Camera c = null)
 {
     if (c.can_use())
     {
         this.majorChunkChange(c, 1);
     }
     return;
 }
        // Function from file: camera_advanced.dm
        public override void Activate(int?forced_state = null)
        {
            dynamic C                   = null;
            Obj     remote_eye          = null;
            dynamic origin              = null;
            ByTable L                   = null;
            Obj_Machinery_Camera cam    = null;
            ByTable T                   = null;
            Obj_Machinery_Camera netcam = null;
            ByTable tempnetwork         = null;
            dynamic camera              = null;
            dynamic final               = null;


            if (!Lang13.Bool(this.target) || !(this.target is Mob_Living_Carbon))
            {
                return;
            }
            C          = this.target;
            remote_eye = C.remote_control;
            origin     = ((dynamic)remote_eye).origin;
            L          = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.cameranet.cameras, typeof(Obj_Machinery_Camera)))
            {
                cam = _a;

                L.Add(cam);
            }
            GlobalFuncs.camera_sort(L);
            T = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(L, typeof(Obj_Machinery_Camera)))
            {
                netcam = _b;

                tempnetwork = netcam.network & origin.networks;

                if (tempnetwork.len != 0)
                {
                    T["" + netcam.c_tag + (netcam.can_use() ? null : " (Deactivated)")] = netcam;
                }
            }
            camera = Interface13.Input("Choose which camera you want to view", "Cameras", null, null, T, InputType.Null | InputType.Any);
            final  = T[camera];

            if (Lang13.Bool(final))
            {
                ((Mob_Camera_AiEye)remote_eye).setLoc(GlobalFuncs.get_turf(final));
            }
            return;
        }
Exemple #6
0
        // Function from file: camera.dm
        public override dynamic check_eye(Mob user = null)
        {
            Obj_Machinery_Camera C = null;
            ByTable viewing        = null;


            if ((this.stat & 3) != 0 || user.incapacitated() || user.eye_blind != 0)
            {
                user.unset_machine();
                return(null);
            }

            if (!this.watchers.Contains(user))
            {
                user.unset_machine();
                return(null);
            }

            if (!Lang13.Bool(this.watchers[user]))
            {
                user.unset_machine();
                return(null);
            }
            C = this.watchers[user];

            if (!C.can_use())
            {
                user.unset_machine();
                return(null);
            }

            if (!(user is Mob_Living_Silicon))
            {
                if (!this.Adjacent(user))
                {
                    user.unset_machine();
                    return(null);
                }
            }
            else if (user is Mob_Living_Silicon_Robot)
            {
                viewing = Map13.FetchViewers(null, this);

                if (!(viewing.Find(user) != 0))
                {
                    user.unset_machine();
                }
            }
            return(null);
        }
Exemple #7
0
        // Function from file: chunk.dm
        public Camerachunk(dynamic loc = null, int?x = null, int?y = null, int z = 0)
        {
            Obj_Machinery_Camera c = null;
            dynamic t      = null;
            dynamic camera = null;
            dynamic c2     = null;
            dynamic t2     = null;
            dynamic turf   = null;
            dynamic t3     = null;

            x     &= 65520;
            y     &= 65520;
            this.x = x;
            this.y = y;
            this.z = z;

            foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.ultra_range(GlobalVars.CHUNK_SIZE, Map13.GetTile((x ?? 0) + 8, (y ?? 0) + 8, z)), typeof(Obj_Machinery_Camera)))
            {
                c = _a;


                if (c.can_use())
                {
                    this.cameras.Add(c);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInBlock(Map13.GetTile(x ?? 0, y ?? 0, z), Map13.GetTile(Num13.MinInt((x ?? 0) + 16 - 1, Game13.map_size_x), Num13.MinInt((y ?? 0) + 16 - 1, Game13.map_size_y), z))))
            {
                t = _b;

                this.turfs[t] = t;
            }

            foreach (dynamic _d in Lang13.Enumerate(this.cameras))
            {
                camera = _d;

                c2 = camera;

                if (!Lang13.Bool(c2))
                {
                    continue;
                }

                if (!((Obj_Machinery_Camera)c2).can_use())
                {
                    continue;
                }

                foreach (dynamic _c in Lang13.Enumerate(((Obj_Machinery_Camera)c2).can_see()))
                {
                    t2 = _c;

                    this.visibleTurfs[t2] = t2;
                }
            }
            this.visibleTurfs.And(this.turfs);
            this.obscuredTurfs = this.turfs - this.visibleTurfs;

            foreach (dynamic _e in Lang13.Enumerate(this.obscuredTurfs))
            {
                turf = _e;

                t3 = turf;

                if (!Lang13.Bool(t3.obscured))
                {
                    t3.obscured = new Image("icons/effects/cameravis.dmi", t3, "black", 16);
                }
                this.obscured.Add(t3.obscured);
            }
            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);
        }
        // Function from file: camera_bug.dm
        public override int?process(dynamic seconds = null)
        {
            dynamic M              = null;
            ByTable tracking_cams  = null;
            ByTable b_cams         = null;
            dynamic entry          = null;
            ByTable target_region  = null;
            Obj_Machinery_Camera C = null;


            if (this.track_mode == 0 || Game13.time < this.last_tracked + this.refresh_interval)
            {
                return(null);
            }
            this.last_tracked = Game13.time;

            if (this.track_mode == 2)
            {
                if (!Lang13.Bool(this.tracking))
                {
                    this.updateSelfDialog();
                    return(null);
                }

                if (this.tracking.name != this.tracked_name)
                {
                    M = this.tracking;

                    if (M is Mob)
                    {
                        if (!(this.tracked_name == "Unknown" && String13.FindIgnoreCase(this.tracking.name, "Unknown", 1, 0) != 0))
                        {
                            if (!(this.tracked_name == M.real_name && String13.FindIgnoreCase(this.tracking.name, M.real_name, 1, 0) != 0))
                            {
                                this.updateSelfDialog();
                                return(null);
                            }
                        }
                    }
                    else
                    {
                        this.updateSelfDialog();
                        return(null);
                    }
                }
                tracking_cams = new ByTable();
                b_cams        = this.get_cameras();

                foreach (dynamic _a in Lang13.Enumerate(b_cams))
                {
                    entry = _a;

                    tracking_cams.Add(b_cams[entry]);
                }
                target_region = Map13.FetchInView(null, this.tracking);

                foreach (dynamic _b in Lang13.Enumerate(target_region & tracking_cams, typeof(Obj_Machinery_Camera)))
                {
                    C = _b;


                    if (!GlobalFuncs.can_see(C, this.tracking))
                    {
                        continue;
                    }

                    if (C.can_use())
                    {
                        this.last_found = C.c_tag;
                        this.last_seen  = Game13.time;
                        break;
                    }
                }
            }
            this.updateSelfDialog();
            return(null);
        }
Exemple #10
0
        // Function from file: camera.dm
        public bool use_camera_console(dynamic user = null)
        {
            ByTable camera_list    = null;
            dynamic t              = null;
            Obj_Machinery_Camera C = null;
            bool    camera_fail    = false;
            ByTable viewing        = null;
            dynamic A              = null;

            camera_list = this.get_available_cameras();
            t           = Interface13.Input(user, "Which camera should you change to?", null, null, camera_list, InputType.Null | InputType.Any);

            if (user.machine != this)
            {
                return(false);
            }

            if (!Lang13.Bool(t))
            {
                ((Mob)user).unset_machine();
                return(false);
            }
            C = camera_list[t];

            if (t == "Cancel")
            {
                ((Mob)user).unset_machine();
                return(false);
            }

            if (C != null)
            {
                camera_fail = false;

                if (!C.can_use() || user.machine != this || user.eye_blind != 0 || ((Mob)user).incapacitated())
                {
                    camera_fail = true;
                }
                else if (user is Mob_Living_Silicon_Robot)
                {
                    viewing = Map13.FetchViewers(null, this);

                    if (!(viewing.Find(user) != 0))
                    {
                        camera_fail = true;
                    }
                }
                else if (!(user is Mob_Living_Silicon))
                {
                    if (!this.Adjacent(user))
                    {
                        camera_fail = true;
                    }
                }

                if (camera_fail)
                {
                    ((Mob)user).unset_machine();
                    return(false);
                }

                if (user is Mob_Living_Silicon_Ai)
                {
                    A = user;
                    ((Mob_Camera_AiEye)A.eyeobj).setLoc(GlobalFuncs.get_turf(C));
                    A.client.eye = A.eyeobj;
                }
                else
                {
                    ((Mob)user).reset_perspective(C);
                }
                this.watchers[user] = C;
                this.f_use_power(50);
                Task13.Schedule(5, (Task13.Closure)(() => {
                    this.use_camera_console(user);
                    return;
                }));
            }
            else
            {
                ((Mob)user).unset_machine();
            }
            return(false);
        }