// Function from file: ed209bot.dm
        public void look_for_perp(  )
        {
            Mob_Living_Carbon C = null;


            if (this.disabled)
            {
                return;
            }
            this.anchored    = 0;
            this.threatlevel = 0;

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(this, 7), typeof(Mob_Living_Carbon)))
            {
                C = _a;


                if (C.stat != 0 || Lang13.Bool(C.handcuffed))
                {
                    continue;
                }

                if (C.name == this.oldtarget_name && Game13.time < this.last_found + 100)
                {
                    continue;
                }
                this.threatlevel = C.assess_threat(this, this.lasercolor);

                if (!(this.threatlevel != 0))
                {
                    continue;
                }
                else if (this.threatlevel >= 4)
                {
                    this.target         = C;
                    this.oldtarget_name = C.name;
                    this.f_speak("Level " + this.threatlevel + " infraction alert!");
                    GlobalFuncs.playsound(this.loc, Rand13.Pick(new object [] { "sound/voice/ed209_20sec.ogg", "sound/voice/EDPlaceholder.ogg" }), 50, 0);
                    this.visible_message("<b>" + this + "</b> points at " + C.name + "!");
                    this.v_mode = 1;
                    Task13.Schedule(0, (Task13.Closure)(() => {
                        this.handle_automated_action();
                        return;
                    }));
                    break;
                }
                else
                {
                    continue;
                }
            }
            return;
        }
        // Function from file: ed209bot.dm
        public override bool handle_automated_action(  )
        {
            ByTable           targets = null;
            Mob_Living_Carbon C       = null;
            int     threatlevel       = 0;
            int     dst     = 0;
            dynamic t       = null;
            int     olddist = 0;


            if (!base.handle_automated_action())
            {
                return(false);
            }

            if (this.disabled)
            {
                return(false);
            }
            targets = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(this, 7), typeof(Mob_Living_Carbon)))
            {
                C = _a;

                threatlevel = 0;

                if (C.stat != 0 || Lang13.Bool(C.lying))
                {
                    continue;
                }
                threatlevel = C.assess_threat(this, this.lasercolor);

                if (threatlevel < 4)
                {
                    continue;
                }
                dst = Map13.GetDistance(this, C);

                if (dst <= 1 || dst > 7)
                {
                    continue;
                }
                targets.Add(C);
            }

            if (targets.len > 0)
            {
                t = Rand13.PickFromTable(targets);

                if (Convert.ToInt32(t.stat) != 2 && t.lying != 1 && !Lang13.Bool(t.handcuffed))
                {
                    this.shootAt(t);
                }
            }

            switch ((int)(this.v_mode))
            {
            case 0:
                Map13.WalkTowards(this, 0, 0, 0);

                if (!Lang13.Bool(this.lasercolor))
                {
                    this.look_for_perp();
                }

                if (!(this.v_mode != 0) && this.auto_patrol)
                {
                    this.v_mode = 4;
                }
                break;

            case 1:

                if (this.frustration >= 8)
                {
                    Map13.WalkTowards(this, 0, 0, 0);
                    this.back_to_idle();
                }

                if (Lang13.Bool(this.target))
                {
                    if (this.Adjacent(this.target) && this.target.loc is Tile)
                    {
                        this.stun_attack(this.target);
                        this.v_mode         = 2;
                        this.anchored       = 1;
                        this.target_lastloc = this.target.loc;
                        return(false);
                    }
                    else
                    {
                        olddist = Map13.GetDistance(this, this.target);
                        Map13.WalkTowards(this, this.target, 1, 4);

                        if (Map13.GetDistance(this, this.target) >= olddist)
                        {
                            this.frustration++;
                        }
                        else
                        {
                            this.frustration = 0;
                        }
                    }
                }
                else
                {
                    this.back_to_idle();
                }
                break;

            case 2:

                if (!this.Adjacent(this.target) || !(this.target.loc is Tile) || this.target.weakened < 2)
                {
                    this.back_to_hunt();
                    return(false);
                }

                if (this.target is Mob_Living_Carbon && ((Mob_Living_Carbon)this.target).canBeHandcuffed())
                {
                    if (!this.arrest_type)
                    {
                        if (!Lang13.Bool(this.target.handcuffed))
                        {
                            this.cuff(this.target);
                        }
                        else
                        {
                            this.back_to_idle();
                            return(false);
                        }
                    }
                }
                else
                {
                    this.back_to_idle();
                    return(false);
                }
                break;

            case 3:

                if (!Lang13.Bool(this.target))
                {
                    this.anchored    = 0;
                    this.v_mode      = 0;
                    this.last_found  = Game13.time;
                    this.frustration = 0;
                    return(false);
                }

                if (Lang13.Bool(this.target.handcuffed))
                {
                    this.back_to_idle();
                    return(false);
                }

                if (!this.Adjacent(this.target) || !(this.target.loc is Tile) || this.target.loc != this.target_lastloc && this.target.weakened < 2)
                {
                    this.back_to_hunt();
                    return(false);
                }
                else
                {
                    this.v_mode   = 2;
                    this.anchored = 0;
                }
                break;

            case 4:
                this.look_for_perp();
                this.start_patrol();
                break;

            case 5:
                this.look_for_perp();
                this.bot_patrol();
                break;
            }
            return(false);
        }