diff options
author | Justin Clark-Casey (justincc) | 2013-08-20 17:01:12 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-08-20 17:01:12 +0100 |
commit | 56d1d67a34bbd3e597168ab9bfa43be6a34e580a (patch) | |
tree | 562550df47b06c416679cfc286f2f3809fc152b5 /OpenSim/Tools/pCampBot | |
parent | Add -connect (-c) switch to pCampbot command line options. (diff) | |
download | opensim-SC_OLD-56d1d67a34bbd3e597168ab9bfa43be6a34e580a.zip opensim-SC_OLD-56d1d67a34bbd3e597168ab9bfa43be6a34e580a.tar.gz opensim-SC_OLD-56d1d67a34bbd3e597168ab9bfa43be6a34e580a.tar.bz2 opensim-SC_OLD-56d1d67a34bbd3e597168ab9bfa43be6a34e580a.tar.xz |
Add pCampbot console commands to sit all bots on ground and stand all bots
Diffstat (limited to 'OpenSim/Tools/pCampBot')
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 24 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 74 |
2 files changed, 51 insertions, 47 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index f7af26e..27c086e 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs | |||
@@ -318,6 +318,30 @@ namespace pCampBot | |||
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | /// <summary> | ||
322 | /// Sit this bot on the ground. | ||
323 | /// </summary> | ||
324 | public void SitOnGround() | ||
325 | { | ||
326 | if (ConnectionState == ConnectionState.Connected) | ||
327 | Client.Self.SitOnGround(); | ||
328 | } | ||
329 | |||
330 | /// <summary> | ||
331 | /// Stand this bot | ||
332 | /// </summary> | ||
333 | public void Stand() | ||
334 | { | ||
335 | if (ConnectionState == ConnectionState.Connected) | ||
336 | { | ||
337 | // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled. | ||
338 | bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES; | ||
339 | Client.Settings.SEND_AGENT_UPDATES = true; | ||
340 | Client.Self.Stand(); | ||
341 | Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting; | ||
342 | } | ||
343 | } | ||
344 | |||
321 | public void SaveDefaultAppearance() | 345 | public void SaveDefaultAppearance() |
322 | { | 346 | { |
323 | saveDir = "MyAppearance/" + FirstName + "_" + LastName; | 347 | saveDir = "MyAppearance/" + FirstName + "_" + LastName; |
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index f40a84d..f5b5256 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -195,14 +195,18 @@ namespace pCampBot | |||
195 | HandleDisconnect); | 195 | HandleDisconnect); |
196 | 196 | ||
197 | m_console.Commands.AddCommand( | 197 | m_console.Commands.AddCommand( |
198 | "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); | 198 | "bot", false, "sit", "sit", "Sit all bots on the ground.", |
199 | HandleSit); | ||
200 | |||
201 | m_console.Commands.AddCommand( | ||
202 | "bot", false, "stand", "stand", "Stand all bots.", | ||
203 | HandleStand); | ||
199 | 204 | ||
200 | m_console.Commands.AddCommand( | 205 | m_console.Commands.AddCommand( |
201 | "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowStatus); | 206 | "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); |
202 | 207 | ||
203 | // m_console.Commands.AddCommand("bot", false, "add bots", | 208 | m_console.Commands.AddCommand( |
204 | // "add bots <number>", | 209 | "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); |
205 | // "Add more bots", HandleAddBots); | ||
206 | 210 | ||
207 | m_bots = new List<Bot>(); | 211 | m_bots = new List<Bot>(); |
208 | } | 212 | } |
@@ -340,26 +344,6 @@ namespace pCampBot | |||
340 | return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z); | 344 | return string.Format("uri:{0}&{1}&{2}&{3}", regionName, startPos.X, startPos.Y, startPos.Z); |
341 | } | 345 | } |
342 | 346 | ||
343 | // /// <summary> | ||
344 | // /// Add additional bots (and threads) to our bot pool | ||
345 | // /// </summary> | ||
346 | // /// <param name="botcount">How Many of them to add</param> | ||
347 | // public void addbots(int botcount) | ||
348 | // { | ||
349 | // int len = m_td.Length; | ||
350 | // Thread[] m_td2 = new Thread[len + botcount]; | ||
351 | // for (int i = 0; i < len; i++) | ||
352 | // { | ||
353 | // m_td2[i] = m_td[i]; | ||
354 | // } | ||
355 | // m_td = m_td2; | ||
356 | // int newlen = len + botcount; | ||
357 | // for (int i = len; i < newlen; i++) | ||
358 | // { | ||
359 | // startupBot(Config); | ||
360 | // } | ||
361 | // } | ||
362 | |||
363 | /// <summary> | 347 | /// <summary> |
364 | /// This creates a bot but does not start it. | 348 | /// This creates a bot but does not start it. |
365 | /// </summary> | 349 | /// </summary> |
@@ -496,6 +480,22 @@ namespace pCampBot | |||
496 | } | 480 | } |
497 | } | 481 | } |
498 | 482 | ||
483 | private void HandleSit(string module, string[] cmd) | ||
484 | { | ||
485 | lock (m_bots) | ||
486 | { | ||
487 | m_bots.ForEach(b => b.SitOnGround()); | ||
488 | } | ||
489 | } | ||
490 | |||
491 | private void HandleStand(string module, string[] cmd) | ||
492 | { | ||
493 | lock (m_bots) | ||
494 | { | ||
495 | m_bots.ForEach(b => b.Stand()); | ||
496 | } | ||
497 | } | ||
498 | |||
499 | private void HandleShutdown(string module, string[] cmd) | 499 | private void HandleShutdown(string module, string[] cmd) |
500 | { | 500 | { |
501 | lock (m_bots) | 501 | lock (m_bots) |
@@ -529,7 +529,7 @@ namespace pCampBot | |||
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | private void HandleShowStatus(string module, string[] cmd) | 532 | private void HandleShowBotsStatus(string module, string[] cmd) |
533 | { | 533 | { |
534 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | 534 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); |
535 | cdt.AddColumn("Name", 30); | 535 | cdt.AddColumn("Name", 30); |
@@ -563,26 +563,6 @@ namespace pCampBot | |||
563 | MainConsole.Instance.Output(cdl.ToString()); | 563 | MainConsole.Instance.Output(cdl.ToString()); |
564 | } | 564 | } |
565 | 565 | ||
566 | /* | ||
567 | private void HandleQuit(string module, string[] cmd) | ||
568 | { | ||
569 | 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"); | ||
570 | Environment.Exit(0); | ||
571 | } | ||
572 | */ | ||
573 | // | ||
574 | // private void HandleAddBots(string module, string[] cmd) | ||
575 | // { | ||
576 | // int newbots = 0; | ||
577 | // | ||
578 | // if (cmd.Length > 2) | ||
579 | // { | ||
580 | // Int32.TryParse(cmd[2], out newbots); | ||
581 | // } | ||
582 | // if (newbots > 0) | ||
583 | // addbots(newbots); | ||
584 | // } | ||
585 | |||
586 | internal void Grid_GridRegion(object o, GridRegionEventArgs args) | 566 | internal void Grid_GridRegion(object o, GridRegionEventArgs args) |
587 | { | 567 | { |
588 | lock (RegionsKnown) | 568 | lock (RegionsKnown) |
@@ -602,4 +582,4 @@ namespace pCampBot | |||
602 | } | 582 | } |
603 | } | 583 | } |
604 | } | 584 | } |
605 | } | 585 | } \ No newline at end of file |