From 5a67940acc17c80c419781fddc9efa0c18ce1f15 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Nov 2011 22:31:31 +0000 Subject: 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 --- OpenSim/Tools/pCampBot/PhysicsBot.cs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tools/pCampBot/PhysicsBot.cs') 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 /// /// Behaviours implemented by this bot. /// + /// + /// Lock this list before manipulating it. + /// public List Behaviours { get; private set; } /// + /// Objects that the bot has discovered. + /// + /// + /// Returns a list copy. Inserting new objects manually will have no effect. + /// + public Dictionary Objects + { + get + { + lock (m_objects) + return new Dictionary(m_objects); + } + } + private Dictionary m_objects = new Dictionary(); + + /// /// Is this bot connected to the grid? /// public bool IsConnected { get; private set; } @@ -125,7 +144,14 @@ namespace pCampBot private void Action() { while (true) - Behaviours.ForEach(b => b.Action(this)); + lock (Behaviours) + Behaviours.ForEach( + b => + { + // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); + b.Action(this); + } + ); } /// @@ -407,6 +433,9 @@ namespace pCampBot if (prim != null) { + lock (m_objects) + m_objects[prim.ID] = prim; + if (prim.Textures != null) { if (prim.Textures.DefaultTexture.TextureID != UUID.Zero) -- cgit v1.1