aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/Bot.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-09-03 19:33:17 +0100
committerJustin Clark-Casey (justincc)2013-09-03 19:33:17 +0100
commit3dbe7313d1c3fc28f0642531fbb6e238a98ac821 (patch)
treefdb7503109ee947e5bb9fd7d6fbe31933a0aa2e1 /OpenSim/Tools/pCampBot/Bot.cs
parentAdd pCampbot "remove behaviour" console command for removing bot behaviours d... (diff)
downloadopensim-SC_OLD-3dbe7313d1c3fc28f0642531fbb6e238a98ac821.zip
opensim-SC_OLD-3dbe7313d1c3fc28f0642531fbb6e238a98ac821.tar.gz
opensim-SC_OLD-3dbe7313d1c3fc28f0642531fbb6e238a98ac821.tar.bz2
opensim-SC_OLD-3dbe7313d1c3fc28f0642531fbb6e238a98ac821.tar.xz
Add Close() method to IBehaviour to allow behaviours to cleanup when removed or bot it disconnected.
In this case, it is used to turn off jump when physics testing behaviour is removed.
Diffstat (limited to '')
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 0bd8151..f871b77 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -209,7 +209,17 @@ namespace pCampBot
209 public bool RemoveBehaviour(string abbreviatedName) 209 public bool RemoveBehaviour(string abbreviatedName)
210 { 210 {
211 lock (Behaviours) 211 lock (Behaviours)
212 return Behaviours.Remove(abbreviatedName); 212 {
213 IBehaviour behaviour;
214
215 if (!Behaviours.TryGetValue(abbreviatedName, out behaviour))
216 return false;
217
218 behaviour.Close();
219 Behaviours.Remove(abbreviatedName);
220
221 return true;
222 }
213 } 223 }
214 224
215 private void CreateLibOmvClient() 225 private void CreateLibOmvClient()
@@ -282,6 +292,10 @@ namespace pCampBot
282 // XXX: This is a really shitty way of yielding so that behaviours can be added/removed 292 // XXX: This is a really shitty way of yielding so that behaviours can be added/removed
283 Thread.Sleep(100); 293 Thread.Sleep(100);
284 } 294 }
295
296 lock (Behaviours)
297 foreach (IBehaviour b in Behaviours.Values)
298 b.Close();
285 } 299 }
286 300
287 /// <summary> 301 /// <summary>