From 51c7fb1969f4850750de4b37827e5e2e9d85f3e0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Aug 2013 23:11:05 +0100 Subject: [PATCH] Add "set bots" command to make it possible to set SEND_AGENT_UPDATES on all bots whilst pCampbot is running --- OpenSim/Tools/pCampBot/BotManager.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 245c460644..c335a6e98e 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -202,6 +202,9 @@ namespace pCampBot "bot", false, "stand", "stand", "Stand all bots.", HandleStand); + m_console.Commands.AddCommand( + "bot", false, "set bots", "set bots ", "Set a setting for all bots.", HandleSetBots); + m_console.Commands.AddCommand( "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); @@ -519,6 +522,30 @@ namespace pCampBot Environment.Exit(0); } + private void HandleSetBots(string module, string[] cmd) + { + string key = cmd[2]; + string rawValue = cmd[3]; + + if (key == "SEND_AGENT_UPDATES") + { + bool newSendAgentUpdatesSetting; + + if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newSendAgentUpdatesSetting)) + return; + + MainConsole.Instance.OutputFormat( + "Setting SEND_AGENT_UPDATES to {0} for all bots", newSendAgentUpdatesSetting); + + lock (m_bots) + m_bots.ForEach(b => b.Client.Settings.SEND_AGENT_UPDATES = newSendAgentUpdatesSetting); + } + else + { + MainConsole.Instance.Output("Error: Only setting currently available is SEND_AGENT_UPDATES"); + } + } + private void HandleShowRegions(string module, string[] cmd) { string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";