diff options
author | Justin Clark-Casey (justincc) | 2013-08-13 23:54:50 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-08-13 23:54:50 +0100 |
commit | 5933f9448d839b9f6db391dedc493bb5cc951d66 (patch) | |
tree | 158049869953786cdf7741e52444380dbce6da89 /OpenSim/Tools/pCampBot/BotManager.cs | |
parent | minor: Eliminate one of the duplicate 'have's in the HG message telling the u... (diff) | |
download | opensim-SC_OLD-5933f9448d839b9f6db391dedc493bb5cc951d66.zip opensim-SC_OLD-5933f9448d839b9f6db391dedc493bb5cc951d66.tar.gz opensim-SC_OLD-5933f9448d839b9f6db391dedc493bb5cc951d66.tar.bz2 opensim-SC_OLD-5933f9448d839b9f6db391dedc493bb5cc951d66.tar.xz |
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
Diffstat (limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 35 |
1 files changed, 20 insertions, 15 deletions
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 | |||
63 | protected CommandConsole m_console; | 63 | protected CommandConsole m_console; |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Controls whether bots start out sending agent updates on connection. | ||
67 | /// </summary> | ||
68 | public bool BotsInitSendAgentUpdates { get; set; } | ||
69 | |||
70 | /// <summary> | ||
66 | /// Created bots, whether active or inactive. | 71 | /// Created bots, whether active or inactive. |
67 | /// </summary> | 72 | /// </summary> |
68 | protected List<Bot> m_lBot; | 73 | protected List<Bot> m_lBot; |
@@ -73,11 +78,6 @@ namespace pCampBot | |||
73 | public Random Rng { get; private set; } | 78 | public Random Rng { get; private set; } |
74 | 79 | ||
75 | /// <summary> | 80 | /// <summary> |
76 | /// Overall configuration. | ||
77 | /// </summary> | ||
78 | public IConfig Config { get; private set; } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Track the assets we have and have not received so we don't endlessly repeat requests. | 81 | /// Track the assets we have and have not received so we don't endlessly repeat requests. |
82 | /// </summary> | 82 | /// </summary> |
83 | public Dictionary<UUID, bool> AssetsReceived { get; private set; } | 83 | public Dictionary<UUID, bool> AssetsReceived { get; private set; } |
@@ -92,6 +92,8 @@ namespace pCampBot | |||
92 | /// </summary> | 92 | /// </summary> |
93 | public BotManager() | 93 | public BotManager() |
94 | { | 94 | { |
95 | BotsInitSendAgentUpdates = true; | ||
96 | |||
95 | LoginDelay = DefaultLoginDelay; | 97 | LoginDelay = DefaultLoginDelay; |
96 | 98 | ||
97 | Rng = new Random(Environment.TickCount); | 99 | Rng = new Random(Environment.TickCount); |
@@ -148,18 +150,17 @@ namespace pCampBot | |||
148 | /// </summary> | 150 | /// </summary> |
149 | /// <param name="botcount">How many bots to start up</param> | 151 | /// <param name="botcount">How many bots to start up</param> |
150 | /// <param name="cs">The configuration for the bots to use</param> | 152 | /// <param name="cs">The configuration for the bots to use</param> |
151 | public void dobotStartup(int botcount, IConfig cs) | 153 | public void dobotStartup(int botcount, IConfig startupConfig) |
152 | { | 154 | { |
153 | Config = cs; | 155 | string firstName = startupConfig.GetString("firstname"); |
154 | 156 | string lastNameStem = startupConfig.GetString("lastname"); | |
155 | string firstName = cs.GetString("firstname"); | 157 | string password = startupConfig.GetString("password"); |
156 | string lastNameStem = cs.GetString("lastname"); | 158 | string loginUri = startupConfig.GetString("loginuri"); |
157 | string password = cs.GetString("password"); | 159 | string wearSetting = startupConfig.GetString("wear", "no"); |
158 | string loginUri = cs.GetString("loginuri"); | ||
159 | 160 | ||
160 | HashSet<string> behaviourSwitches = new HashSet<string>(); | 161 | HashSet<string> behaviourSwitches = new HashSet<string>(); |
161 | Array.ForEach<string>( | 162 | Array.ForEach<string>( |
162 | cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); | 163 | startupConfig.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); |
163 | 164 | ||
164 | MainConsole.Instance.OutputFormat( | 165 | MainConsole.Instance.OutputFormat( |
165 | "[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_<n>", | 166 | "[BOT MANAGER]: Starting {0} bots connecting to {1}, named {2} {3}_<n>", |
@@ -169,6 +170,7 @@ namespace pCampBot | |||
169 | lastNameStem); | 170 | lastNameStem); |
170 | 171 | ||
171 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay); | 172 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: Delay between logins is {0}ms", LoginDelay); |
173 | MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", BotsInitSendAgentUpdates); | ||
172 | 174 | ||
173 | for (int i = 0; i < botcount; i++) | 175 | for (int i = 0; i < botcount; i++) |
174 | { | 176 | { |
@@ -193,7 +195,7 @@ namespace pCampBot | |||
193 | if (behaviourSwitches.Contains("t")) | 195 | if (behaviourSwitches.Contains("t")) |
194 | behaviours.Add(new TeleportBehaviour()); | 196 | behaviours.Add(new TeleportBehaviour()); |
195 | 197 | ||
196 | StartBot(this, behaviours, firstName, lastName, password, loginUri); | 198 | StartBot(this, behaviours, firstName, lastName, password, loginUri, wearSetting); |
197 | } | 199 | } |
198 | } | 200 | } |
199 | 201 | ||
@@ -226,15 +228,18 @@ namespace pCampBot | |||
226 | /// <param name="lastName">Last name</param> | 228 | /// <param name="lastName">Last name</param> |
227 | /// <param name="password">Password</param> | 229 | /// <param name="password">Password</param> |
228 | /// <param name="loginUri">Login URI</param> | 230 | /// <param name="loginUri">Login URI</param> |
231 | /// <param name="wearSetting"></param> | ||
229 | public void StartBot( | 232 | public void StartBot( |
230 | BotManager bm, List<IBehaviour> behaviours, | 233 | BotManager bm, List<IBehaviour> behaviours, |
231 | string firstName, string lastName, string password, string loginUri) | 234 | string firstName, string lastName, string password, string loginUri, string wearSetting) |
232 | { | 235 | { |
233 | MainConsole.Instance.OutputFormat( | 236 | MainConsole.Instance.OutputFormat( |
234 | "[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}", | 237 | "[BOT MANAGER]: Starting bot {0} {1}, behaviours are {2}", |
235 | firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray())); | 238 | firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray())); |
236 | 239 | ||
237 | Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri); | 240 | Bot pb = new Bot(bm, behaviours, firstName, lastName, password, loginUri); |
241 | pb.wear = wearSetting; | ||
242 | pb.Client.Settings.SEND_AGENT_UPDATES = BotsInitSendAgentUpdates; | ||
238 | 243 | ||
239 | pb.OnConnected += handlebotEvent; | 244 | pb.OnConnected += handlebotEvent; |
240 | pb.OnDisconnected += handlebotEvent; | 245 | pb.OnDisconnected += handlebotEvent; |