diff options
author | Justin Clark-Casey (justincc) | 2011-11-09 21:22:54 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-09 21:23:23 +0000 |
commit | bbab7b6b4d1053d62037e7e05c37f9cb607db4da (patch) | |
tree | 8eab60f2f01db5651832279310440b76f376df09 /OpenSim/Tools/pCampBot | |
parent | In pCampBot, don't try and pull down Primitive faces or sculpts set to null (diff) | |
download | opensim-SC_OLD-bbab7b6b4d1053d62037e7e05c37f9cb607db4da.zip opensim-SC_OLD-bbab7b6b4d1053d62037e7e05c37f9cb607db4da.tar.gz opensim-SC_OLD-bbab7b6b4d1053d62037e7e05c37f9cb607db4da.tar.bz2 opensim-SC_OLD-bbab7b6b4d1053d62037e7e05c37f9cb607db4da.tar.xz |
Use IsConnected status to determine whether all pCampBots have disconnected, rather than maintaining a separate count
Checking IsConnected is more reliable.
Diffstat (limited to 'OpenSim/Tools/pCampBot')
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 22 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 16 |
2 files changed, 22 insertions, 16 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index 669c99b..7f941a4 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -222,7 +222,7 @@ namespace pCampBot | |||
222 | } | 222 | } |
223 | else | 223 | else |
224 | { | 224 | { |
225 | MainConsole.Instance.OutputFormat( | 225 | m_log.ErrorFormat( |
226 | "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage); | 226 | "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage); |
227 | 227 | ||
228 | if (OnDisconnected != null) | 228 | if (OnDisconnected != null) |
@@ -266,12 +266,12 @@ namespace pCampBot | |||
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | MainConsole.Instance.Output(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID)); | 269 | m_log.WarnFormat("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | catch (Exception e) | 272 | catch (Exception e) |
273 | { | 273 | { |
274 | MainConsole.Instance.Output(String.Format("Exception: {0}",e.ToString())); | 274 | m_log.ErrorFormat("Exception: {0}{1}", e.Message, e.StackTrace); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
@@ -305,7 +305,7 @@ namespace pCampBot | |||
305 | if (wear == "yes") | 305 | if (wear == "yes") |
306 | { | 306 | { |
307 | //TODO: Implement random outfit picking | 307 | //TODO: Implement random outfit picking |
308 | MainConsole.Instance.Output("Picks a random outfit. Not yet implemented."); | 308 | m_log.DebugFormat("Picks a random outfit. Not yet implemented."); |
309 | } | 309 | } |
310 | else if (wear != "save") | 310 | else if (wear != "save") |
311 | saveDir = "MyAppearance/" + wear; | 311 | saveDir = "MyAppearance/" + wear; |
@@ -334,7 +334,9 @@ namespace pCampBot | |||
334 | listwearables.Add(item); | 334 | listwearables.Add(item); |
335 | } | 335 | } |
336 | else | 336 | else |
337 | MainConsole.Instance.Output(String.Format("Failed to create item {0}",item.Name)); | 337 | { |
338 | m_log.WarnFormat("Failed to create item {0}", item.Name); | ||
339 | } | ||
338 | } | 340 | } |
339 | ); | 341 | ); |
340 | } | 342 | } |
@@ -356,7 +358,9 @@ namespace pCampBot | |||
356 | listwearables.Add(item); | 358 | listwearables.Add(item); |
357 | } | 359 | } |
358 | else | 360 | else |
359 | MainConsole.Instance.Output(String.Format("Failed to create item {0}",item.Name)); | 361 | { |
362 | m_log.WarnFormat("Failed to create item {0}", item.Name); | ||
363 | } | ||
360 | } | 364 | } |
361 | ); | 365 | ); |
362 | } | 366 | } |
@@ -364,10 +368,12 @@ namespace pCampBot | |||
364 | Thread.Sleep(1000); | 368 | Thread.Sleep(1000); |
365 | 369 | ||
366 | if (listwearables == null || listwearables.Count == 0) | 370 | if (listwearables == null || listwearables.Count == 0) |
367 | MainConsole.Instance.Output("Nothing to send on this folder!"); | 371 | { |
372 | m_log.DebugFormat("Nothing to send on this folder!"); | ||
373 | } | ||
368 | else | 374 | else |
369 | { | 375 | { |
370 | MainConsole.Instance.Output(String.Format("Sending {0} wearables...",listwearables.Count)); | 376 | m_log.DebugFormat("Sending {0} wearables...", listwearables.Count); |
371 | Client.Appearance.WearOutfit(listwearables, false); | 377 | Client.Appearance.WearOutfit(listwearables, false); |
372 | } | 378 | } |
373 | } | 379 | } |
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 704770a..c4c6f8f 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -51,7 +51,6 @@ namespace pCampBot | |||
51 | protected CommandConsole m_console; | 51 | protected CommandConsole m_console; |
52 | protected List<Bot> m_lBot; | 52 | protected List<Bot> m_lBot; |
53 | protected Random somthing = new Random(Environment.TickCount); | 53 | protected Random somthing = new Random(Environment.TickCount); |
54 | protected int numbots = 0; | ||
55 | public IConfig Config { get; private set; } | 54 | public IConfig Config { get; private set; } |
56 | 55 | ||
57 | /// <summary> | 56 | /// <summary> |
@@ -200,16 +199,17 @@ namespace pCampBot | |||
200 | { | 199 | { |
201 | case EventType.CONNECTED: | 200 | case EventType.CONNECTED: |
202 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); | 201 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected"); |
203 | numbots++; | ||
204 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | ||
205 | break; | 202 | break; |
206 | case EventType.DISCONNECTED: | 203 | case EventType.DISCONNECTED: |
207 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); | 204 | m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected"); |
208 | numbots--; | 205 | |
209 | // m_log.InfoFormat("NUMBOTS {0}", numbots); | 206 | lock (m_lBot) |
210 | if (numbots <= 0) | 207 | { |
211 | Environment.Exit(0); | 208 | if (m_lBot.TrueForAll(b => !b.IsConnected)) |
212 | break; | 209 | Environment.Exit(0); |
210 | |||
211 | break; | ||
212 | } | ||
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||