aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-23 22:18:10 +0000
committerJustin Clark-Casey (justincc)2011-11-23 22:18:10 +0000
commited7ddeecf2df370638feb0a83b70a0883a711650 (patch)
treee78197fbb3d13cc0f290fe6f1fa6db192048db46 /OpenSim
parentAdd teleport behaviour to pCampBot (diff)
downloadopensim-SC_OLD-ed7ddeecf2df370638feb0a83b70a0883a711650.zip
opensim-SC_OLD-ed7ddeecf2df370638feb0a83b70a0883a711650.tar.gz
opensim-SC_OLD-ed7ddeecf2df370638feb0a83b70a0883a711650.tar.bz2
opensim-SC_OLD-ed7ddeecf2df370638feb0a83b70a0883a711650.tar.xz
Print out what behaviours are active when pCampBot starts up
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs2
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs2
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs2
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs39
-rw-r--r--OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs9
5 files changed, 42 insertions, 12 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 7084ab4..0a6d5d2 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -41,6 +41,8 @@ namespace pCampBot
41 /// </remarks> 41 /// </remarks>
42 public class GrabbingBehaviour : IBehaviour 42 public class GrabbingBehaviour : IBehaviour
43 { 43 {
44 public string Name { get { return "Grabbing"; } }
45
44 public void Action(Bot bot) 46 public void Action(Bot bot)
45 { 47 {
46 Dictionary<UUID, Primitive> objects = bot.Objects; 48 Dictionary<UUID, Primitive> objects = bot.Objects;
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index 3ce08bf..f782bb5 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -42,6 +42,8 @@ namespace pCampBot
42 /// </remarks> 42 /// </remarks>
43 public class PhysicsBehaviour : IBehaviour 43 public class PhysicsBehaviour : IBehaviour
44 { 44 {
45 public string Name { get { return "Physics"; } }
46
45 private string[] talkarray; 47 private string[] talkarray;
46 48
47 public PhysicsBehaviour() 49 public PhysicsBehaviour()
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index 4624494..fc2ed2c 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -42,6 +42,8 @@ namespace pCampBot
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 public string Name { get { return "Teleport"; } }
46
45 public void Action(Bot bot) 47 public void Action(Bot bot)
46 { 48 {
47 Random rng = bot.Manager.Rng; 49 Random rng = bot.Manager.Rng;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index c67b3e4..29cb1ba 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Reflection; 31using System.Reflection;
31using System.Threading; 32using System.Threading;
32using OpenMetaverse; 33using OpenMetaverse;
@@ -48,7 +49,14 @@ namespace pCampBot
48 { 49 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 51
52 /// <summary>
53 /// Command console
54 /// </summary>
51 protected CommandConsole m_console; 55 protected CommandConsole m_console;
56
57 /// <summary>
58 /// Created bots, whether active or inactive.
59 /// </summary>
52 protected List<Bot> m_lBot; 60 protected List<Bot> m_lBot;
53 61
54 /// <summary> 62 /// <summary>
@@ -56,6 +64,9 @@ namespace pCampBot
56 /// </summary> 64 /// </summary>
57 public Random Rng { get; private set; } 65 public Random Rng { get; private set; }
58 66
67 /// <summary>
68 /// Overall configuration.
69 /// </summary>
59 public IConfig Config { get; private set; } 70 public IConfig Config { get; private set; }
60 71
61 /// <summary> 72 /// <summary>
@@ -140,22 +151,26 @@ namespace pCampBot
140 Array.ForEach<string>( 151 Array.ForEach<string>(
141 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); 152 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
142 153
154 List<IBehaviour> behaviours = new List<IBehaviour>();
155
156 // Hard-coded for now
157 if (behaviourSwitches.Contains("p"))
158 behaviours.Add(new PhysicsBehaviour());
159
160 if (behaviourSwitches.Contains("g"))
161 behaviours.Add(new GrabbingBehaviour());
162
163 if (behaviourSwitches.Contains("t"))
164 behaviours.Add(new TeleportBehaviour());
165
166 MainConsole.Instance.OutputFormat(
167 "[BOT MANAGER]: Bots configured for behaviours {0}",
168 string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
169
143 for (int i = 0; i < botcount; i++) 170 for (int i = 0; i < botcount; i++)
144 { 171 {
145 string lastName = string.Format("{0}_{1}", lastNameStem, i); 172 string lastName = string.Format("{0}_{1}", lastNameStem, i);
146 173
147 List<IBehaviour> behaviours = new List<IBehaviour>();
148
149 // Hard-coded for now
150 if (behaviourSwitches.Contains("p"))
151 behaviours.Add(new PhysicsBehaviour());
152
153 if (behaviourSwitches.Contains("g"))
154 behaviours.Add(new GrabbingBehaviour());
155
156 if (behaviourSwitches.Contains("t"))
157 behaviours.Add(new TeleportBehaviour());
158
159 StartBot(this, behaviours, firstName, lastName, password, loginUri); 174 StartBot(this, behaviours, firstName, lastName, password, loginUri);
160 } 175 }
161 } 176 }
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index d4ae0f0..912216f 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -31,6 +31,15 @@ namespace pCampBot.Interfaces
31{ 31{
32 public interface IBehaviour 32 public interface IBehaviour
33 { 33 {
34 /// <summary>
35 /// Name of this behaviour.
36 /// </summary>
37 string Name { get; }
38
39 /// <summary>
40 /// Action to take when this behaviour is invoked.
41 /// </summary>
42 /// <param name="bot"></param>
34 void Action(Bot bot); 43 void Action(Bot bot);
35 } 44 }
36} \ No newline at end of file 45} \ No newline at end of file