diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index f7af26e3c8..27c086ed63 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 f40a84d4ad..f5b5256d7b 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -194,15 +194,19 @@ namespace pCampBot + "If no is given, then all currently connected bots are disconnected.", HandleDisconnect); + m_console.Commands.AddCommand( + "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 regions", "show regions", "Show regions known to bots", HandleShowRegions); m_console.Commands.AddCommand( - "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus); - -// m_console.Commands.AddCommand("bot", false, "add bots", -// "add bots ", -// "Add more bots", HandleAddBots); + "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