From 76bd2e2d727a15e5d3bc9045bdef6faaeca4a08f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Sep 2013 19:41:12 +0100 Subject: Consistently give responsibility for thread sleeping to behaviours rather than controlling from the main action loop This is to avoid excessive and inconsistent delays between behaviours that currently need to embed sleeps in other actions (e.g. physics) and other behaviours. Might need a more sophisticated approach in the long term. --- OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 3 +++ OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 3 +++ OpenSim/Tools/pCampBot/Bot.cs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tools') diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs index 6acc27d..59f6244 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs @@ -29,6 +29,7 @@ using OpenMetaverse; using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using pCampBot.Interfaces; namespace pCampBot @@ -60,6 +61,8 @@ namespace pCampBot Bot.Client.Self.Grab(prim.LocalID); Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); Bot.Client.Self.DeGrab(prim.LocalID); + + Thread.Sleep(1000); } } } \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs index 5f7edda..81f250d 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Threading; using log4net; using OpenMetaverse; using pCampBot.Interfaces; @@ -74,6 +75,8 @@ namespace pCampBot Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); + + Thread.Sleep(Bot.Random.Next(3000, 10000)); } } } \ No newline at end of file diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs index f871b77..d0a4ef3 100644 --- a/OpenSim/Tools/pCampBot/Bot.cs +++ b/OpenSim/Tools/pCampBot/Bot.cs @@ -282,7 +282,7 @@ namespace pCampBot { foreach (IBehaviour behaviour in Behaviours.Values) { - Thread.Sleep(Random.Next(3000, 10000)); +// Thread.Sleep(Random.Next(3000, 10000)); // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); behaviour.Action(); -- cgit v1.1