diff options
author | Justin Clark-Casey (justincc) | 2011-11-03 22:31:31 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-03 22:31:31 +0000 |
commit | 5a67940acc17c80c419781fddc9efa0c18ce1f15 (patch) | |
tree | 18b58a3cb1434a1ec05c5170bdb59e4d55e19cb3 /OpenSim/Tools/pCampBot/PhysicsBot.cs | |
parent | Move PhysicsBehaviour into a spearate behaviours folder (diff) | |
download | opensim-SC-5a67940acc17c80c419781fddc9efa0c18ce1f15.zip opensim-SC-5a67940acc17c80c419781fddc9efa0c18ce1f15.tar.gz opensim-SC-5a67940acc17c80c419781fddc9efa0c18ce1f15.tar.bz2 opensim-SC-5a67940acc17c80c419781fddc9efa0c18ce1f15.tar.xz |
Add click/grab behaviour to pCampbot, which gets bots to randomly click things.
This can be specified on pCampbot.exe by using g in the list of behaviours for the new -behaviours,-b switch
e.g. -b p,g to get both existing physics and grabbing behaviours.
grabbing is primitive, it attempts grabs on random prims whether they're actually signalled as clickable or not.
behaviour is currently primitive overall, behaviours are just executed in a list
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsBot.cs | 31 |
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) |