Stop pCampbot from firing connected event twice, which results in double counting.

remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-31 21:33:25 +00:00
parent a9a24062a5
commit e3f51df3c2
2 changed files with 11 additions and 10 deletions

View File

@ -81,16 +81,16 @@ namespace pCampBot
m_console.Commands.AddCommand("bot", false, "shutdown", m_console.Commands.AddCommand("bot", false, "shutdown",
"shutdown", "shutdown",
"Gracefully shut down bots", HandleShutdown); "Shutdown bots and exit", HandleShutdown);
m_console.Commands.AddCommand("bot", false, "quit", m_console.Commands.AddCommand("bot", false, "quit",
"quit", "quit",
"Force quit (DANGEROUS, try shutdown first)", "Shutdown bots and exit",
HandleShutdown); HandleShutdown);
m_console.Commands.AddCommand("bot", false, "add bots", // m_console.Commands.AddCommand("bot", false, "add bots",
"add bots <number>", // "add bots <number>",
"Add more bots", HandleAddBots); // "Add more bots", HandleAddBots);
m_lBot = new List<PhysicsBot>(); m_lBot = new List<PhysicsBot>();
} }
@ -177,14 +177,14 @@ namespace pCampBot
switch (eventt) switch (eventt)
{ {
case EventType.CONNECTED: case EventType.CONNECTED:
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected"); m_log.Info("[" + callbot.firstname + " " + callbot.lastname + "]: Connected");
numbots++; numbots++;
break; break;
case EventType.DISCONNECTED: case EventType.DISCONNECTED:
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected"); m_log.Info("[" + callbot.firstname + " " + callbot.lastname + "]: Disconnected");
m_td[m_lBot.IndexOf(callbot)].Abort(); m_td[m_lBot.IndexOf(callbot)].Abort();
numbots--; numbots--;
if (numbots >1) if (numbots <= 0)
Environment.Exit(0); Environment.Exit(0);
break; break;
} }

View File

@ -165,7 +165,7 @@ namespace pCampBot
m_action.AutoReset = false; m_action.AutoReset = false;
m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed); m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
m_action.Start(); m_action.Start();
OnConnected(this, EventType.CONNECTED); // OnConnected(this, EventType.CONNECTED);
if (wear == "save") if (wear == "save")
{ {
client.Appearance.SetPreviousAppearance(); client.Appearance.SetPreviousAppearance();
@ -384,6 +384,7 @@ namespace pCampBot
{ {
client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture); client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
} }
for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
{ {
if (prim.Textures.FaceTextures[i] != null) if (prim.Textures.FaceTextures[i] != null)
@ -392,10 +393,10 @@ namespace pCampBot
{ {
client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture); client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
} }
} }
} }
} }
if (prim.Sculpt.SculptTexture != UUID.Zero) if (prim.Sculpt.SculptTexture != UUID.Zero)
{ {
client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture); client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);