Пример #1
0
        // Function from file: cameranet.dm
        public void majorChunkChange(Ent_Static c = null, int choice = 0)
        {
            dynamic     T     = null;
            int         x1    = 0;
            int         y1    = 0;
            int?        x2    = null;
            int?        y2    = null;
            int?        x     = null;
            int?        y     = null;
            Camerachunk chunk = null;


            if (!(c != null))
            {
                return;
            }
            T = GlobalFuncs.get_turf(c);

            if (Lang13.Bool(T))
            {
                x1 = Num13.MaxInt(0, Convert.ToInt32(T.x - 8)) & 65520;
                y1 = Num13.MaxInt(0, Convert.ToInt32(T.y - 8)) & 65520;
                x2 = Num13.MinInt(Game13.map_size_x, Convert.ToInt32(T.x + 8)) & 65520;
                y2 = Num13.MinInt(Game13.map_size_y, Convert.ToInt32(T.y + 8)) & 65520;
                x  = null;
                x  = x1;

                while ((x ?? 0) <= (x2 ?? 0))
                {
                    y = null;
                    y = y1;

                    while ((y ?? 0) <= (y2 ?? 0))
                    {
                        if (Lang13.Bool(this.chunkGenerated(x, y, Convert.ToInt32(T.z))))
                        {
                            chunk = this.getCameraChunk(x, y, Convert.ToInt32(T.z));

                            if (choice == 0)
                            {
                                chunk.cameras.Remove(c);
                            }
                            else if (choice == 1)
                            {
                                chunk.cameras.Or(c);
                            }
                            chunk.hasChanged();
                        }
                        y += GlobalVars.CHUNK_SIZE;
                    }
                    x += GlobalVars.CHUNK_SIZE;
                }
            }
            return;
        }
Пример #2
0
        // Function from file: cameranet.dm
        public void updateChunk(int?x = null, int?y = null, int z = 0)
        {
            Camerachunk chunk = null;


            if (!Lang13.Bool(this.chunkGenerated(x, y, z)))
            {
                return;
            }
            chunk = this.getCameraChunk(x, y, z);
            chunk.hasChanged();
            return;
        }
Пример #3
0
        // Function from file: cameranet.dm
        public bool checkTurfVis(dynamic position = null)
        {
            Camerachunk chunk = null;

            chunk = this.getCameraChunk(Lang13.IntNullable(position.x), Lang13.IntNullable(position.y), Convert.ToInt32(position.z));

            if (chunk != null)
            {
                if (chunk.changed)
                {
                    chunk.hasChanged(true);
                }

                if (Lang13.Bool(chunk.visibleTurfs[position]))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
        // Function from file: camera.dm
        public override void Activate(int?forced_state = null)
        {
            dynamic C          = null;
            Obj     remote_eye = null;
            Obj_Machinery_Computer_CameraAdvanced origin = null;
            Camerachunk chunk = 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;
            origin.current_user = null;
            origin.jump_action.Remove(C);
            ((dynamic)origin).tele_in_action.Remove(C);
            ((dynamic)origin).tele_out_action.Remove(C);
            ((dynamic)origin).tele_self_action.Remove(C);
            ((dynamic)origin).vest_mode_action.Remove(C);
            ((dynamic)origin).vest_disguise_action.Remove(C);
            ((dynamic)remote_eye).eye_user = null;
            ((Mob)C).reset_perspective(null);

            if (Lang13.Bool(C.client))
            {
                C.client.images.Remove(((dynamic)remote_eye).user_image);

                foreach (dynamic _a in Lang13.Enumerate(((dynamic)remote_eye).visibleCameraChunks, typeof(Camerachunk)))
                {
                    chunk = _a;

                    C.client.images.Remove(chunk.obscured);
                }
            }
            C.remote_control = null;
            ((Mob)C).unset_machine();
            this.Remove(C);
            return;
        }
Пример #5
0
        // Function from file: multitool.dm
        public override int?process(dynamic seconds = null)
        {
            bool    found_eye           = false;
            dynamic our_turf            = null;
            Mob_Living_Silicon_Ai AI    = null;
            Camerachunk           chunk = null;
            Mob_Camera_AiEye      A     = null;
            dynamic eye_turf            = null;


            if (this.track_delay > Game13.time)
            {
                return(null);
            }
            found_eye = false;
            our_turf  = GlobalFuncs.get_turf(this);

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.ai_list, typeof(Mob_Living_Silicon_Ai)))
            {
                AI = _a;


                if (AI.cameraFollow == this)
                {
                    found_eye = true;
                    break;
                }
            }

            if (!found_eye && Lang13.Bool(GlobalVars.cameranet.chunkGenerated(Lang13.IntNullable(our_turf.x), Lang13.IntNullable(our_turf.y), Convert.ToInt32(our_turf.z))))
            {
                chunk = GlobalVars.cameranet.getCameraChunk(Lang13.IntNullable(our_turf.x), Lang13.IntNullable(our_turf.y), Convert.ToInt32(our_turf.z));

                if (chunk != null)
                {
                    if (chunk.seenby.len != 0)
                    {
                        foreach (dynamic _b in Lang13.Enumerate(chunk.seenby, typeof(Mob_Camera_AiEye)))
                        {
                            A = _b;

                            eye_turf = GlobalFuncs.get_turf(A);

                            if (Map13.GetDistance(our_turf, eye_turf) < 8)
                            {
                                found_eye = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (found_eye)
            {
                this.icon_state = "" + Lang13.Initial(this, "icon_state") + "_red";
            }
            else
            {
                this.icon_state = Lang13.Initial(this, "icon_state");
            }
            this.track_delay = Game13.time + 10;
            return(null);
        }