From 6570f5dcfedf076dea51613fff6a19febf1c8ff4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 3 Sep 2013 17:07:57 +0100
Subject: Show behaviours of pCampbot bots in "show bots" and "show bot"
 console commands

---
 .../Tools/pCampBot/Behaviours/AbstractBehaviour.cs |  5 +++++
 .../Tools/pCampBot/Behaviours/CrossBehaviour.cs    |  6 +++++-
 .../Tools/pCampBot/Behaviours/GrabbingBehaviour.cs |  6 +++++-
 OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs |  6 +++++-
 .../Tools/pCampBot/Behaviours/PhysicsBehaviour.cs  |  1 +
 .../Tools/pCampBot/Behaviours/TeleportBehaviour.cs |  6 +++++-
 OpenSim/Tools/pCampBot/BotManager.cs               | 22 ++++++++++++++--------
 OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs    |  5 +++++
 8 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
index 9a9371d..66d5542 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -35,6 +35,11 @@ namespace pCampBot
 {
     public class AbstractBehaviour : IBehaviour
     {
+        /// <summary>
+        /// Abbreviated name of this behaviour. 
+        /// </summary>
+        public string AbbreviatedName { get; protected set; }
+
         public string Name { get; protected set; }
 
         public Bot Bot { get; protected set; }
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
index 1e01c64..4d806fc 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
@@ -47,7 +47,11 @@ namespace pCampBot
 
         public const int m_regionCrossingTimeout = 1000 * 60;
 
-        public CrossBehaviour() { Name = "Cross"; }
+        public CrossBehaviour() 
+        { 
+            AbbreviatedName = "c";
+            Name = "Cross"; 
+        }
 
         public override void Action()
         {
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 66a336a..6acc27d 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -41,7 +41,11 @@ namespace pCampBot
     /// </remarks>
     public class GrabbingBehaviour : AbstractBehaviour
     {
-        public GrabbingBehaviour() { Name = "Grabbing"; }
+        public GrabbingBehaviour() 
+        { 
+            AbbreviatedName = "g";
+            Name = "Grabbing"; 
+        }
 
         public override void Action()
         {
diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
index 9cf8a54..9a3075c 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
@@ -38,6 +38,10 @@ namespace pCampBot
     /// </summary>
     public class NoneBehaviour : AbstractBehaviour
     {
-        public NoneBehaviour() { Name = "None"; }
+        public NoneBehaviour() 
+        { 
+            AbbreviatedName = "n";
+            Name = "None"; 
+        }
     }
 }
\ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index daa7485..47b4d46 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -46,6 +46,7 @@ namespace pCampBot
 
         public PhysicsBehaviour()
         {
+            AbbreviatedName = "p";
             Name = "Physics";
             talkarray = readexcuses();
         }
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index fbb4e96..5f7edda 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -42,7 +42,11 @@ namespace pCampBot
     {
         private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
-        public TeleportBehaviour() { Name = "Teleport"; }
+        public TeleportBehaviour() 
+        {
+            AbbreviatedName = "t";
+            Name = "Teleport"; 
+        }
 
         public override void Action()
         {
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 5c3835b..35a24d1 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -572,10 +572,11 @@ namespace pCampBot
         private void HandleShowBotsStatus(string module, string[] cmd)
         {
             ConsoleDisplayTable cdt = new ConsoleDisplayTable();
-            cdt.AddColumn("Name", 30);
-            cdt.AddColumn("Region", 30);
-            cdt.AddColumn("Status", 14);
-            cdt.AddColumn("Connections", 11);
+            cdt.AddColumn("Name", 24);
+            cdt.AddColumn("Region", 24);
+            cdt.AddColumn("Status", 13);
+            cdt.AddColumn("Conns", 5);
+            cdt.AddColumn("Behaviours", 20);
 
             Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>();
             foreach (object o in Enum.GetValues(typeof(ConnectionState)))
@@ -583,13 +584,17 @@ namespace pCampBot
 
             lock (m_bots)
             {
-                foreach (Bot pb in m_bots)
+                foreach (Bot bot in m_bots)
                 {
-                    Simulator currentSim = pb.Client.Network.CurrentSim;
-                    totals[pb.ConnectionState]++;
+                    Simulator currentSim = bot.Client.Network.CurrentSim;
+                    totals[bot.ConnectionState]++;
 
                     cdt.AddRow(
-                        pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.SimulatorsCount);
+                        bot.Name, 
+                        currentSim != null ? currentSim.Name : "(none)", 
+                        bot.ConnectionState, 
+                        bot.SimulatorsCount, 
+                        string.Join(",", bot.Behaviours.ConvertAll<string>(behaviour => behaviour.AbbreviatedName)));
                 }
             }
 
@@ -645,6 +650,7 @@ namespace pCampBot
             MainConsole.Instance.Output("Settings");
 
             ConsoleDisplayList statusCdl = new ConsoleDisplayList();
+            statusCdl.AddRow("Behaviours", string.Join(", ", bot.Behaviours.ConvertAll<string>(b => b.Name)));
             GridClient botClient = bot.Client;
             statusCdl.AddRow("SEND_AGENT_UPDATES", botClient.Settings.SEND_AGENT_UPDATES);
 
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index 9c984be..f8a661b 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -32,6 +32,11 @@ namespace pCampBot.Interfaces
     public interface IBehaviour
     {
         /// <summary>
+        /// Abbreviated name of this behaviour. 
+        /// </summary>
+        string AbbreviatedName { get; }
+
+        /// <summary>
         /// Name of this behaviour.
         /// </summary>
         string Name { get; }
-- 
cgit v1.1