Add "set bots" command to make it possible to set SEND_AGENT_UPDATES on all bots whilst pCampbot is running
parent
beb9d966f9
commit
51c7fb1969
|
@ -202,6 +202,9 @@ namespace pCampBot
|
||||||
"bot", false, "stand", "stand", "Stand all bots.",
|
"bot", false, "stand", "stand", "Stand all bots.",
|
||||||
HandleStand);
|
HandleStand);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);
|
||||||
|
|
||||||
m_console.Commands.AddCommand(
|
m_console.Commands.AddCommand(
|
||||||
"bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
|
"bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
|
||||||
|
|
||||||
|
@ -519,6 +522,30 @@ namespace pCampBot
|
||||||
Environment.Exit(0);
|
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)
|
private void HandleShowRegions(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
|
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
|
||||||
|
|
Loading…
Reference in New Issue