aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/BotManager.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-01 22:09:21 +0000
committerJustin Clark-Casey (justincc)2011-11-01 22:09:21 +0000
commit8e2e4c47d95728ba25694a85454488074360445e (patch)
tree4415e72430a4f7888ecc61a5b211fc45bc204298 /OpenSim/Tools/pCampBot/BotManager.cs
parentListen only for non SimShutdown Network.Disconnect firing so that we don't qu... (diff)
downloadopensim-SC_OLD-8e2e4c47d95728ba25694a85454488074360445e.zip
opensim-SC_OLD-8e2e4c47d95728ba25694a85454488074360445e.tar.gz
opensim-SC_OLD-8e2e4c47d95728ba25694a85454488074360445e.tar.bz2
opensim-SC_OLD-8e2e4c47d95728ba25694a85454488074360445e.tar.xz
Add "show status" command to pCambot
Diffstat (limited to '')
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs30
1 files changed, 25 insertions, 5 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index d2b7ded..b05bd6d 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -93,6 +93,11 @@ namespace pCampBot
93 "Shutdown bots and exit", 93 "Shutdown bots and exit",
94 HandleShutdown); 94 HandleShutdown);
95 95
96 m_console.Commands.AddCommand("bot", false, "show status",
97 "show status",
98 "Shows the status of all bots",
99 HandleShowStatus);
100
96// m_console.Commands.AddCommand("bot", false, "add bots", 101// m_console.Commands.AddCommand("bot", false, "add bots",
97// "add bots <number>", 102// "add bots <number>",
98// "Add more bots", HandleAddBots); 103// "Add more bots", HandleAddBots);
@@ -157,7 +162,8 @@ namespace pCampBot
157 pb.OnConnected += handlebotEvent; 162 pb.OnConnected += handlebotEvent;
158 pb.OnDisconnected += handlebotEvent; 163 pb.OnDisconnected += handlebotEvent;
159 164
160 m_lBot.Add(pb); 165 lock (m_lBot)
166 m_lBot.Add(pb);
161 167
162 Thread pbThread = new Thread(pb.startup); 168 Thread pbThread = new Thread(pb.startup);
163 pbThread.Name = pb.Name; 169 pbThread.Name = pb.Name;
@@ -194,10 +200,9 @@ namespace pCampBot
194 /// </summary> 200 /// </summary>
195 public void doBotShutdown() 201 public void doBotShutdown()
196 { 202 {
197 foreach (PhysicsBot pb in m_lBot) 203 lock (m_lBot)
198 { 204 foreach (PhysicsBot pb in m_lBot)
199 pb.shutdown(); 205 pb.shutdown();
200 }
201 } 206 }
202 207
203 /// <summary> 208 /// <summary>
@@ -215,6 +220,21 @@ namespace pCampBot
215 doBotShutdown(); 220 doBotShutdown();
216 } 221 }
217 222
223 private void HandleShowStatus(string module, string[] cmd)
224 {
225 string outputFormat = "{0,-30} {1,-14}";
226 MainConsole.Instance.OutputFormat(outputFormat, "Name", "Status");
227
228 lock (m_lBot)
229 {
230 foreach (PhysicsBot pb in m_lBot)
231 {
232 MainConsole.Instance.OutputFormat(
233 outputFormat, pb.Name, (pb.IsConnected ? "Connected" : "Disconnected"));
234 }
235 }
236 }
237
218 /* 238 /*
219 private void HandleQuit(string module, string[] cmd) 239 private void HandleQuit(string module, string[] cmd)
220 { 240 {