aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-24 22:36:45 +0000
committerJustin Clark-Casey (justincc)2011-11-24 22:36:45 +0000
commit2ae5b40ca6bb3d33310f0f66569bf150548a2de6 (patch)
tree9c485fa9e2e9d1b2d976d3b6d9777457b836df36 /OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
parentminor: remove mono compiler warning (diff)
downloadopensim-SC_OLD-2ae5b40ca6bb3d33310f0f66569bf150548a2de6.zip
opensim-SC_OLD-2ae5b40ca6bb3d33310f0f66569bf150548a2de6.tar.gz
opensim-SC_OLD-2ae5b40ca6bb3d33310f0f66569bf150548a2de6.tar.bz2
opensim-SC_OLD-2ae5b40ca6bb3d33310f0f66569bf150548a2de6.tar.xz
On pCampBot, add bot as a property on behaviours instead of passing it in every time
Diffstat (limited to 'OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs')
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs22
1 files changed, 11 insertions, 11 deletions
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