From 5933f9448d839b9f6db391dedc493bb5cc951d66 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 13 Aug 2013 23:54:50 +0100
Subject: Add a SendAgentUpdates setting to a new pCampbot.ini.example file
which can control whether bots send agent updates
pCampbot.ini.example is used by copying to pCampbot.ini, like other ini files
---
OpenSim/Tools/pCampBot/BotManager.cs | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 74bd36a..16b02b9 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -63,6 +63,11 @@ namespace pCampBot
protected CommandConsole m_console;
///
+ /// Controls whether bots start out sending agent updates on connection.
+ ///
+ public bool BotsInitSendAgentUpdates { get; set; }
+
+ ///
/// Created bots, whether active or inactive.
///
protected List m_lBot;
@@ -73,11 +78,6 @@ namespace pCampBot
public Random Rng { get; private set; }
///
- /// Overall configuration.
- ///
- public IConfig Config { get; private set; }
-
- ///
/// Track the assets we have and have not received so we don't endlessly repeat requests.
///
public Dictionary AssetsReceived { get; private set; }
@@ -92,6 +92,8 @@ namespace pCampBot
///
public BotManager()
{
+ BotsInitSendAgentUpdates = true;
+
LoginDelay = DefaultLoginDelay;
Rng = new Random(Environment.TickCount);
@@ -148,18 +150,17 @@ namespace pCampBot
///
/// How many bots to start up
/// The configuration for the bots to use
- public void dobotStartup(int botcount, IConfig cs)
+ public void dobotStartup(int botcount, IConfig startupConfig)
{
- Config = cs;
-
- string firstName = cs.GetString("firstname");
- string lastNameStem = cs.GetString("lastname");
- string password = cs.GetString("password");
- string loginUri = cs.GetString("loginuri");
+ string firstName = startupConfig.GetString("firstname");
+ string lastNameStem = startupConfig.GetString("lastname");
+ string password = startupConfig.GetString("password");
+ string loginUri = startupConfig.GetString("loginuri");
+ string wearSetting = startupConfig.GetString("wear", "no");
HashSet behaviourSwitches = new HashSet();
Array.ForEach(
- cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
+ startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_",
@@ -169,6 +170,7 @@ namespace pCampBot
lastNameStem);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay);
+ MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", BotsInitSendAgentUpdates);
for (int i = 0; i < botcount; i++)
{
@@ -193,7 +195,7 @@ namespace pCampBot
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
- StartBot(this, behaviours, firstName, lastName, password, loginUri);
+ StartBot(this, behaviours, firstName, lastName, password, loginUri, wearSetting);
}
}
@@ -226,15 +228,18 @@ namespace pCampBot
/// Last name
/// Password
/// Login URI
+ ///
public void StartBot(
BotManager bm, List behaviours,
- string firstName, string lastName, string password, string loginUri)
+ string firstName, string lastName, string password, string loginUri, string wearSetting)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll(b => b.Name).ToArray()));
Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri);
+ pb.wear = wearSetting;
+ pb.Client.Settings.SEND_AGENT_UPDATES = BotsInitSendAgentUpdates;
pb.OnConnected += handlebotEvent;
pb.OnDisconnected += handlebotEvent;
--
cgit v1.1