예제 #1
0
        // Function from file: cameranet.dm
        public void visibility(Mob_Camera_AiEye ai = null)
        {
            int     x1            = 0;
            int     y1            = 0;
            int?    x2            = null;
            int?    y2            = null;
            ByTable visibleChunks = null;
            int?    x             = null;
            int?    y             = null;
            ByTable remove        = null;
            ByTable add           = null;
            dynamic chunk         = null;
            dynamic c             = null;
            dynamic chunk2        = null;
            dynamic c2            = null;

            x1            = Num13.MaxInt(0, ai.x - 16) & 65520;
            y1            = Num13.MaxInt(0, ai.y - 16) & 65520;
            x2            = Num13.MinInt(Game13.map_size_x, ai.x + 16) & 65520;
            y2            = Num13.MinInt(Game13.map_size_y, ai.y + 16) & 65520;
            visibleChunks = new ByTable();
            x             = null;
            x             = x1;

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

                while ((y ?? 0) <= (y2 ?? 0))
                {
                    visibleChunks.Or(this.getCameraChunk(x, y, ai.z));
                    y += GlobalVars.CHUNK_SIZE;
                }
                x += GlobalVars.CHUNK_SIZE;
            }
            remove = ai.visibleCameraChunks - visibleChunks;
            add    = visibleChunks - ai.visibleCameraChunks;

            foreach (dynamic _a in Lang13.Enumerate(remove))
            {
                chunk = _a;

                c = chunk;
                ((Camerachunk)c).remove(ai);
            }

            foreach (dynamic _b in Lang13.Enumerate(add))
            {
                chunk2 = _b;

                c2 = chunk2;
                ((Camerachunk)c2).add(ai);
            }
            return;
        }
예제 #2
0
        // Function from file: chunk.dm
        public void remove(Mob_Camera_AiEye eye = null)
        {
            Client client = null;

            client = eye.GetViewerClient();

            if (client != null)
            {
                client.images.Remove(this.obscured);
            }
            eye.visibleCameraChunks.Remove(this);
            this.seenby.Remove(eye);

            if (this.visible > 0)
            {
                this.visible--;
            }
            return;
        }
예제 #3
0
        // Function from file: chunk.dm
        public void add(Mob_Camera_AiEye eye = null)
        {
            Client client = null;

            client = eye.GetViewerClient();

            if (client != null)
            {
                client.images.Add(this.obscured);
            }
            eye.visibleCameraChunks.Add(this);
            this.visible++;
            this.seenby.Add(eye);

            if (this.changed && !this.updating)
            {
                this.update();
            }
            return;
        }
예제 #4
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);
        }