aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools')
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs49
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs169
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs16
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs32
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs22
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs6
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs35
-rw-r--r--OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs11
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs26
9 files changed, 299 insertions, 67 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
new file mode 100644
index 0000000..9a9371d
--- /dev/null
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using System;
30using System.Collections.Generic;
31using System.Linq;
32using pCampBot.Interfaces;
33
34namespace pCampBot
35{
36 public class AbstractBehaviour : IBehaviour
37 {
38 public string Name { get; protected set; }
39
40 public Bot Bot { get; protected set; }
41
42 public virtual void Action() {}
43
44 public virtual void Initialize(Bot bot)
45 {
46 Bot = bot;
47 }
48 }
49}
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
new file mode 100644
index 0000000..1e01c64
--- /dev/null
+++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
@@ -0,0 +1,169 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using pCampBot.Interfaces;
36
37namespace pCampBot
38{
39 /// <summary>
40 /// Get the bot to make a region crossing.
41 /// </summary>
42 public class CrossBehaviour : AbstractBehaviour
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 public AutoResetEvent m_regionCrossedMutex = new AutoResetEvent(false);
47
48 public const int m_regionCrossingTimeout = 1000 * 60;
49
50 public CrossBehaviour() { Name = "Cross"; }
51
52 public override void Action()
53 {
54 GridClient client = Bot.Client;
55
56// // Fly to make the border cross easier.
57// client.Self.Movement.Fly = true;
58// client.Self.Movement.Fly = false;
59
60 // Seek out neighbouring region
61 Simulator currentSim = client.Network.CurrentSim;
62 ulong currentHandle = currentSim.Handle;
63 uint currentX, currentY;
64 Utils.LongToUInts(currentHandle, out currentX, out currentY);
65
66 List<GridRegion> candidateRegions = new List<GridRegion>();
67 TryAddRegion(Utils.UIntsToLong(Math.Max(0, currentX - Constants.RegionSize), currentY), candidateRegions); // West
68 TryAddRegion(Utils.UIntsToLong(currentX + Constants.RegionSize, currentY), candidateRegions); // East
69 TryAddRegion(Utils.UIntsToLong(currentX, Math.Max(0, currentY - Constants.RegionSize)), candidateRegions); // South
70 TryAddRegion(Utils.UIntsToLong(currentX, currentY + Constants.RegionSize), candidateRegions); // North
71
72 if (candidateRegions.Count != 0)
73 {
74 GridRegion destRegion = candidateRegions[Bot.Manager.Rng.Next(candidateRegions.Count)];
75
76 uint targetX, targetY;
77 Utils.LongToUInts(destRegion.RegionHandle, out targetX, out targetY);
78
79 Vector3 pos = client.Self.SimPosition;
80 if (targetX < currentX)
81 pos.X = -1;
82 else if (targetX > currentX)
83 pos.X = Constants.RegionSize + 1;
84
85 if (targetY < currentY)
86 pos.Y = -1;
87 else if (targetY > currentY)
88 pos.Y = Constants.RegionSize + 1;
89
90 m_log.DebugFormat(
91 "[CROSS BEHAVIOUR]: {0} moving to cross from {1} into {2}, target {3}",
92 Bot.Name, currentSim.Name, destRegion.Name, pos);
93
94 // Face in the direction of the candidate region
95 client.Self.Movement.TurnToward(pos);
96
97 // Listen for event so that we know when we've crossed the region boundary
98 Bot.Client.Self.RegionCrossed += Self_RegionCrossed;
99
100 // Start moving
101 Bot.Client.Self.Movement.AtPos = true;
102
103 // Stop when reach region target or border cross detected
104 if (!m_regionCrossedMutex.WaitOne(m_regionCrossingTimeout))
105 {
106 m_log.ErrorFormat(
107 "[CROSS BEHAVIOUR]: {0} failed to cross from {1} into {2} with {3}ms",
108 Bot.Name, currentSim.Name, destRegion.Name, m_regionCrossingTimeout);
109 }
110 else
111 {
112 m_log.DebugFormat(
113 "[CROSS BEHAVIOUR]: {0} crossed from {1} into {2}",
114 Bot.Name, currentSim.Name, destRegion.Name);
115 }
116
117 Bot.Client.Self.RegionCrossed -= Self_RegionCrossed;
118
119 // We will hackishly carry on travelling into the region for a little bit.
120 Thread.Sleep(6000);
121
122 m_log.DebugFormat(
123 "[CROSS BEHAVIOUR]: {0} stopped moving after cross from {1} into {2}",
124 Bot.Name, currentSim.Name, destRegion.Name);
125
126 Bot.Client.Self.Movement.AtPos = false;
127 }
128 else
129 {
130 m_log.DebugFormat(
131 "[CROSS BEHAVIOUR]: No candidate region for {0} to cross into from {1}. Ignoring.",
132 Bot.Name, currentSim.Name);
133 }
134 }
135
136 private bool TryAddRegion(ulong handle, List<GridRegion> regions)
137 {
138 Dictionary<ulong, GridRegion> knownRegions = Bot.Manager.RegionsKnown;
139
140 lock (knownRegions)
141 {
142 if (knownRegions.Count == 0)
143 return false;
144
145 m_log.DebugFormat("[CROSS BEHAVIOUR]: Looking for region with handle {0} in known regions", handle);
146
147 if (knownRegions.ContainsKey(handle))
148 {
149 GridRegion region = knownRegions[handle];
150 m_log.DebugFormat(
151 "[CROSS BEHAVIOUR]: Adding region {0} to crossing candidates for {1}", region.Name, Bot.Name);
152
153 regions.Add(region);
154
155 return true;
156 }
157 else
158 {
159 return false;
160 }
161 }
162 }
163
164 internal void Self_RegionCrossed(object o, RegionCrossedEventArgs args)
165 {
166 m_regionCrossedMutex.Set();
167 }
168 }
169} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 0a6d5d2..6ad02b2 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -39,20 +39,20 @@ namespace pCampBot
39 /// <remarks> 39 /// <remarks>
40 /// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable. 40 /// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
41 /// </remarks> 41 /// </remarks>
42 public class GrabbingBehaviour : IBehaviour 42 public class GrabbingBehaviour : AbstractBehaviour
43 { 43 {
44 public string Name { get { return "Grabbing"; } } 44 public GrabbingBehaviour() { Name = "Grabbing"; }
45 45
46 public void Action(Bot bot) 46 public override void Action()
47 { 47 {
48 Dictionary<UUID, Primitive> objects = bot.Objects; 48 Dictionary<UUID, Primitive> objects = Bot.Objects;
49 49
50 Primitive prim = objects.ElementAt(bot.Random.Next(0, objects.Count)).Value; 50 Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count)).Value;
51 51
52 // This appears to be a typical message sent when a viewer user clicks a clickable object 52 // This appears to be a typical message sent when a viewer user clicks a clickable object
53 bot.Client.Self.Grab(prim.LocalID); 53 Bot.Client.Self.Grab(prim.LocalID);
54 bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); 54 Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
55 bot.Client.Self.DeGrab(prim.LocalID); 55 Bot.Client.Self.DeGrab(prim.LocalID);
56 } 56 }
57 } 57 }
58} \ No newline at end of file 58} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index f782bb5..daa7485 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -40,43 +40,41 @@ namespace pCampBot
40 /// <remarks> 40 /// <remarks>
41 /// TODO: talkarray should be in a separate behaviour. 41 /// TODO: talkarray should be in a separate behaviour.
42 /// </remarks> 42 /// </remarks>
43 public class PhysicsBehaviour : IBehaviour 43 public class PhysicsBehaviour : AbstractBehaviour
44 { 44 {
45 public string Name { get { return "Physics"; } }
46
47 private string[] talkarray; 45 private string[] talkarray;
48 46
49 public PhysicsBehaviour() 47 public PhysicsBehaviour()
50 { 48 {
49 Name = "Physics";
51 talkarray = readexcuses(); 50 talkarray = readexcuses();
52 } 51 }
53 52
54 public void Action(Bot bot) 53 public override void Action()
55 { 54 {
56 int walkorrun = bot.Random.Next(4); // Randomize between walking and running. The greater this number, 55 int walkorrun = Bot.Random.Next(4); // Randomize between walking and running. The greater this number,
57 // the greater the bot's chances to walk instead of run. 56 // the greater the bot's chances to walk instead of run.
58 bot.Client.Self.Jump(false); 57 Bot.Client.Self.Jump(false);
59 if (walkorrun == 0) 58 if (walkorrun == 0)
60 { 59 {
61 bot.Client.Self.Movement.AlwaysRun = true; 60 Bot.Client.Self.Movement.AlwaysRun = true;
62 } 61 }
63 else 62 else
64 { 63 {
65 bot.Client.Self.Movement.AlwaysRun = false; 64 Bot.Client.Self.Movement.AlwaysRun = false;
66 } 65 }
67 66
68 // TODO: unused: Vector3 pos = client.Self.SimPosition; 67 // TODO: unused: Vector3 pos = client.Self.SimPosition;
69 Vector3 newpos = new Vector3(bot.Random.Next(1, 254), bot.Random.Next(1, 254), bot.Random.Next(1, 254)); 68 Vector3 newpos = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Random.Next(1, 254));
70 bot.Client.Self.Movement.TurnToward(newpos); 69 Bot.Client.Self.Movement.TurnToward(newpos);
71
72 bot.Client.Self.Movement.AtPos = true;
73 Thread.Sleep(bot.Random.Next(3000, 13000));
74 bot.Client.Self.Movement.AtPos = false;
75 bot.Client.Self.Jump(true);
76 70
77 string randomf = talkarray[bot.Random.Next(talkarray.Length)]; 71 Bot.Client.Self.Movement.AtPos = true;
72 Thread.Sleep(Bot.Random.Next(3000, 13000));
73 Bot.Client.Self.Movement.AtPos = false;
74 Bot.Client.Self.Jump(true);
75 string randomf = talkarray[Bot.Random.Next(talkarray.Length)];
78 if (talkarray.Length > 1 && randomf.Length > 1) 76 if (talkarray.Length > 1 && randomf.Length > 1)
79 bot.Client.Self.Chat(randomf, 0, ChatType.Normal); 77 Bot.Client.Self.Chat(randomf, 0, ChatType.Normal);
80 } 78 }
81 79
82 private string[] readexcuses() 80 private string[] readexcuses()
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index fc2ed2c..fbb4e96 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -38,38 +38,38 @@ namespace pCampBot
38 /// <summary> 38 /// <summary>
39 /// Teleport to a random region on the grid. 39 /// Teleport to a random region on the grid.
40 /// </summary> 40 /// </summary>
41 public class TeleportBehaviour : IBehaviour 41 public class TeleportBehaviour : AbstractBehaviour
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"; } } 45 public TeleportBehaviour() { Name = "Teleport"; }
46 46
47 public void Action(Bot bot) 47 public override void Action()
48 { 48 {
49 Random rng = bot.Manager.Rng; 49 Random rng = Bot.Manager.Rng;
50 GridRegion[] knownRegions; 50 GridRegion[] knownRegions;
51 51
52 lock (bot.Manager.RegionsKnown) 52 lock (Bot.Manager.RegionsKnown)
53 { 53 {
54 if (bot.Manager.RegionsKnown.Count == 0) 54 if (Bot.Manager.RegionsKnown.Count == 0)
55 { 55 {
56 m_log.DebugFormat( 56 m_log.DebugFormat(
57 "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", bot.Name); 57 "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", Bot.Name);
58 return; 58 return;
59 } 59 }
60 60
61 knownRegions = bot.Manager.RegionsKnown.Values.ToArray(); 61 knownRegions = Bot.Manager.RegionsKnown.Values.ToArray();
62 } 62 }
63 63
64 Simulator sourceRegion = bot.Client.Network.CurrentSim; 64 Simulator sourceRegion = Bot.Client.Network.CurrentSim;
65 GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)]; 65 GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)];
66 Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50); 66 Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50);
67 67
68 m_log.DebugFormat( 68 m_log.DebugFormat(
69 "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}", 69 "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}",
70 bot.Name, sourceRegion.Name, bot.Client.Self.SimPosition, destRegion.Name, destPosition); 70 Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);
71 71
72 bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); 72 Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
73 } 73 }
74 } 74 }
75} \ No newline at end of file 75} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 7a73e3f..0bd0bcc 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -130,6 +130,8 @@ namespace pCampBot
130 BotManager bm, List<IBehaviour> behaviours, 130 BotManager bm, List<IBehaviour> behaviours,
131 string firstName, string lastName, string password, string loginUri) 131 string firstName, string lastName, string password, string loginUri)
132 { 132 {
133 behaviours.ForEach(b => b.Initialize(this));
134
133 Client = new GridClient(); 135 Client = new GridClient();
134 136
135 Random = new Random(Environment.TickCount);// We do stuff randomly here 137 Random = new Random(Environment.TickCount);// We do stuff randomly here
@@ -156,7 +158,7 @@ namespace pCampBot
156 b => 158 b =>
157 { 159 {
158 // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); 160 // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
159 b.Action(this); 161 b.Action();
160 162
161 Thread.Sleep(Random.Next(1000, 10000)); 163 Thread.Sleep(Random.Next(1000, 10000));
162 } 164 }
@@ -226,8 +228,6 @@ namespace pCampBot
226 MakeDefaultAppearance(wear); 228 MakeDefaultAppearance(wear);
227 } 229 }
228 230
229 Client.Self.Jump(true);
230
231 // Extract nearby region information. 231 // Extract nearby region information.
232 Client.Grid.GridRegion += Manager.Grid_GridRegion; 232 Client.Grid.GridRegion += Manager.Grid_GridRegion;
233 uint xUint, yUint; 233 uint xUint, yUint;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 29cb1ba..6481e97 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -151,26 +151,29 @@ namespace pCampBot
151 Array.ForEach<string>( 151 Array.ForEach<string>(
152 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); 152 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
153 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
170 for (int i = 0; i < botcount; i++) 154 for (int i = 0; i < botcount; i++)
171 { 155 {
172 string lastName = string.Format("{0}_{1}", lastNameStem, i); 156 string lastName = string.Format("{0}_{1}", lastNameStem, i);
173 157
158 List<IBehaviour> behaviours = new List<IBehaviour>();
159
160 // Hard-coded for now
161 if (behaviourSwitches.Contains("p"))
162 behaviours.Add(new PhysicsBehaviour());
163
164 if (behaviourSwitches.Contains("g"))
165 behaviours.Add(new GrabbingBehaviour());
166
167 if (behaviourSwitches.Contains("t"))
168 behaviours.Add(new TeleportBehaviour());
169
170 if (behaviourSwitches.Contains("c"))
171 behaviours.Add(new CrossBehaviour());
172
173 MainConsole.Instance.OutputFormat(
174 "[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
175 firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
176
174 StartBot(this, behaviours, firstName, lastName, password, loginUri); 177 StartBot(this, behaviours, firstName, lastName, password, loginUri);
175 } 178 }
176 } 179 }
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index 912216f..9c984be 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -37,9 +37,18 @@ namespace pCampBot.Interfaces
37 string Name { get; } 37 string Name { get; }
38 38
39 /// <summary> 39 /// <summary>
40 /// Initialize the behaviour for this bot.
41 /// </summary>
42 /// <remarks>
43 /// This must be invoked before Action() is called.
44 /// </remarks>
45 /// <param name="bot"></param>
46 void Initialize(Bot bot);
47
48 /// <summary>
40 /// Action to take when this behaviour is invoked. 49 /// Action to take when this behaviour is invoked.
41 /// </summary> 50 /// </summary>
42 /// <param name="bot"></param> 51 /// <param name="bot"></param>
43 void Action(Bot bot); 52 void Action();
44 } 53 }
45} \ No newline at end of file 54} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index e7288d5..3f43cff 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -104,17 +104,21 @@ namespace pCampBot
104 // name, to load an specific folder, or save, to save an avatar with some already existing wearables 104 // name, to load an specific folder, or save, to save an avatar with some already existing wearables
105 // worn to the folder MyAppearance/FirstName_LastName, and the load it. 105 // worn to the folder MyAppearance/FirstName_LastName, and the load it.
106 Console.WriteLine( 106 Console.WriteLine(
107 "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + 107 "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
108 "Spawns a set of bots to test an OpenSim region\n\n" + 108 "Spawns a set of bots to test an OpenSim region\n\n" +
109 " -l, -loginuri loginuri for sim to log into (required)\n" + 109 " -l, -loginuri loginuri for sim to log into (required)\n" +
110 " -n, -botcount number of bots to start (default: 1)\n" + 110 " -n, -botcount number of bots to start (default: 1)\n" +
111 " -firstname first name for the bots\n" + 111 " -firstname first name for the bots\n" +
112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" + 112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
113 " -password password for the bots\n" + 113 " -password password for the bots\n" +
114 " -b, behaviours behaviours for bots. Current options p (physics), g (grab), t (teleport). Comma separated, e.g. p,g. Default is p", 114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n",
115 " -wear set appearance folder to load from (default: no)\n" + 115 " current options are:" +
116 " -h, -help show this message" 116 " p (physics)" +
117 ); 117 " g (grab)" +
118 " t (teleport)" +
119// " c (cross)" +
120 " -wear set appearance folder to load from (default: no)\n" +
121 " -h, -help show this message");
118 } 122 }
119 } 123 }
120} 124}