From 56d1d67a34bbd3e597168ab9bfa43be6a34e580a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Aug 2013 17:01:12 +0100
Subject: Add pCampbot console commands to sit all bots on ground and stand all
bots
---
OpenSim/Tools/pCampBot/Bot.cs | 24 ++++++++++++
OpenSim/Tools/pCampBot/BotManager.cs | 74 +++++++++++++-----------------------
2 files changed, 51 insertions(+), 47 deletions(-)
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index f7af26e..27c086e 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -318,6 +318,30 @@ namespace pCampBot
}
}
+ ///
+ /// Sit this bot on the ground.
+ ///
+ public void SitOnGround()
+ {
+ if (ConnectionState == ConnectionState.Connected)
+ Client.Self.SitOnGround();
+ }
+
+ ///
+ /// Stand this bot
+ ///
+ public void Stand()
+ {
+ if (ConnectionState == ConnectionState.Connected)
+ {
+ // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled.
+ bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES;
+ Client.Settings.SEND_AGENT_UPDATES = true;
+ Client.Self.Stand();
+ Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting;
+ }
+ }
+
public void SaveDefaultAppearance()
{
saveDir = "MyAppearance/" + FirstName + "_" + LastName;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index f40a84d..f5b5256 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -195,14 +195,18 @@ namespace pCampBot
HandleDisconnect);
m_console.Commands.AddCommand(
- "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
+ "bot", false, "sit", "sit", "Sit all bots on the ground.",
+ HandleSit);
+
+ m_console.Commands.AddCommand(
+ "bot", false, "stand", "stand", "Stand all bots.",
+ HandleStand);
m_console.Commands.AddCommand(
- "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus);
+ "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
-// m_console.Commands.AddCommand("bot", false, "add bots",
-// "add bots ",
-// "Add more bots", HandleAddBots);
+ m_console.Commands.AddCommand(
+ "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_bots = new List();
}
@@ -340,26 +344,6 @@ namespace pCampBot
return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z);
}
-// ///
-// /// Add additional bots (and threads) to our bot pool
-// ///
-// /// How Many of them to add
-// public void addbots(int botcount)
-// {
-// int len = m_td.Length;
-// Thread[] m_td2 = new Thread[len + botcount];
-// for (int i = 0; i < len; i++)
-// {
-// m_td2[i] = m_td[i];
-// }
-// m_td = m_td2;
-// int newlen = len + botcount;
-// for (int i = len; i < newlen; i++)
-// {
-// startupBot(Config);
-// }
-// }
-
///
/// This creates a bot but does not start it.
///
@@ -496,6 +480,22 @@ namespace pCampBot
}
}
+ private void HandleSit(string module, string[] cmd)
+ {
+ lock (m_bots)
+ {
+ m_bots.ForEach(b => b.SitOnGround());
+ }
+ }
+
+ private void HandleStand(string module, string[] cmd)
+ {
+ lock (m_bots)
+ {
+ m_bots.ForEach(b => b.Stand());
+ }
+ }
+
private void HandleShutdown(string module, string[] cmd)
{
lock (m_bots)
@@ -529,7 +529,7 @@ namespace pCampBot
}
}
- private void HandleShowStatus(string module, string[] cmd)
+ private void HandleShowBotsStatus(string module, string[] cmd)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Name", 30);
@@ -563,26 +563,6 @@ namespace pCampBot
MainConsole.Instance.Output(cdl.ToString());
}
- /*
- private void HandleQuit(string module, string[] cmd)
- {
- m_console.Warn("DANGER", "This should only be used to quit the program if you've already used the shutdown command and the program hasn't quit");
- Environment.Exit(0);
- }
- */
-//
-// private void HandleAddBots(string module, string[] cmd)
-// {
-// int newbots = 0;
-//
-// if (cmd.Length > 2)
-// {
-// Int32.TryParse(cmd[2], out newbots);
-// }
-// if (newbots > 0)
-// addbots(newbots);
-// }
-
internal void Grid_GridRegion(object o, GridRegionEventArgs args)
{
lock (RegionsKnown)
@@ -602,4 +582,4 @@ namespace pCampBot
}
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1