aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/PhysicsBot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/pCampBot/PhysicsBot.cs')
-rw-r--r--OpenSim/Tools/pCampBot/PhysicsBot.cs31
1 files changed, 30 insertions, 1 deletions
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs
index 05a510a..6e40ca7 100644
--- a/OpenSim/Tools/pCampBot/PhysicsBot.cs
+++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs
@@ -55,9 +55,28 @@ namespace pCampBot
55 /// <summary> 55 /// <summary>
56 /// Behaviours implemented by this bot. 56 /// Behaviours implemented by this bot.
57 /// </summary> 57 /// </summary>
58 /// <remarks>
59 /// Lock this list before manipulating it.
60 /// </remarks>
58 public List<IBehaviour> Behaviours { get; private set; } 61 public List<IBehaviour> Behaviours { get; private set; }
59 62
60 /// <summary> 63 /// <summary>
64 /// Objects that the bot has discovered.
65 /// </summary>
66 /// <remarks>
67 /// Returns a list copy. Inserting new objects manually will have no effect.
68 /// </remarks>
69 public Dictionary<UUID, Primitive> Objects
70 {
71 get
72 {
73 lock (m_objects)
74 return new Dictionary<UUID, Primitive>(m_objects);
75 }
76 }
77 private Dictionary<UUID, Primitive> m_objects = new Dictionary<UUID, Primitive>();
78
79 /// <summary>
61 /// Is this bot connected to the grid? 80 /// Is this bot connected to the grid?
62 /// </summary> 81 /// </summary>
63 public bool IsConnected { get; private set; } 82 public bool IsConnected { get; private set; }
@@ -125,7 +144,14 @@ namespace pCampBot
125 private void Action() 144 private void Action()
126 { 145 {
127 while (true) 146 while (true)
128 Behaviours.ForEach(b => b.Action(this)); 147 lock (Behaviours)
148 Behaviours.ForEach(
149 b =>
150 {
151 // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
152 b.Action(this);
153 }
154 );
129 } 155 }
130 156
131 /// <summary> 157 /// <summary>
@@ -407,6 +433,9 @@ namespace pCampBot
407 433
408 if (prim != null) 434 if (prim != null)
409 { 435 {
436 lock (m_objects)
437 m_objects[prim.ID] = prim;
438
410 if (prim.Textures != null) 439 if (prim.Textures != null)
411 { 440 {
412 if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) 441 if (prim.Textures.DefaultTexture.TextureID != UUID.Zero)