/// <summary>
        ///
        /// </summary>
        /// <param name="regionHandle"></param>
        public override void ResetRegion(ulong regionHandle)
        {
            bool changed = (regionHandle != RegionHandle);

            base.ResetRegion(regionHandle);
            if (changed && IsRegionAttached)
            {
                //lock (KnownSimObjects)
                KnownSimObjects.Clear();
                GetKnownObjects();
            }
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            RadegastInstance instance = TheBotClient.TheRadegastInstance;

            foreach (var set in BeamInfos)
            {
                set.UnSetPointing();
            }
            BeamInfos.Clear();
            int used;

            if (args.Length == 0)
            {
                if (instance != null)
                {
                    instance.State.UnSetPointing();
                }
                TheSimAvatar.SelectedBeam = !TheSimAvatar.SelectedBeam;
                return(Success("SelectedBeam = " + TheSimAvatar.SelectedBeam));
            }
            var targets          = args.GetProperty("targets");
            List <SimObject> PS  = WorldSystem.GetPrimitives(targets, out used);
            GridClient       grc = TheBotClient;

            if (PS.Count == 0)
            {
                SimPosition pos = WorldSystem.GetVector(targets, out used);
                if (pos != null)
                {
                    EffectBeamInfo info = new EffectBeamInfo(grc);
                    info.SetPointing(pos, 3);
                    BeamInfos.AddTo(info);
                    return(Success(Name + " on " + pos));
                }
                return(Failure(string.Format("Cant find {0}", string.Join(" ", args))));
            }
            foreach (var o in PS)
            {
                EffectBeamInfo info = new EffectBeamInfo(grc);
                info.SetPointing(o, 3);
                BeamInfos.AddTo(info);
                Primitive p = o.Prim;
                if (p != null && instance != null)
                {
                    instance.State.SetPointing(p, 3);
                }
            }
            return(Success(Name + " on " + PS.Count));
        }
Exemple #3
0
        public override CmdResult ExecuteRequest(CmdRequest argsI)
        {
            ListAsSet <SimPosition> objs = TheSimAvatar.GetSelectedObjects();

            if (argsI.Length == 0)
            {
                foreach (var o in objs)
                {
                    WriteLine(" " + o);
                }
                return(SuccessOrFailure());
            }
            if (argsI.ContainsFlag("--clear"))
            {
                objs.Clear();
                bool was = TheSimAvatar.SelectedBeam;
                TheSimAvatar.SelectedBeam = !was;
                TheSimAvatar.SelectedBeam = was;
            }
            var args = argsI.GetProperty("targets");

            {
                int  used   = 0;
                bool remove = false;
                while (used < args.Length)
                {
                    args = Parser.SplitOff(args, used);
                    string s = args[0];
                    if (s.StartsWith("-"))
                    {
                        remove = true;
                        s      = s.Substring(1);
                    }
                    if (s.StartsWith("+"))
                    {
                        remove = false;
                        s      = s.Substring(1);
                    }
                    if (s.Length < 0)
                    {
                        used = 1;
                        continue;
                    }
                    args[0] = s;
                    List <SimObject> PS = WorldSystem.GetPrimitives(args, out used);
                    foreach (var P in PS)
                    {
                        if (P == null)
                        {
                            WriteLine("Cannot find " + s);
                            used = 1;
                            continue;
                        }
                        if (remove)
                        {
                            WriteLine("Removing " + P);
                            TheSimAvatar.SelectedRemove(P);
                        }
                        else
                        {
                            WriteLine("Adding " + P);
                            TheSimAvatar.SelectedAdd(P);
                        }
                    }
                    if (used == 0)
                    {
                        break;
                    }
                }
            }
            return(Success("selected objects count=" + objs.Count));
        }