From ed7ddeecf2df370638feb0a83b70a0883a711650 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Nov 2011 22:18:10 +0000 Subject: Print out what behaviours are active when pCampBot starts up --- .../Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 2 ++ .../Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 2 ++ .../Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 2 ++ OpenSim/Tools/pCampBot/BotManager.cs | 39 +++++++++++++++------- OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs | 9 +++++ 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs index 7084ab4..0a6d5d2 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs @@ -41,6 +41,8 @@ namespace pCampBot /// public class GrabbingBehaviour : IBehaviour { + public string Name { get { return "Grabbing"; } } + public void Action(Bot bot) { Dictionary objects = bot.Objects; diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs index 3ce08bf..f782bb5 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs @@ -42,6 +42,8 @@ namespace pCampBot /// public class PhysicsBehaviour : IBehaviour { + public string Name { get { return "Physics"; } } + private string[] talkarray; public PhysicsBehaviour() diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs index 4624494..fc2ed2c 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs @@ -42,6 +42,8 @@ namespace pCampBot { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public string Name { get { return "Teleport"; } } + public void Action(Bot bot) { Random rng = bot.Manager.Rng; diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index c67b3e4..29cb1ba 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; using System.Threading; using OpenMetaverse; @@ -48,7 +49,14 @@ namespace pCampBot { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Command console + /// protected CommandConsole m_console; + + /// + /// Created bots, whether active or inactive. + /// protected List m_lBot; /// @@ -56,6 +64,9 @@ namespace pCampBot /// public Random Rng { get; private set; } + /// + /// Overall configuration. + /// public IConfig Config { get; private set; } /// @@ -140,22 +151,26 @@ namespace pCampBot Array.ForEach( cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); + List behaviours = new List(); + + // Hard-coded for now + if (behaviourSwitches.Contains("p")) + behaviours.Add(new PhysicsBehaviour()); + + if (behaviourSwitches.Contains("g")) + behaviours.Add(new GrabbingBehaviour()); + + if (behaviourSwitches.Contains("t")) + behaviours.Add(new TeleportBehaviour()); + + MainConsole.Instance.OutputFormat( + "[BOT MANAGER]: Bots configured for behaviours {0}", + string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray())); + for (int i = 0; i < botcount; i++) { string lastName = string.Format("{0}_{1}", lastNameStem, i); - List behaviours = new List(); - - // Hard-coded for now - if (behaviourSwitches.Contains("p")) - behaviours.Add(new PhysicsBehaviour()); - - if (behaviourSwitches.Contains("g")) - behaviours.Add(new GrabbingBehaviour()); - - if (behaviourSwitches.Contains("t")) - behaviours.Add(new TeleportBehaviour()); - StartBot(this, behaviours, firstName, lastName, password, loginUri); } } diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs index d4ae0f0..912216f 100644 --- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs @@ -31,6 +31,15 @@ namespace pCampBot.Interfaces { public interface IBehaviour { + /// + /// Name of this behaviour. + /// + string Name { get; } + + /// + /// Action to take when this behaviour is invoked. + /// + /// void Action(Bot bot); } } \ No newline at end of file -- cgit v1.1