From 2ae5b40ca6bb3d33310f0f66569bf150548a2de6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Nov 2011 22:36:45 +0000 Subject: On pCampBot, add bot as a property on behaviours instead of passing it in every time --- .../Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs') 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 /// /// Teleport to a random region on the grid. /// - public class TeleportBehaviour : IBehaviour + public class TeleportBehaviour : AbstractBehaviour { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "Teleport"; } } + public TeleportBehaviour() { Name = "Teleport"; } - public void Action(Bot bot) + public override void Action() { - Random rng = bot.Manager.Rng; + Random rng = Bot.Manager.Rng; GridRegion[] knownRegions; - lock (bot.Manager.RegionsKnown) + lock (Bot.Manager.RegionsKnown) { - if (bot.Manager.RegionsKnown.Count == 0) + if (Bot.Manager.RegionsKnown.Count == 0) { m_log.DebugFormat( - "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", bot.Name); + "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", Bot.Name); return; } - knownRegions = bot.Manager.RegionsKnown.Values.ToArray(); + knownRegions = Bot.Manager.RegionsKnown.Values.ToArray(); } - Simulator sourceRegion = bot.Client.Network.CurrentSim; + Simulator sourceRegion = Bot.Client.Network.CurrentSim; GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)]; Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50); m_log.DebugFormat( "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}", - bot.Name, sourceRegion.Name, bot.Client.Self.SimPosition, destRegion.Name, destPosition); + Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); - bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); + Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); } } } \ No newline at end of file -- cgit v1.1