diff options
Diffstat (limited to 'OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 22 |
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 |