diff options
author | Justin Clark-Casey (justincc) | 2013-09-03 19:41:12 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-09-04 00:48:16 +0100 |
commit | cfdb2700bcb7341d08a9fa41c1b13963843be66f (patch) | |
tree | 9783720f7ba765ada3bf7980c04285849909a24e /OpenSim | |
parent | Add Close() method to IBehaviour to allow behaviours to cleanup when removed ... (diff) | |
download | opensim-SC_OLD-cfdb2700bcb7341d08a9fa41c1b13963843be66f.zip opensim-SC_OLD-cfdb2700bcb7341d08a9fa41c1b13963843be66f.tar.gz opensim-SC_OLD-cfdb2700bcb7341d08a9fa41c1b13963843be66f.tar.bz2 opensim-SC_OLD-cfdb2700bcb7341d08a9fa41c1b13963843be66f.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 3 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 3 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Bot.cs | 2 |
3 files changed, 7 insertions, 1 deletions
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; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
@@ -60,6 +61,8 @@ namespace pCampBot | |||
60 | Bot.Client.Self.Grab(prim.LocalID); | 61 | Bot.Client.Self.Grab(prim.LocalID); |
61 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); | 62 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); |
62 | Bot.Client.Self.DeGrab(prim.LocalID); | 63 | Bot.Client.Self.DeGrab(prim.LocalID); |
64 | |||
65 | Thread.Sleep(1000); | ||
63 | } | 66 | } |
64 | } | 67 | } |
65 | } \ No newline at end of file | 68 | } \ 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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | 30 | using System.Linq; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using pCampBot.Interfaces; | 35 | using pCampBot.Interfaces; |
@@ -74,6 +75,8 @@ namespace pCampBot | |||
74 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); | 75 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); |
75 | 76 | ||
76 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); | 77 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); |
78 | |||
79 | Thread.Sleep(Bot.Random.Next(3000, 10000)); | ||
77 | } | 80 | } |
78 | } | 81 | } |
79 | } \ No newline at end of file | 82 | } \ 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 | |||
282 | { | 282 | { |
283 | foreach (IBehaviour behaviour in Behaviours.Values) | 283 | foreach (IBehaviour behaviour in Behaviours.Values) |
284 | { | 284 | { |
285 | Thread.Sleep(Random.Next(3000, 10000)); | 285 | // Thread.Sleep(Random.Next(3000, 10000)); |
286 | 286 | ||
287 | // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); | 287 | // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); |
288 | behaviour.Action(); | 288 | behaviour.Action(); |