Beispiel #1
0
        public void Aging()
        {
            BotNeeds CurrentNeeds = this.CurrentNeeds;

            // Initially randomize
            foreach (FieldInfo c in CurrentNeeds.GetType().GetFields())
            {
                if (c.FieldType == typeof(float))
                {
                    CurrentNeeds.SetValue(c, CurrentNeeds, MyRandom.Next(100));
                }
            }

            BotNeeds OneMinute = SimTypeSystem.GetObjectType("OnMinuteTimer").GetUsageActual("OnMinuteTimer");

            while (true)
            {
                Actor.ScanNewObjects(2, Actor.SightRange, false);
                CurrentNeeds.AddFrom(OneMinute);
                CurrentNeeds.SetRange(0.0F, 100.0F);
                //SimPosition to = WorldObjects.Master.m_TheSimAvatar;
                //if (to != null)
                //{
                //    Console.WriteLine("Aging: " + this + " " + to.DistanceVectorString(this));
                //}
                Thread.Sleep(60000); ///  one minute

                ///  Debug(CurrentNeeds.ToString());
            }
        }
        public void Aging()
        {
            BotNeeds OneMinute = SimTypeSystem.GetObjectType("OnMinuteTimer").GetUsageActual("OnMinuteTimer");

            while (true)
            {
                Actor.ScanNewObjects(2, Actor.SightRange, false);
                CurrentNeeds.AddFrom(OneMinute);
                CurrentNeeds.SetRange(0.0F, 100.0F);
                //SimPosition to = WorldObjects.Master.m_TheSimAvatar;
                //if (to != null)
                //{
                //    Console.WriteLine("Aging: " + this + " " + to.DistanceVectorString(this));
                //}
                Thread.Sleep(60000); ///  one minute

                ///  Debug(CurrentNeeds.ToString());
            }
        }
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length > 0)
     {
         if (args[0] == "ini")
         {
             SimTypeSystem.LoadDefaultTypes0();
             WorldSystem.RescanTypes();
             return(Success("ReLoaded  ini"));
         }
         if (args[0] == "list")
         {
             return(Success(SimTypeSystem.ListTypes(false, true, true, false)));
         }
         if (args[0] == "load")
         {
             if (args.Length > 1)
             {
                 SimTypeSystem.LoadConfig(args[1]);
             }
             WorldSystem.RescanTypes();
             return(Success("(Re)Loaded " + args[1]));
         }
         if (args[0] == "uses")
         {
             return(Success(SimTypeSystem.ListTypes(true, true, false, false)));
         }
         if (args[0] == "objects")
         {
             return(Success(SimTypeSystem.ListTypes(true, false, true, false)));
         }
         if (args[0] == "instances")
         {
             return(Success(SimTypeSystem.ListTypes(true, false, false, true)));
         }
     }
     return(ShowUsage());
 }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 2)
            {
                return(ShowUsage());
            }
            SimTypeUsage use = SimTypeSystem.FindObjectUse(args[0]);

            if (use == null)
            {
                return(Failure("Unknown use: " + args[0]));
            }
            args = args.AdvanceArgs(1);
            int       argsUsed;
            SimObject O = WorldSystem.GetSimObjectS(args, out argsUsed);

            if (O == null)
            {
                return(Failure("Cant find simobject " + args.str));
            }
            WriteLine("Doing " + use + " for " + O);
            WorldSystem.TheSimAvatar.Do(use, O);
            return(Success("Did " + use + " for " + O));
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (_thinker == null)
            {
                if (Client.Self.AgentID == UUID.Zero)
                {
                    return(Failure("waiting for Agent ID"));
                }
            }
            if (args.Length > 0)
            {
                switch (args[0])
                {
                case "off":
                {
                    if (_thinker == null)
                    {
                        return(Failure("no parrot"));
                    }
                    _thinker.PauseThinking();
                    return(Success("turned off " + _thinker));
                }

                case "move":
                {
                    if (_thinker == null)
                    {
                        return(Failure("no parrot"));
                    }
                    Thinker.Actions["move"] = true;
                    break;
                }

                default:
                {
                    break;
                }
                }
                if (args[0] == "on")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    return(Success("Turned on " + avatar));
                }

                if (args[0] == "start")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    avatar.StartThinking();
                    return(Success("Started Thinking " + avatar));
                }

                if (args[0] == "needs")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    return(Success(avatar.CurrentNeeds.ToString()));
                }

                if (args[0] == "think")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    if (avatar.IsThinking())
                    {
                        avatar.PauseThinking();
                    }
                    avatar.ThinkOnce();
                    return(Success("Think once " + avatar));
                }

                if (args[0] == "info")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    return(Success("List " + avatar.DebugInfo()));
                }


                //  if (BRM == null) return "the bot is off";

                if (args[0] == "stop")
                {
                    SimParrotActor avatar = GetSimAvatar();
                    avatar.PauseThinking();
                    return(Success("Stopped " + avatar));
                }
                else if (args[0] == "off")
                {
                    //    if (BRM == null) return "the bot was off";
                    SimParrotActor avatar = GetSimAvatar();
                    avatar.PauseThinking();
                    //   BRM = null;
                    return(Success("Stopped " + avatar));
                }

                if (args[0] == "load")
                {
                    SimTypeSystem.LoadConfig(args[1]);
                    WorldSystem.RescanTypes();
                    return(Success("(Re)Loaded " + args[1]));
                }
            }
            return(Failure(Details));
        }