aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/Behaviours
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/pCampBot/Behaviours')
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs14
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs10
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs2
3 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
index 9bc8512..c1ba36b 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -29,11 +29,12 @@ using OpenMetaverse;
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq; 31using System.Linq;
32using System.Threading;
32using pCampBot.Interfaces; 33using pCampBot.Interfaces;
33 34
34namespace pCampBot 35namespace pCampBot
35{ 36{
36 public class AbstractBehaviour : IBehaviour 37 public abstract class AbstractBehaviour : IBehaviour
37 { 38 {
38 /// <summary> 39 /// <summary>
39 /// Abbreviated name of this behaviour. 40 /// Abbreviated name of this behaviour.
@@ -44,13 +45,20 @@ namespace pCampBot
44 45
45 public Bot Bot { get; protected set; } 46 public Bot Bot { get; protected set; }
46 47
47 public virtual void Action() {} 48 public abstract void Action();
49
50 public virtual void Interrupt() {}
51
52 protected AutoResetEvent m_interruptEvent = new AutoResetEvent(false);
48 53
49 public virtual void Initialize(Bot bot) 54 public virtual void Initialize(Bot bot)
50 { 55 {
51 Bot = bot; 56 Bot = bot;
52 } 57 }
53 58
54 public virtual void Close() {} 59 public virtual void Close()
60 {
61 Interrupt();
62 }
55 } 63 }
56} 64}
diff --git a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
index 9a3075c..4a7237c 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs
@@ -43,5 +43,15 @@ namespace pCampBot
43 AbbreviatedName = "n"; 43 AbbreviatedName = "n";
44 Name = "None"; 44 Name = "None";
45 } 45 }
46
47 public override void Action()
48 {
49 m_interruptEvent.WaitOne();
50 }
51
52 public override void Interrupt()
53 {
54 m_interruptEvent.Set();
55 }
46 } 56 }
47} \ No newline at end of file 57} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index 6fd2b7c..98ab931 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -82,6 +82,8 @@ namespace pCampBot
82 { 82 {
83 if (Bot.ConnectionState == ConnectionState.Connected) 83 if (Bot.ConnectionState == ConnectionState.Connected)
84 Bot.Client.Self.Jump(false); 84 Bot.Client.Self.Jump(false);
85
86 base.Close();
85 } 87 }
86 88
87 private string[] readexcuses() 89 private string[] readexcuses()