aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Caps.cs7
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs130
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs57
-rw-r--r--OpenSim/Framework/WebUtil.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs362
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs69
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs68
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs1
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs49
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs169
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs16
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs32
-rw-r--r--OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs22
-rw-r--r--OpenSim/Tools/pCampBot/Bot.cs6
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs35
-rw-r--r--OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs11
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs26
30 files changed, 695 insertions, 447 deletions
diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs
index 56ccfd6..bc6f6f9 100644
--- a/OpenSim/Capabilities/Caps.cs
+++ b/OpenSim/Capabilities/Caps.cs
@@ -98,14 +98,17 @@ namespace OpenSim.Framework.Capabilities
98 { 98 {
99 get { return m_httpListener.UseSSL; } 99 get { return m_httpListener.UseSSL; }
100 } 100 }
101
101 public string SSLCommonName 102 public string SSLCommonName
102 { 103 {
103 get { return m_httpListener.SSLCommonName; } 104 get { return m_httpListener.SSLCommonName; }
104 } 105 }
106
105 public CapsHandlers CapsHandlers 107 public CapsHandlers CapsHandlers
106 { 108 {
107 get { return m_capsHandlers; } 109 get { return m_capsHandlers; }
108 } 110 }
111
109 public Dictionary<string, string> ExternalCapsHandlers 112 public Dictionary<string, string> ExternalCapsHandlers
110 { 113 {
111 get { return m_externalCapsHandlers; } 114 get { return m_externalCapsHandlers; }
@@ -157,11 +160,7 @@ namespace OpenSim.Framework.Capabilities
157 160
158 /// <summary> 161 /// <summary>
159 /// Remove all CAPS service handlers. 162 /// Remove all CAPS service handlers.
160 ///
161 /// </summary> 163 /// </summary>
162 /// <param name="httpListener"></param>
163 /// <param name="path"></param>
164 /// <param name="restMethod"></param>
165 public void DeregisterHandlers() 164 public void DeregisterHandlers()
166 { 165 {
167 if (m_capsHandlers != null) 166 if (m_capsHandlers != null)
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index 6fd7946..2dade5b 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -42,7 +42,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
42 42
43namespace OpenSim.Capabilities.Handlers 43namespace OpenSim.Capabilities.Handlers
44{ 44{
45
46 public class WebFetchInvDescHandler 45 public class WebFetchInvDescHandler
47 { 46 {
48 private static readonly ILog m_log = 47 private static readonly ILog m_log =
@@ -50,7 +49,7 @@ namespace OpenSim.Capabilities.Handlers
50 49
51 private IInventoryService m_InventoryService; 50 private IInventoryService m_InventoryService;
52 private ILibraryService m_LibraryService; 51 private ILibraryService m_LibraryService;
53 private object m_fetchLock = new Object(); 52// private object m_fetchLock = new Object();
54 53
55 public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService) 54 public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService)
56 { 55 {
@@ -60,37 +59,40 @@ namespace OpenSim.Capabilities.Handlers
60 59
61 public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 60 public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
62 { 61 {
63 // nasty temporary hack here, the linden client falsely 62// lock (m_fetchLock)
64 // identifies the uuid 00000000-0000-0000-0000-000000000000 63// {
65 // as a string which breaks us 64// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request);
66 // 65
67 // correctly mark it as a uuid 66 // nasty temporary hack here, the linden client falsely
68 // 67 // identifies the uuid 00000000-0000-0000-0000-000000000000
69 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); 68 // as a string which breaks us
70 69 //
71 // another hack <integer>1</integer> results in a 70 // correctly mark it as a uuid
72 // System.ArgumentException: Object type System.Int32 cannot 71 //
73 // be converted to target type: System.Boolean 72 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
74 // 73
75 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); 74 // another hack <integer>1</integer> results in a
76 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); 75 // System.ArgumentException: Object type System.Int32 cannot
77 76 // be converted to target type: System.Boolean
78 Hashtable hash = new Hashtable(); 77 //
79 try 78 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
80 { 79 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
81 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); 80
82 } 81 Hashtable hash = new Hashtable();
83 catch (LLSD.LLSDParseException pe) 82 try
84 { 83 {
85 m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); 84 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
86 m_log.Error("Request: " + request.ToString()); 85 }
87 } 86 catch (LLSD.LLSDParseException e)
88 87 {
89 ArrayList foldersrequested = (ArrayList)hash["folders"]; 88 m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
89 m_log.Error("Request: " + request);
90 }
91
92 ArrayList foldersrequested = (ArrayList)hash["folders"];
93
94 string response = "";
90 95
91 string response = "";
92 lock (m_fetchLock)
93 {
94 for (int i = 0; i < foldersrequested.Count; i++) 96 for (int i = 0; i < foldersrequested.Count; i++)
95 { 97 {
96 string inventoryitemstr = ""; 98 string inventoryitemstr = "";
@@ -104,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers
104 } 106 }
105 catch (Exception e) 107 catch (Exception e)
106 { 108 {
107 m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e); 109 m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
108 } 110 }
109 LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); 111 LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
110 112
@@ -115,7 +117,6 @@ namespace OpenSim.Capabilities.Handlers
115 response += inventoryitemstr; 117 response += inventoryitemstr;
116 } 118 }
117 119
118
119 if (response.Length == 0) 120 if (response.Length == 0)
120 { 121 {
121 // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. 122 // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
@@ -129,11 +130,12 @@ namespace OpenSim.Capabilities.Handlers
129 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; 130 response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
130 } 131 }
131 132
132 //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); 133// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
133 //m_log.Debug("[CAPS] "+response); 134 //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
134 135
135 } 136 return response;
136 return response; 137
138// }
137 } 139 }
138 140
139 /// <summary> 141 /// <summary>
@@ -155,7 +157,10 @@ namespace OpenSim.Capabilities.Handlers
155 inv.Items = new List<InventoryItemBase>(); 157 inv.Items = new List<InventoryItemBase>();
156 int version = 0; 158 int version = 0;
157 159
158 inv = Fetch(invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); 160 inv
161 = Fetch(
162 invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
163 invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
159 164
160 if (inv.Folders != null) 165 if (inv.Folders != null)
161 { 166 {
@@ -179,16 +184,31 @@ namespace OpenSim.Capabilities.Handlers
179 return reply; 184 return reply;
180 } 185 }
181 186
182 public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID, 187 /// <summary>
183 bool fetchFolders, bool fetchItems, int sortOrder, out int version) 188 /// Handle the caps inventory descendents fetch.
189 /// </summary>
190 /// <param name="agentID"></param>
191 /// <param name="folderID"></param>
192 /// <param name="ownerID"></param>
193 /// <param name="fetchFolders"></param>
194 /// <param name="fetchItems"></param>
195 /// <param name="sortOrder"></param>
196 /// <param name="version"></param>
197 /// <returns>An empty InventoryCollection if the inventory look up failed</returns>
198 public InventoryCollection Fetch(
199 UUID agentID, UUID folderID, UUID ownerID,
200 bool fetchFolders, bool fetchItems, int sortOrder, out int version)
184 { 201 {
185 m_log.DebugFormat( 202// m_log.DebugFormat(
186 "[WEBFETCHINVENTORYDESCENDANTS]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", 203// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
187 fetchFolders, fetchItems, folderID, agentID); 204// fetchFolders, fetchItems, folderID, agentID);
205
206 // FIXME MAYBE: We're not handling sortOrder!
188 207
189 version = 0; 208 version = 0;
190 InventoryFolderImpl fold; 209 InventoryFolderImpl fold;
191 if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) 210 if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
211 {
192 if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) 212 if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
193 { 213 {
194 InventoryCollection ret = new InventoryCollection(); 214 InventoryCollection ret = new InventoryCollection();
@@ -197,6 +217,7 @@ namespace OpenSim.Capabilities.Handlers
197 217
198 return ret; 218 return ret;
199 } 219 }
220 }
200 221
201 InventoryCollection contents = new InventoryCollection(); 222 InventoryCollection contents = new InventoryCollection();
202 223
@@ -212,7 +233,7 @@ namespace OpenSim.Capabilities.Handlers
212 } 233 }
213 else 234 else
214 { 235 {
215 // Lost itemsm don't really need a version 236 // Lost items don't really need a version
216 version = 1; 237 version = 1;
217 } 238 }
218 239
@@ -230,10 +251,11 @@ namespace OpenSim.Capabilities.Handlers
230 llsdFolder.folder_id = invFolder.ID; 251 llsdFolder.folder_id = invFolder.ID;
231 llsdFolder.parent_id = invFolder.ParentID; 252 llsdFolder.parent_id = invFolder.ParentID;
232 llsdFolder.name = invFolder.Name; 253 llsdFolder.name = invFolder.Name;
233 if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length) 254
255 if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
234 llsdFolder.type = "-1"; 256 llsdFolder.type = "-1";
235 else 257 else
236 llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; 258 llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
237 llsdFolder.preferred_type = "-1"; 259 llsdFolder.preferred_type = "-1";
238 260
239 return llsdFolder; 261 return llsdFolder;
@@ -254,16 +276,19 @@ namespace OpenSim.Capabilities.Handlers
254 llsdItem.item_id = invItem.ID; 276 llsdItem.item_id = invItem.ID;
255 llsdItem.name = invItem.Name; 277 llsdItem.name = invItem.Name;
256 llsdItem.parent_id = invItem.Folder; 278 llsdItem.parent_id = invItem.Folder;
279
257 try 280 try
258 { 281 {
259 // TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions. 282 llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
260 llsdItem.type = TaskInventoryItem.Types[invItem.AssetType]; 283 llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
261 llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType];
262 } 284 }
263 catch (Exception e) 285 catch (Exception e)
264 { 286 {
265 m_log.ErrorFormat("[CAPS]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", invItem.AssetType, invItem.InvType, invItem.Name, e.Message); 287 m_log.ErrorFormat(
288 "[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
289 invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
266 } 290 }
291
267 llsdItem.permissions = new LLSDPermissions(); 292 llsdItem.permissions = new LLSDPermissions();
268 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; 293 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
269 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; 294 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
@@ -294,6 +319,5 @@ namespace OpenSim.Capabilities.Handlers
294 319
295 return llsdItem; 320 return llsdItem;
296 } 321 }
297
298 } 322 }
299} 323} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index f10b857..a0d3541 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -565,7 +565,7 @@ namespace OpenSim.Framework.Console
565 /// </summary> 565 /// </summary>
566 public class CommandConsole : ConsoleBase, ICommandConsole 566 public class CommandConsole : ConsoleBase, ICommandConsole
567 { 567 {
568 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 568// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
569 569
570 public ICommands Commands { get; private set; } 570 public ICommands Commands { get; private set; }
571 571
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index be2b8c8..fa514f0 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -40,63 +40,6 @@ namespace OpenSim.Framework
40 /// </summary> 40 /// </summary>
41 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; 41 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
42 42
43 /// <summary>
44 /// Inventory types
45 /// </summary>
46 public static string[] InvTypes = new string[]
47 {
48 "texture",
49 "sound",
50 "calling_card",
51 "landmark",
52 String.Empty,
53 String.Empty,
54 "object",
55 "notecard",
56 String.Empty,
57 String.Empty,
58 "lsl_text",
59 String.Empty,
60 String.Empty,
61 "bodypart",
62 String.Empty,
63 "snapshot",
64 String.Empty,
65 String.Empty,
66 "wearable",
67 "animation",
68 "gesture"
69 };
70
71 /// <summary>
72 /// Asset types
73 /// </summary>
74 public static string[] Types = new string[]
75 {
76 "texture",
77 "sound",
78 "callcard",
79 "landmark",
80 "clothing", // Deprecated
81 "clothing",
82 "object",
83 "notecard",
84 "category",
85 "root",
86 "lsltext",
87 "lslbyte",
88 "txtr_tga",
89 "bodypart",
90 "trash",
91 "snapshot",
92 "lstndfnd",
93 "snd_wav",
94 "img_tga",
95 "jpeg",
96 "animatn",
97 "gesture"
98 };
99
100 private UUID _assetID = UUID.Zero; 43 private UUID _assetID = UUID.Zero;
101 44
102 private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL; 45 private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL;
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 6ce122b..854f310 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -295,7 +295,7 @@ namespace OpenSim.Framework
295 return result; 295 return result;
296 } 296 }
297 } 297 }
298 catch (Exception e) 298 catch
299 { 299 {
300 // don't need to treat this as an error... we're just guessing anyway 300 // don't need to treat this as an error... we're just guessing anyway
301// m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); 301// m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index b93a41b..8f0ae76 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -134,7 +134,6 @@ namespace OpenSim.Region.ClientStack.Linden
134 AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; 134 AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
135 ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset; 135 ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
136 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset; 136 TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
137 CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
138 GetClient = m_Scene.SceneGraph.GetControllingClient; 137 GetClient = m_Scene.SceneGraph.GetControllingClient;
139 } 138 }
140 139
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 7d73b3e..5c721d4 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -39,6 +39,7 @@ using OpenMetaverse.Messages.Linden;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Console;
42using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer; 44using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
@@ -58,9 +59,15 @@ namespace OpenSim.Region.ClientStack.Linden
58 public class EventQueueGetModule : IEventQueue, IRegionModule 59 public class EventQueueGetModule : IEventQueue, IRegionModule
59 { 60 {
60 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 protected Scene m_scene = null; 62
63 /// <value>
64 /// Debug level.
65 /// </value>
66 public int DebugLevel { get; set; }
67
68 protected Scene m_scene;
62 private IConfigSource m_gConfig; 69 private IConfigSource m_gConfig;
63 bool enabledYN = false; 70 bool enabledYN;
64 71
65 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); 72 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
66 73
@@ -97,6 +104,15 @@ namespace OpenSim.Region.ClientStack.Linden
97 scene.EventManager.OnClientClosed += ClientClosed; 104 scene.EventManager.OnClientClosed += ClientClosed;
98 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 105 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
99 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 106 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
107
108 MainConsole.Instance.Commands.AddCommand(
109 "event queue",
110 false,
111 "debug eq",
112 "debug eq [0|1]",
113 "debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n"
114 + "debug eq 1 will turn off event queue debugging.",
115 HandleDebugEq);
100 } 116 }
101 else 117 else
102 { 118 {
@@ -128,6 +144,22 @@ namespace OpenSim.Region.ClientStack.Linden
128 } 144 }
129 #endregion 145 #endregion
130 146
147 protected void HandleDebugEq(string module, string[] args)
148 {
149 int debugLevel;
150
151 if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel)))
152 {
153 MainConsole.Instance.OutputFormat("Usage: debug eq [0|1]");
154 }
155 else
156 {
157 DebugLevel = debugLevel;
158 MainConsole.Instance.OutputFormat(
159 "Set event queue debug level to {0} in {1}", DebugLevel, m_scene.RegionInfo.RegionName);
160 }
161 }
162
131 /// <summary> 163 /// <summary>
132 /// Always returns a valid queue 164 /// Always returns a valid queue
133 /// </summary> 165 /// </summary>
@@ -314,16 +346,22 @@ namespace OpenSim.Region.ClientStack.Linden
314 } 346 }
315 347
316 // Register this as a caps handler 348 // Register this as a caps handler
349 // FIXME: Confusingly, we need to register separate as a capability so that the client is told about
350 // EventQueueGet when it receive capability information, but then we replace the rest handler immediately
351 // afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but
352 // really it should be possible to directly register the poll handler as a capability.
317 caps.RegisterHandler("EventQueueGet", 353 caps.RegisterHandler("EventQueueGet",
318 new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", 354 new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", null));
319 delegate(Hashtable m_dhttpMethod) 355// delegate(Hashtable m_dhttpMethod)
320 { 356// {
321 return ProcessQueue(m_dhttpMethod, agentID, caps); 357// return ProcessQueue(m_dhttpMethod, agentID, caps);
322 })); 358// }));
323 359
324 // This will persist this beyond the expiry of the caps handlers 360 // This will persist this beyond the expiry of the caps handlers
325 MainServer.Instance.AddPollServiceHTTPHandler( 361 MainServer.Instance.AddPollServiceHTTPHandler(
326 capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); 362 capsBase + EventQueueGetUUID.ToString() + "/",
363 EventQueuePoll,
364 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
327 365
328 Random rnd = new Random(Environment.TickCount); 366 Random rnd = new Random(Environment.TickCount);
329 lock (m_ids) 367 lock (m_ids)
@@ -348,6 +386,8 @@ namespace OpenSim.Region.ClientStack.Linden
348 386
349 public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request) 387 public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
350 { 388 {
389// m_log.DebugFormat("[EVENT QUEUE GET MODULE]: Invoked GetEvents() for {0}", pAgentId);
390
351 Queue<OSD> queue = TryGetQueue(pAgentId); 391 Queue<OSD> queue = TryGetQueue(pAgentId);
352 OSD element; 392 OSD element;
353 lock (queue) 393 lock (queue)
@@ -370,12 +410,31 @@ namespace OpenSim.Region.ClientStack.Linden
370 } 410 }
371 else 411 else
372 { 412 {
413 if (DebugLevel > 0 && element is OSDMap)
414 {
415 OSDMap ev = (OSDMap)element;
416 m_log.DebugFormat(
417 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
418 ev["message"], m_scene.GetScenePresence(pAgentId).Name);
419 }
420
373 array.Add(element); 421 array.Add(element);
422
374 lock (queue) 423 lock (queue)
375 { 424 {
376 while (queue.Count > 0) 425 while (queue.Count > 0)
377 { 426 {
378 array.Add(queue.Dequeue()); 427 element = queue.Dequeue();
428
429 if (DebugLevel > 0 && element is OSDMap)
430 {
431 OSDMap ev = (OSDMap)element;
432 m_log.DebugFormat(
433 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
434 ev["message"], m_scene.GetScenePresence(pAgentId).Name);
435 }
436
437 array.Add(element);
379 thisID++; 438 thisID++;
380 } 439 }
381 } 440 }
@@ -412,148 +471,166 @@ namespace OpenSim.Region.ClientStack.Linden
412 return responsedata; 471 return responsedata;
413 } 472 }
414 473
415 public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps) 474// public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps)
416 { 475// {
417 // TODO: this has to be redone to not busy-wait (and block the thread), 476// // TODO: this has to be redone to not busy-wait (and block the thread),
418 // TODO: as soon as we have a non-blocking way to handle HTTP-requests. 477// // TODO: as soon as we have a non-blocking way to handle HTTP-requests.
419 478//
420// if (m_log.IsDebugEnabled) 479//// if (m_log.IsDebugEnabled)
421// { 480//// {
422// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ "; 481//// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ ";
423// foreach (object key in request.Keys) 482//// foreach (object key in request.Keys)
483//// {
484//// debug += key.ToString() + "=" + request[key].ToString() + " ";
485//// }
486//// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
487//// }
488//
489// Queue<OSD> queue = TryGetQueue(agentID);
490// OSD element;
491//
492// lock (queue)
493// element = queue.Dequeue(); // 15s timeout
494//
495// Hashtable responsedata = new Hashtable();
496//
497// int thisID = 0;
498// lock (m_ids)
499// thisID = m_ids[agentID];
500//
501// if (element == null)
502// {
503// //m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName);
504// if (thisID == -1) // close-request
424// { 505// {
425// debug += key.ToString() + "=" + request[key].ToString() + " "; 506// m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName);
507// responsedata["int_response_code"] = 404; //501; //410; //404;
508// responsedata["content_type"] = "text/plain";
509// responsedata["keepalive"] = false;
510// responsedata["str_response_string"] = "Closed EQG";
511// return responsedata;
426// } 512// }
427// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name); 513// responsedata["int_response_code"] = 502;
514// responsedata["content_type"] = "text/plain";
515// responsedata["keepalive"] = false;
516// responsedata["str_response_string"] = "Upstream error: ";
517// responsedata["error_status_text"] = "Upstream error:";
518// responsedata["http_protocol_version"] = "HTTP/1.0";
519// return responsedata;
428// } 520// }
429 521//
430 Queue<OSD> queue = TryGetQueue(agentID); 522// OSDArray array = new OSDArray();
431 OSD element; 523// if (element == null) // didn't have an event in 15s
432 524// {
433 lock (queue) 525// // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
434 element = queue.Dequeue(); // 15s timeout 526// array.Add(EventQueueHelper.KeepAliveEvent());
435 527// //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
436 Hashtable responsedata = new Hashtable(); 528// }
437 529// else
438 int thisID = 0; 530// {
439 lock (m_ids) 531// array.Add(element);
440 thisID = m_ids[agentID]; 532//
441 533// if (element is OSDMap)
442 if (element == null) 534// {
443 { 535// OSDMap ev = (OSDMap)element;
444 //m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName); 536// m_log.DebugFormat(
445 if (thisID == -1) // close-request 537// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
446 { 538// ev["message"], m_scene.GetScenePresence(agentID).Name);
447 m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName); 539// }
448 responsedata["int_response_code"] = 404; //501; //410; //404; 540//
449 responsedata["content_type"] = "text/plain"; 541// lock (queue)
450 responsedata["keepalive"] = false; 542// {
451 responsedata["str_response_string"] = "Closed EQG"; 543// while (queue.Count > 0)
452 return responsedata; 544// {
453 } 545// element = queue.Dequeue();
454 responsedata["int_response_code"] = 502; 546//
455 responsedata["content_type"] = "text/plain"; 547// if (element is OSDMap)
456 responsedata["keepalive"] = false; 548// {
457 responsedata["str_response_string"] = "Upstream error: "; 549// OSDMap ev = (OSDMap)element;
458 responsedata["error_status_text"] = "Upstream error:"; 550// m_log.DebugFormat(
459 responsedata["http_protocol_version"] = "HTTP/1.0"; 551// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
460 return responsedata; 552// ev["message"], m_scene.GetScenePresence(agentID).Name);
461 } 553// }
462 554//
463 OSDArray array = new OSDArray(); 555// array.Add(element);
464 if (element == null) // didn't have an event in 15s 556// thisID++;
465 { 557// }
466 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 558// }
467 array.Add(EventQueueHelper.KeepAliveEvent()); 559// }
468 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); 560//
469 } 561// OSDMap events = new OSDMap();
470 else 562// events.Add("events", array);
471 { 563//
472 array.Add(element); 564// events.Add("id", new OSDInteger(thisID));
473 565// lock (m_ids)
474 lock (queue) 566// {
475 { 567// m_ids[agentID] = thisID + 1;
476 while (queue.Count > 0) 568// }
477 { 569//
478 array.Add(queue.Dequeue()); 570// responsedata["int_response_code"] = 200;
479 thisID++; 571// responsedata["content_type"] = "application/xml";
480 } 572// responsedata["keepalive"] = false;
481 } 573// responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
482 } 574//
483 575// m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
484 OSDMap events = new OSDMap(); 576//
485 events.Add("events", array); 577// return responsedata;
486 578// }
487 events.Add("id", new OSDInteger(thisID));
488 lock (m_ids)
489 {
490 m_ids[agentID] = thisID + 1;
491 }
492
493 responsedata["int_response_code"] = 200;
494 responsedata["content_type"] = "application/xml";
495 responsedata["keepalive"] = false;
496 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
497 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
498
499 return responsedata;
500 }
501 579
502 public Hashtable EventQueuePoll(Hashtable request) 580 public Hashtable EventQueuePoll(Hashtable request)
503 { 581 {
504 return new Hashtable(); 582 return new Hashtable();
505 } 583 }
506 584
507 public Hashtable EventQueuePath2(Hashtable request) 585// public Hashtable EventQueuePath2(Hashtable request)
508 { 586// {
509 string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); 587// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
510 // pull off the last "/" in the path. 588// // pull off the last "/" in the path.
511 Hashtable responsedata = new Hashtable(); 589// Hashtable responsedata = new Hashtable();
512 capuuid = capuuid.Substring(0, capuuid.Length - 1); 590// capuuid = capuuid.Substring(0, capuuid.Length - 1);
513 capuuid = capuuid.Replace("/CAPS/EQG/", ""); 591// capuuid = capuuid.Replace("/CAPS/EQG/", "");
514 UUID AvatarID = UUID.Zero; 592// UUID AvatarID = UUID.Zero;
515 UUID capUUID = UUID.Zero; 593// UUID capUUID = UUID.Zero;
516 594//
517 // parse the path and search for the avatar with it registered 595// // parse the path and search for the avatar with it registered
518 if (UUID.TryParse(capuuid, out capUUID)) 596// if (UUID.TryParse(capuuid, out capUUID))
519 { 597// {
520 lock (m_QueueUUIDAvatarMapping) 598// lock (m_QueueUUIDAvatarMapping)
521 { 599// {
522 if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID)) 600// if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID))
523 { 601// {
524 AvatarID = m_QueueUUIDAvatarMapping[capUUID]; 602// AvatarID = m_QueueUUIDAvatarMapping[capUUID];
525 } 603// }
526 } 604// }
527 605//
528 if (AvatarID != UUID.Zero) 606// if (AvatarID != UUID.Zero)
529 { 607// {
530 return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID)); 608// return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID));
531 } 609// }
532 else 610// else
533 { 611// {
534 responsedata["int_response_code"] = 404; 612// responsedata["int_response_code"] = 404;
535 responsedata["content_type"] = "text/plain"; 613// responsedata["content_type"] = "text/plain";
536 responsedata["keepalive"] = false; 614// responsedata["keepalive"] = false;
537 responsedata["str_response_string"] = "Not Found"; 615// responsedata["str_response_string"] = "Not Found";
538 responsedata["error_status_text"] = "Not Found"; 616// responsedata["error_status_text"] = "Not Found";
539 responsedata["http_protocol_version"] = "HTTP/1.0"; 617// responsedata["http_protocol_version"] = "HTTP/1.0";
540 return responsedata; 618// return responsedata;
541 // return 404 619// // return 404
542 } 620// }
543 } 621// }
544 else 622// else
545 { 623// {
546 responsedata["int_response_code"] = 404; 624// responsedata["int_response_code"] = 404;
547 responsedata["content_type"] = "text/plain"; 625// responsedata["content_type"] = "text/plain";
548 responsedata["keepalive"] = false; 626// responsedata["keepalive"] = false;
549 responsedata["str_response_string"] = "Not Found"; 627// responsedata["str_response_string"] = "Not Found";
550 responsedata["error_status_text"] = "Not Found"; 628// responsedata["error_status_text"] = "Not Found";
551 responsedata["http_protocol_version"] = "HTTP/1.0"; 629// responsedata["http_protocol_version"] = "HTTP/1.0";
552 return responsedata; 630// return responsedata;
553 // return 404 631// // return 404
554 } 632// }
555 633// }
556 }
557 634
558 public OSD EventQueueFallBack(string path, OSD request, string endpoint) 635 public OSD EventQueueFallBack(string path, OSD request, string endpoint)
559 { 636 {
@@ -717,6 +794,7 @@ namespace OpenSim.Region.ClientStack.Linden
717 OSD item = EventQueueHelper.GroupMembership(groupUpdate); 794 OSD item = EventQueueHelper.GroupMembership(groupUpdate);
718 Enqueue(item, avatarID); 795 Enqueue(item, avatarID);
719 } 796 }
797
720 public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID) 798 public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID)
721 { 799 {
722 OSD item = EventQueueHelper.PlacesQuery(groupUpdate); 800 OSD item = EventQueueHelper.PlacesQuery(groupUpdate);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 94629a2..10f43d1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -42,18 +42,25 @@ using OpenSim.Capabilities.Handlers;
42 42
43namespace OpenSim.Region.ClientStack.Linden 43namespace OpenSim.Region.ClientStack.Linden
44{ 44{
45 45 /// <summary>
46 /// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities.
47 /// </summary>
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
47 public class WebFetchInvDescModule : INonSharedRegionModule 49 public class WebFetchInvDescModule : INonSharedRegionModule
48 { 50 {
49 private static readonly ILog m_log = 51// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52
51 private Scene m_scene; 53 private Scene m_scene;
52 54
53 private IInventoryService m_InventoryService; 55 private IInventoryService m_InventoryService;
54 private ILibraryService m_LibraryService; 56 private ILibraryService m_LibraryService;
55 private bool m_Enabled = false; 57
56 private string m_URL; 58 private bool m_Enabled;
59
60 private string m_fetchInventoryDescendents2Url;
61 private string m_webFetchInventoryDescendentsUrl;
62
63 private WebFetchInvDescHandler m_webFetchHandler;
57 64
58 #region ISharedRegionModule Members 65 #region ISharedRegionModule Members
59 66
@@ -63,10 +70,13 @@ namespace OpenSim.Region.ClientStack.Linden
63 if (config == null) 70 if (config == null)
64 return; 71 return;
65 72
66 m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); 73 m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty);
67 // Cap doesn't exist 74 m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
68 if (m_URL != string.Empty) 75
76 if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty)
77 {
69 m_Enabled = true; 78 m_Enabled = true;
79 }
70 } 80 }
71 81
72 public void AddRegion(Scene s) 82 public void AddRegion(Scene s)
@@ -91,8 +101,13 @@ namespace OpenSim.Region.ClientStack.Linden
91 if (!m_Enabled) 101 if (!m_Enabled)
92 return; 102 return;
93 103
94 m_InventoryService = m_scene.InventoryService; ; 104 m_InventoryService = m_scene.InventoryService;
95 m_LibraryService = m_scene.LibraryService; 105 m_LibraryService = m_scene.LibraryService;
106
107 // We'll reuse the same handler for all requests.
108 if (m_fetchInventoryDescendents2Url == "localhost" || m_webFetchInventoryDescendentsUrl == "localhost")
109 m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
110
96 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 111 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
97 } 112 }
98 113
@@ -111,24 +126,38 @@ namespace OpenSim.Region.ClientStack.Linden
111 126
112 #endregion 127 #endregion
113 128
114 public void RegisterCaps(UUID agentID, Caps caps) 129 private void RegisterCaps(UUID agentID, Caps caps)
115 { 130 {
116 UUID capID = UUID.Random(); 131 if (m_webFetchInventoryDescendentsUrl != "")
132 RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
117 133
118 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 134 if (m_fetchInventoryDescendents2Url != "")
119 if (m_URL == "localhost") 135 RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url);
136 }
137
138 private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
139 {
140 string capUrl;
141
142 if (url == "localhost")
120 { 143 {
121 m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); 144 capUrl = "/CAPS/" + UUID.Random();
122 WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); 145
123 IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest); 146 IRequestHandler reqHandler
124 caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler); 147 = new RestStreamHandler("POST", capUrl, m_webFetchHandler.FetchInventoryDescendentsRequest);
148
149 caps.RegisterHandler(capName, reqHandler);
125 } 150 }
126 else 151 else
127 { 152 {
128 m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); 153 capUrl = url;
129 caps.RegisterHandler("WebFetchInventoryDescendents", m_URL); 154
155 caps.RegisterHandler(capName, capUrl);
130 } 156 }
131 }
132 157
158// m_log.DebugFormat(
159// "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}",
160// capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
161 }
133 } 162 }
134} 163}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8fdbe7b..3186dff 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11730,7 +11730,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11730 logPacket = false; 11730 logPacket = false;
11731 11731
11732 if (logPacket) 11732 if (logPacket)
11733 m_log.DebugFormat("[CLIENT]: Packet OUT {0} to {1}", packet.Type, Name); 11733 m_log.DebugFormat(
11734 "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
11735 Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
11734 } 11736 }
11735 11737
11736 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method); 11738 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method);
@@ -11773,19 +11775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11773 { 11775 {
11774 if (DebugPacketLevel > 0) 11776 if (DebugPacketLevel > 0)
11775 { 11777 {
11776 bool outputPacket = true; 11778 bool logPacket = true;
11777 11779
11778 if (DebugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) 11780 if (DebugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
11779 outputPacket = false; 11781 logPacket = false;
11780 11782
11781 if (DebugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) 11783 if (DebugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
11782 outputPacket = false; 11784 logPacket = false;
11783 11785
11784 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) 11786 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
11785 outputPacket = false; 11787 logPacket = false;
11786 11788
11787 if (outputPacket) 11789 if (logPacket)
11788 m_log.DebugFormat("[CLIENT]: Packet IN {0} from {1}", packet.Type, Name); 11790 m_log.DebugFormat(
11791 "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",
11792 Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
11789 } 11793 }
11790 11794
11791 if (!ProcessPacketMethod(packet)) 11795 if (!ProcessPacketMethod(packet))
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index c13e9c6..44475a5 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
92 return; 92 return;
93 } 93 }
94 94
95m_log.DebugFormat("MAP NAME=({0})", mapName); 95//m_log.DebugFormat("MAP NAME=({0})", mapName);
96 96
97 // try to fetch from GridServer 97 // try to fetch from GridServer
98 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 98 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 575079f..59170df 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -330,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes
330 } 330 }
331 } 331 }
332 } 332 }
333 } 333 }
334 334
335 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 335 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
336 { 336 {
@@ -487,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
487 // can be handled transparently). 487 // can be handled transparently).
488 InventoryFolderImpl fold = null; 488 InventoryFolderImpl fold = null;
489 if (LibraryService != null && LibraryService.LibraryRootFolder != null) 489 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
490 {
490 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null) 491 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
491 { 492 {
492 remoteClient.SendInventoryFolderDetails( 493 remoteClient.SendInventoryFolderDetails(
@@ -494,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes
494 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems); 495 fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
495 return; 496 return;
496 } 497 }
498 }
497 499
498 // We're going to send the reply async, because there may be 500 // We're going to send the reply async, because there may be
499 // an enormous quantity of packets -- basically the entire inventory! 501 // an enormous quantity of packets -- basically the entire inventory!
@@ -514,64 +516,6 @@ namespace OpenSim.Region.Framework.Scenes
514 SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; 516 SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState;
515 d.EndInvoke(iar); 517 d.EndInvoke(iar);
516 } 518 }
517
518 /// <summary>
519 /// Handle the caps inventory descendents fetch.
520 ///
521 /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
522 /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
523 /// </summary>
524 /// <param name="agentID"></param>
525 /// <param name="folderID"></param>
526 /// <param name="ownerID"></param>
527 /// <param name="fetchFolders"></param>
528 /// <param name="fetchItems"></param>
529 /// <param name="sortOrder"></param>
530 /// <returns>null if the inventory look up failed</returns>
531 public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
532 bool fetchFolders, bool fetchItems, int sortOrder, out int version)
533 {
534 m_log.DebugFormat(
535 "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
536 fetchFolders, fetchItems, folderID, agentID);
537
538 // FIXME MAYBE: We're not handling sortOrder!
539
540 // TODO: This code for looking in the folder for the library should be folded back into the
541 // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
542 // can be handled transparently).
543 InventoryFolderImpl fold;
544 if (LibraryService != null && LibraryService.LibraryRootFolder != null)
545 if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
546 {
547 version = 0;
548 InventoryCollection ret = new InventoryCollection();
549 ret.Folders = new List<InventoryFolderBase>();
550 ret.Items = fold.RequestListOfItems();
551
552 return ret;
553 }
554
555 InventoryCollection contents = new InventoryCollection();
556
557 if (folderID != UUID.Zero)
558 {
559 contents = InventoryService.GetFolderContent(agentID, folderID);
560 InventoryFolderBase containingFolder = new InventoryFolderBase();
561 containingFolder.ID = folderID;
562 containingFolder.Owner = agentID;
563 containingFolder = InventoryService.GetFolder(containingFolder);
564 version = containingFolder.Version;
565 }
566 else
567 {
568 // Lost itemsm don't really need a version
569 version = 1;
570 }
571
572 return contents;
573
574 }
575 519
576 /// <summary> 520 /// <summary>
577 /// Handle an inventory folder creation request from the client. 521 /// Handle an inventory folder creation request from the client.
@@ -646,14 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
646 } 590 }
647 } 591 }
648 592
593 delegate void PurgeFolderDelegate(UUID userID, UUID folder);
594
649 /// <summary> 595 /// <summary>
650 /// This should delete all the items and folders in the given directory. 596 /// This should delete all the items and folders in the given directory.
651 /// </summary> 597 /// </summary>
652 /// <param name="remoteClient"></param> 598 /// <param name="remoteClient"></param>
653 /// <param name="folderID"></param> 599 /// <param name="folderID"></param>
654
655 delegate void PurgeFolderDelegate(UUID userID, UUID folder);
656
657 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) 600 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
658 { 601 {
659 PurgeFolderDelegate d = PurgeFolderAsync; 602 PurgeFolderDelegate d = PurgeFolderAsync;
@@ -667,7 +610,6 @@ namespace OpenSim.Region.Framework.Scenes
667 } 610 }
668 } 611 }
669 612
670
671 private void PurgeFolderAsync(UUID userID, UUID folderID) 613 private void PurgeFolderAsync(UUID userID, UUID folderID)
672 { 614 {
673 InventoryFolderBase folder = new InventoryFolderBase(folderID, userID); 615 InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c581b5f..df84cc4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4834,9 +4834,6 @@ namespace OpenSim.Region.Framework.Scenes
4834 4834
4835 public Vector3? GetNearestAllowedPosition(ScenePresence avatar) 4835 public Vector3? GetNearestAllowedPosition(ScenePresence avatar)
4836 { 4836 {
4837 //simulate to make sure we have pretty up to date positions
4838 PhysicsScene.Simulate(0);
4839
4840 ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 4837 ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
4841 4838
4842 if (nearestParcel != null) 4839 if (nearestParcel != null)
@@ -4863,12 +4860,13 @@ namespace OpenSim.Region.Framework.Scenes
4863 //Ultimate backup if we have no idea where they are 4860 //Ultimate backup if we have no idea where they are
4864 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 4861 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
4865 return avatar.lastKnownAllowedPosition; 4862 return avatar.lastKnownAllowedPosition;
4866
4867 } 4863 }
4868 4864
4869 //Go to the edge, this happens in teleporting to a region with no available parcels 4865 //Go to the edge, this happens in teleporting to a region with no available parcels
4870 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 4866 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
4867
4871 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 4868 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
4869
4872 return nearestRegionEdgePoint; 4870 return nearestRegionEdgePoint;
4873 } 4871 }
4874 4872
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index eeb087f..82458e2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -448,29 +448,25 @@ namespace OpenSim.Region.Framework.Scenes
448 } 448 }
449 449
450 /// <summary> 450 /// <summary>
451 /// Set the debug packet level on the current scene. This level governs which packets are printed out to the 451 /// Set the debug packet level on each current scene. This level governs which packets are printed out to the
452 /// console. 452 /// console.
453 /// </summary> 453 /// </summary>
454 /// <param name="newDebug"></param> 454 /// <param name="newDebug"></param>
455 /// <param name="name">Name of avatar to debug</param> 455 /// <param name="name">Name of avatar to debug</param>
456 public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) 456 public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name)
457 { 457 {
458 ForEachCurrentScene( 458 ForEachCurrentScene(scene =>
459 delegate(Scene scene) 459 scene.ForEachScenePresence(sp =>
460 { 460 {
461 scene.ForEachRootClient(delegate(IClientAPI client) 461 if (name == null || sp.Name == name)
462 { 462 {
463 if (name == null || client.Name == name) 463 m_log.DebugFormat(
464 { 464 "Packet debug for {0} ({1}) set to {2}",
465 m_log.DebugFormat("Packet debug for {0} {1} set to {2}", 465 sp.Name, sp.IsChildAgent ? "child" : "root", newDebug);
466 client.FirstName,
467 client.LastName,
468 newDebug);
469 466
470 client.DebugPacketLevel = newDebug; 467 sp.ControllingClient.DebugPacketLevel = newDebug;
471 } 468 }
472 }); 469 })
473 }
474 ); 470 );
475 } 471 }
476 472
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index c485e87..2335ad5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1085,8 +1085,8 @@ namespace OpenSim.Region.Framework.Scenes
1085 invString.AddNameValueLine("asset_id", item.AssetID.ToString()); 1085 invString.AddNameValueLine("asset_id", item.AssetID.ToString());
1086 else 1086 else
1087 invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); 1087 invString.AddNameValueLine("asset_id", UUID.Zero.ToString());
1088 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); 1088 invString.AddNameValueLine("type", Utils.AssetTypeToString((AssetType)item.Type));
1089 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); 1089 invString.AddNameValueLine("inv_type", Utils.InventoryTypeToString((InventoryType)item.InvType));
1090 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); 1090 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
1091 1091
1092 invString.AddSaleStart(); 1092 invString.AddSaleStart();
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 1f631ee..514d9ad 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.Manager
56 56
57 public abstract class PhysicsScene 57 public abstract class PhysicsScene
58 { 58 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 60
61 /// <summary> 61 /// <summary>
62 /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. 62 /// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another.
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 489a23a..73c1c02 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Physics.OdePlugin
86 private float CAPSULE_RADIUS = 0.37f; 86 private float CAPSULE_RADIUS = 0.37f;
87 private float CAPSULE_LENGTH = 2.140599f; 87 private float CAPSULE_LENGTH = 2.140599f;
88 private float m_tensor = 3800000f; 88 private float m_tensor = 3800000f;
89 private float heightFudgeFactor = 0.52f; 89// private float heightFudgeFactor = 0.52f;
90 private float walkDivisor = 1.3f; 90 private float walkDivisor = 1.3f;
91 private float runDivisor = 0.8f; 91 private float runDivisor = 0.8f;
92 private bool flying = false; 92 private bool flying = false;
@@ -149,7 +149,7 @@ namespace OpenSim.Region.Physics.OdePlugin
149 149
150 public OdeCharacter( 150 public OdeCharacter(
151 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, 151 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
152 float capsule_radius, float tensor, float density, float height_fudge_factor, 152 float capsule_radius, float tensor, float density,
153 float walk_divisor, float rundivisor) 153 float walk_divisor, float rundivisor)
154 { 154 {
155 m_uuid = UUID.Random(); 155 m_uuid = UUID.Random();
@@ -187,7 +187,7 @@ namespace OpenSim.Region.Physics.OdePlugin
187 CAPSULE_RADIUS = capsule_radius; 187 CAPSULE_RADIUS = capsule_radius;
188 m_tensor = tensor; 188 m_tensor = tensor;
189 m_density = density; 189 m_density = density;
190 heightFudgeFactor = height_fudge_factor; 190// heightFudgeFactor = height_fudge_factor;
191 walkDivisor = walk_divisor; 191 walkDivisor = walk_divisor;
192 runDivisor = rundivisor; 192 runDivisor = rundivisor;
193 193
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 0456f56..5b28e7c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Physics.OdePlugin
156 private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode 156 private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode
157 public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } } 157 public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } }
158 private float avDensity = 80f; 158 private float avDensity = 80f;
159 private float avHeightFudgeFactor = 0.52f; 159// private float avHeightFudgeFactor = 0.52f;
160 private float avMovementDivisorWalk = 1.3f; 160 private float avMovementDivisorWalk = 1.3f;
161 private float avMovementDivisorRun = 0.8f; 161 private float avMovementDivisorRun = 0.8f;
162 private float minimumGroundFlightOffset = 3f; 162 private float minimumGroundFlightOffset = 3f;
@@ -316,7 +316,7 @@ namespace OpenSim.Region.Physics.OdePlugin
316 private int m_physicsiterations = 10; 316 private int m_physicsiterations = 10;
317 private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 317 private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
318 private readonly PhysicsActor PANull = new NullPhysicsActor(); 318 private readonly PhysicsActor PANull = new NullPhysicsActor();
319 private float step_time = 0.0f; 319// private float step_time = 0.0f;
320//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 320//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
321//Ckrinke private int ms = 0; 321//Ckrinke private int ms = 0;
322 public IntPtr world; 322 public IntPtr world;
@@ -479,7 +479,7 @@ namespace OpenSim.Region.Physics.OdePlugin
479 m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10); 479 m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10);
480 480
481 avDensity = physicsconfig.GetFloat("av_density", 80f); 481 avDensity = physicsconfig.GetFloat("av_density", 80f);
482 avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f); 482// avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f);
483 avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); 483 avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f);
484 avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); 484 avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f);
485 avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); 485 avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f);
@@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1706 OdeCharacter newAv 1706 OdeCharacter newAv
1707 = new OdeCharacter( 1707 = new OdeCharacter(
1708 avName, this, pos, size, avPIDD, avPIDP, 1708 avName, this, pos, size, avPIDD, avPIDP,
1709 avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, 1709 avCapRadius, avStandupTensor, avDensity,
1710 avMovementDivisorWalk, avMovementDivisorRun); 1710 avMovementDivisorWalk, avMovementDivisorRun);
1711 1711
1712 newAv.Flying = isFlying; 1712 newAv.Flying = isFlying;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 04f10c6..7518d01 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8695,6 +8695,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8695 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8695 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8696 res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); 8696 res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W));
8697 break; 8697 break;
8698 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
8699 res.Add(new LSL_Vector(GetPartLocalPos(part)));
8700 break;
8698 } 8701 }
8699 } 8702 }
8700 return res; 8703 return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index ed5a2fe..4da8fe7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -140,7 +140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
140 List<SenseRepeatClass> NewSensors = new List<SenseRepeatClass>(); 140 List<SenseRepeatClass> NewSensors = new List<SenseRepeatClass>();
141 foreach (SenseRepeatClass ts in SenseRepeaters) 141 foreach (SenseRepeatClass ts in SenseRepeaters)
142 { 142 {
143 if (ts.localID != m_localID && ts.itemID != m_itemID) 143 if (ts.localID != m_localID || ts.itemID != m_itemID)
144 { 144 {
145 NewSensors.Add(ts); 145 NewSensors.Add(ts);
146 } 146 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index a1cf3df..0ad3f78 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -323,6 +323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
323 public const int PRIM_DESC = 28; 323 public const int PRIM_DESC = 28;
324 public const int PRIM_ROT_LOCAL = 29; 324 public const int PRIM_ROT_LOCAL = 29;
325 public const int PRIM_OMEGA = 32; 325 public const int PRIM_OMEGA = 32;
326 public const int PRIM_POS_LOCAL = 33;
326 public const int PRIM_LINK_TARGET = 34; 327 public const int PRIM_LINK_TARGET = 34;
327 public const int PRIM_TEXGEN_DEFAULT = 0; 328 public const int PRIM_TEXGEN_DEFAULT = 0;
328 public const int PRIM_TEXGEN_PLANAR = 1; 329 public const int PRIM_TEXGEN_PLANAR = 1;
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 35b43f4..035980d 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Services.LLLoginService
81 protected string m_DeniedClients; 81 protected string m_DeniedClients;
82 82
83 IConfig m_LoginServerConfig; 83 IConfig m_LoginServerConfig;
84 IConfig m_ClientsConfig; 84// IConfig m_ClientsConfig;
85 85
86 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) 86 public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
87 { 87 {
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
new file mode 100644
index 0000000..9a9371d
--- /dev/null
+++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using System;
30using System.Collections.Generic;
31using System.Linq;
32using pCampBot.Interfaces;
33
34namespace pCampBot
35{
36 public class AbstractBehaviour : IBehaviour
37 {
38 public string Name { get; protected set; }
39
40 public Bot Bot { get; protected set; }
41
42 public virtual void Action() {}
43
44 public virtual void Initialize(Bot bot)
45 {
46 Bot = bot;
47 }
48 }
49}
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
new file mode 100644
index 0000000..1e01c64
--- /dev/null
+++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs
@@ -0,0 +1,169 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using pCampBot.Interfaces;
36
37namespace pCampBot
38{
39 /// <summary>
40 /// Get the bot to make a region crossing.
41 /// </summary>
42 public class CrossBehaviour : AbstractBehaviour
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 public AutoResetEvent m_regionCrossedMutex = new AutoResetEvent(false);
47
48 public const int m_regionCrossingTimeout = 1000 * 60;
49
50 public CrossBehaviour() { Name = "Cross"; }
51
52 public override void Action()
53 {
54 GridClient client = Bot.Client;
55
56// // Fly to make the border cross easier.
57// client.Self.Movement.Fly = true;
58// client.Self.Movement.Fly = false;
59
60 // Seek out neighbouring region
61 Simulator currentSim = client.Network.CurrentSim;
62 ulong currentHandle = currentSim.Handle;
63 uint currentX, currentY;
64 Utils.LongToUInts(currentHandle, out currentX, out currentY);
65
66 List<GridRegion> candidateRegions = new List<GridRegion>();
67 TryAddRegion(Utils.UIntsToLong(Math.Max(0, currentX - Constants.RegionSize), currentY), candidateRegions); // West
68 TryAddRegion(Utils.UIntsToLong(currentX + Constants.RegionSize, currentY), candidateRegions); // East
69 TryAddRegion(Utils.UIntsToLong(currentX, Math.Max(0, currentY - Constants.RegionSize)), candidateRegions); // South
70 TryAddRegion(Utils.UIntsToLong(currentX, currentY + Constants.RegionSize), candidateRegions); // North
71
72 if (candidateRegions.Count != 0)
73 {
74 GridRegion destRegion = candidateRegions[Bot.Manager.Rng.Next(candidateRegions.Count)];
75
76 uint targetX, targetY;
77 Utils.LongToUInts(destRegion.RegionHandle, out targetX, out targetY);
78
79 Vector3 pos = client.Self.SimPosition;
80 if (targetX < currentX)
81 pos.X = -1;
82 else if (targetX > currentX)
83 pos.X = Constants.RegionSize + 1;
84
85 if (targetY < currentY)
86 pos.Y = -1;
87 else if (targetY > currentY)
88 pos.Y = Constants.RegionSize + 1;
89
90 m_log.DebugFormat(
91 "[CROSS BEHAVIOUR]: {0} moving to cross from {1} into {2}, target {3}",
92 Bot.Name, currentSim.Name, destRegion.Name, pos);
93
94 // Face in the direction of the candidate region
95 client.Self.Movement.TurnToward(pos);
96
97 // Listen for event so that we know when we've crossed the region boundary
98 Bot.Client.Self.RegionCrossed += Self_RegionCrossed;
99
100 // Start moving
101 Bot.Client.Self.Movement.AtPos = true;
102
103 // Stop when reach region target or border cross detected
104 if (!m_regionCrossedMutex.WaitOne(m_regionCrossingTimeout))
105 {
106 m_log.ErrorFormat(
107 "[CROSS BEHAVIOUR]: {0} failed to cross from {1} into {2} with {3}ms",
108 Bot.Name, currentSim.Name, destRegion.Name, m_regionCrossingTimeout);
109 }
110 else
111 {
112 m_log.DebugFormat(
113 "[CROSS BEHAVIOUR]: {0} crossed from {1} into {2}",
114 Bot.Name, currentSim.Name, destRegion.Name);
115 }
116
117 Bot.Client.Self.RegionCrossed -= Self_RegionCrossed;
118
119 // We will hackishly carry on travelling into the region for a little bit.
120 Thread.Sleep(6000);
121
122 m_log.DebugFormat(
123 "[CROSS BEHAVIOUR]: {0} stopped moving after cross from {1} into {2}",
124 Bot.Name, currentSim.Name, destRegion.Name);
125
126 Bot.Client.Self.Movement.AtPos = false;
127 }
128 else
129 {
130 m_log.DebugFormat(
131 "[CROSS BEHAVIOUR]: No candidate region for {0} to cross into from {1}. Ignoring.",
132 Bot.Name, currentSim.Name);
133 }
134 }
135
136 private bool TryAddRegion(ulong handle, List<GridRegion> regions)
137 {
138 Dictionary<ulong, GridRegion> knownRegions = Bot.Manager.RegionsKnown;
139
140 lock (knownRegions)
141 {
142 if (knownRegions.Count == 0)
143 return false;
144
145 m_log.DebugFormat("[CROSS BEHAVIOUR]: Looking for region with handle {0} in known regions", handle);
146
147 if (knownRegions.ContainsKey(handle))
148 {
149 GridRegion region = knownRegions[handle];
150 m_log.DebugFormat(
151 "[CROSS BEHAVIOUR]: Adding region {0} to crossing candidates for {1}", region.Name, Bot.Name);
152
153 regions.Add(region);
154
155 return true;
156 }
157 else
158 {
159 return false;
160 }
161 }
162 }
163
164 internal void Self_RegionCrossed(object o, RegionCrossedEventArgs args)
165 {
166 m_regionCrossedMutex.Set();
167 }
168 }
169} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
index 0a6d5d2..6ad02b2 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs
@@ -39,20 +39,20 @@ namespace pCampBot
39 /// <remarks> 39 /// <remarks>
40 /// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable. 40 /// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
41 /// </remarks> 41 /// </remarks>
42 public class GrabbingBehaviour : IBehaviour 42 public class GrabbingBehaviour : AbstractBehaviour
43 { 43 {
44 public string Name { get { return "Grabbing"; } } 44 public GrabbingBehaviour() { Name = "Grabbing"; }
45 45
46 public void Action(Bot bot) 46 public override void Action()
47 { 47 {
48 Dictionary<UUID, Primitive> objects = bot.Objects; 48 Dictionary<UUID, Primitive> objects = Bot.Objects;
49 49
50 Primitive prim = objects.ElementAt(bot.Random.Next(0, objects.Count)).Value; 50 Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count)).Value;
51 51
52 // This appears to be a typical message sent when a viewer user clicks a clickable object 52 // This appears to be a typical message sent when a viewer user clicks a clickable object
53 bot.Client.Self.Grab(prim.LocalID); 53 Bot.Client.Self.Grab(prim.LocalID);
54 bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); 54 Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
55 bot.Client.Self.DeGrab(prim.LocalID); 55 Bot.Client.Self.DeGrab(prim.LocalID);
56 } 56 }
57 } 57 }
58} \ No newline at end of file 58} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
index f782bb5..daa7485 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs
@@ -40,43 +40,41 @@ namespace pCampBot
40 /// <remarks> 40 /// <remarks>
41 /// TODO: talkarray should be in a separate behaviour. 41 /// TODO: talkarray should be in a separate behaviour.
42 /// </remarks> 42 /// </remarks>
43 public class PhysicsBehaviour : IBehaviour 43 public class PhysicsBehaviour : AbstractBehaviour
44 { 44 {
45 public string Name { get { return "Physics"; } }
46
47 private string[] talkarray; 45 private string[] talkarray;
48 46
49 public PhysicsBehaviour() 47 public PhysicsBehaviour()
50 { 48 {
49 Name = "Physics";
51 talkarray = readexcuses(); 50 talkarray = readexcuses();
52 } 51 }
53 52
54 public void Action(Bot bot) 53 public override void Action()
55 { 54 {
56 int walkorrun = bot.Random.Next(4); // Randomize between walking and running. The greater this number, 55 int walkorrun = Bot.Random.Next(4); // Randomize between walking and running. The greater this number,
57 // the greater the bot's chances to walk instead of run. 56 // the greater the bot's chances to walk instead of run.
58 bot.Client.Self.Jump(false); 57 Bot.Client.Self.Jump(false);
59 if (walkorrun == 0) 58 if (walkorrun == 0)
60 { 59 {
61 bot.Client.Self.Movement.AlwaysRun = true; 60 Bot.Client.Self.Movement.AlwaysRun = true;
62 } 61 }
63 else 62 else
64 { 63 {
65 bot.Client.Self.Movement.AlwaysRun = false; 64 Bot.Client.Self.Movement.AlwaysRun = false;
66 } 65 }
67 66
68 // TODO: unused: Vector3 pos = client.Self.SimPosition; 67 // TODO: unused: Vector3 pos = client.Self.SimPosition;
69 Vector3 newpos = new Vector3(bot.Random.Next(1, 254), bot.Random.Next(1, 254), bot.Random.Next(1, 254)); 68 Vector3 newpos = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Random.Next(1, 254));
70 bot.Client.Self.Movement.TurnToward(newpos); 69 Bot.Client.Self.Movement.TurnToward(newpos);
71
72 bot.Client.Self.Movement.AtPos = true;
73 Thread.Sleep(bot.Random.Next(3000, 13000));
74 bot.Client.Self.Movement.AtPos = false;
75 bot.Client.Self.Jump(true);
76 70
77 string randomf = talkarray[bot.Random.Next(talkarray.Length)]; 71 Bot.Client.Self.Movement.AtPos = true;
72 Thread.Sleep(Bot.Random.Next(3000, 13000));
73 Bot.Client.Self.Movement.AtPos = false;
74 Bot.Client.Self.Jump(true);
75 string randomf = talkarray[Bot.Random.Next(talkarray.Length)];
78 if (talkarray.Length > 1 && randomf.Length > 1) 76 if (talkarray.Length > 1 && randomf.Length > 1)
79 bot.Client.Self.Chat(randomf, 0, ChatType.Normal); 77 Bot.Client.Self.Chat(randomf, 0, ChatType.Normal);
80 } 78 }
81 79
82 private string[] readexcuses() 80 private string[] readexcuses()
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
index fc2ed2c..fbb4e96 100644
--- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs
@@ -38,38 +38,38 @@ namespace pCampBot
38 /// <summary> 38 /// <summary>
39 /// Teleport to a random region on the grid. 39 /// Teleport to a random region on the grid.
40 /// </summary> 40 /// </summary>
41 public class TeleportBehaviour : IBehaviour 41 public class TeleportBehaviour : AbstractBehaviour
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 public string Name { get { return "Teleport"; } } 45 public TeleportBehaviour() { Name = "Teleport"; }
46 46
47 public void Action(Bot bot) 47 public override void Action()
48 { 48 {
49 Random rng = bot.Manager.Rng; 49 Random rng = Bot.Manager.Rng;
50 GridRegion[] knownRegions; 50 GridRegion[] knownRegions;
51 51
52 lock (bot.Manager.RegionsKnown) 52 lock (Bot.Manager.RegionsKnown)
53 { 53 {
54 if (bot.Manager.RegionsKnown.Count == 0) 54 if (Bot.Manager.RegionsKnown.Count == 0)
55 { 55 {
56 m_log.DebugFormat( 56 m_log.DebugFormat(
57 "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", bot.Name); 57 "[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", Bot.Name);
58 return; 58 return;
59 } 59 }
60 60
61 knownRegions = bot.Manager.RegionsKnown.Values.ToArray(); 61 knownRegions = Bot.Manager.RegionsKnown.Values.ToArray();
62 } 62 }
63 63
64 Simulator sourceRegion = bot.Client.Network.CurrentSim; 64 Simulator sourceRegion = Bot.Client.Network.CurrentSim;
65 GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)]; 65 GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)];
66 Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50); 66 Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50);
67 67
68 m_log.DebugFormat( 68 m_log.DebugFormat(
69 "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}", 69 "[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}",
70 bot.Name, sourceRegion.Name, bot.Client.Self.SimPosition, destRegion.Name, destPosition); 70 Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);
71 71
72 bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); 72 Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
73 } 73 }
74 } 74 }
75} \ No newline at end of file 75} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/Bot.cs b/OpenSim/Tools/pCampBot/Bot.cs
index 7a73e3f..0bd0bcc 100644
--- a/OpenSim/Tools/pCampBot/Bot.cs
+++ b/OpenSim/Tools/pCampBot/Bot.cs
@@ -130,6 +130,8 @@ namespace pCampBot
130 BotManager bm, List<IBehaviour> behaviours, 130 BotManager bm, List<IBehaviour> behaviours,
131 string firstName, string lastName, string password, string loginUri) 131 string firstName, string lastName, string password, string loginUri)
132 { 132 {
133 behaviours.ForEach(b => b.Initialize(this));
134
133 Client = new GridClient(); 135 Client = new GridClient();
134 136
135 Random = new Random(Environment.TickCount);// We do stuff randomly here 137 Random = new Random(Environment.TickCount);// We do stuff randomly here
@@ -156,7 +158,7 @@ namespace pCampBot
156 b => 158 b =>
157 { 159 {
158 // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType()); 160 // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
159 b.Action(this); 161 b.Action();
160 162
161 Thread.Sleep(Random.Next(1000, 10000)); 163 Thread.Sleep(Random.Next(1000, 10000));
162 } 164 }
@@ -226,8 +228,6 @@ namespace pCampBot
226 MakeDefaultAppearance(wear); 228 MakeDefaultAppearance(wear);
227 } 229 }
228 230
229 Client.Self.Jump(true);
230
231 // Extract nearby region information. 231 // Extract nearby region information.
232 Client.Grid.GridRegion += Manager.Grid_GridRegion; 232 Client.Grid.GridRegion += Manager.Grid_GridRegion;
233 uint xUint, yUint; 233 uint xUint, yUint;
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 29cb1ba..6481e97 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -151,26 +151,29 @@ namespace pCampBot
151 Array.ForEach<string>( 151 Array.ForEach<string>(
152 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b)); 152 cs.GetString("behaviours", "p").Split(new char[] { ',' }), b => behaviourSwitches.Add(b));
153 153
154 List<IBehaviour> behaviours = new List<IBehaviour>();
155
156 // Hard-coded for now
157 if (behaviourSwitches.Contains("p"))
158 behaviours.Add(new PhysicsBehaviour());
159
160 if (behaviourSwitches.Contains("g"))
161 behaviours.Add(new GrabbingBehaviour());
162
163 if (behaviourSwitches.Contains("t"))
164 behaviours.Add(new TeleportBehaviour());
165
166 MainConsole.Instance.OutputFormat(
167 "[BOT MANAGER]: Bots configured for behaviours {0}",
168 string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
169
170 for (int i = 0; i < botcount; i++) 154 for (int i = 0; i < botcount; i++)
171 { 155 {
172 string lastName = string.Format("{0}_{1}", lastNameStem, i); 156 string lastName = string.Format("{0}_{1}", lastNameStem, i);
173 157
158 List<IBehaviour> behaviours = new List<IBehaviour>();
159
160 // Hard-coded for now
161 if (behaviourSwitches.Contains("p"))
162 behaviours.Add(new PhysicsBehaviour());
163
164 if (behaviourSwitches.Contains("g"))
165 behaviours.Add(new GrabbingBehaviour());
166
167 if (behaviourSwitches.Contains("t"))
168 behaviours.Add(new TeleportBehaviour());
169
170 if (behaviourSwitches.Contains("c"))
171 behaviours.Add(new CrossBehaviour());
172
173 MainConsole.Instance.OutputFormat(
174 "[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
175 firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
176
174 StartBot(this, behaviours, firstName, lastName, password, loginUri); 177 StartBot(this, behaviours, firstName, lastName, password, loginUri);
175 } 178 }
176 } 179 }
diff --git a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
index 912216f..9c984be 100644
--- a/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
+++ b/OpenSim/Tools/pCampBot/Interfaces/IBehaviour.cs
@@ -37,9 +37,18 @@ namespace pCampBot.Interfaces
37 string Name { get; } 37 string Name { get; }
38 38
39 /// <summary> 39 /// <summary>
40 /// Initialize the behaviour for this bot.
41 /// </summary>
42 /// <remarks>
43 /// This must be invoked before Action() is called.
44 /// </remarks>
45 /// <param name="bot"></param>
46 void Initialize(Bot bot);
47
48 /// <summary>
40 /// Action to take when this behaviour is invoked. 49 /// Action to take when this behaviour is invoked.
41 /// </summary> 50 /// </summary>
42 /// <param name="bot"></param> 51 /// <param name="bot"></param>
43 void Action(Bot bot); 52 void Action();
44 } 53 }
45} \ No newline at end of file 54} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index e7288d5..3f43cff 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -104,17 +104,21 @@ namespace pCampBot
104 // name, to load an specific folder, or save, to save an avatar with some already existing wearables 104 // name, to load an specific folder, or save, to save an avatar with some already existing wearables
105 // worn to the folder MyAppearance/FirstName_LastName, and the load it. 105 // worn to the folder MyAppearance/FirstName_LastName, and the load it.
106 Console.WriteLine( 106 Console.WriteLine(
107 "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + 107 "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
108 "Spawns a set of bots to test an OpenSim region\n\n" + 108 "Spawns a set of bots to test an OpenSim region\n\n" +
109 " -l, -loginuri loginuri for sim to log into (required)\n" + 109 " -l, -loginuri loginuri for sim to log into (required)\n" +
110 " -n, -botcount number of bots to start (default: 1)\n" + 110 " -n, -botcount number of bots to start (default: 1)\n" +
111 " -firstname first name for the bots\n" + 111 " -firstname first name for the bots\n" +
112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" + 112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
113 " -password password for the bots\n" + 113 " -password password for the bots\n" +
114 " -b, behaviours behaviours for bots. Current options p (physics), g (grab), t (teleport). Comma separated, e.g. p,g. Default is p", 114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n",
115 " -wear set appearance folder to load from (default: no)\n" + 115 " current options are:" +
116 " -h, -help show this message" 116 " p (physics)" +
117 ); 117 " g (grab)" +
118 " t (teleport)" +
119// " c (cross)" +
120 " -wear set appearance folder to load from (default: no)\n" +
121 " -h, -help show this message");
118 } 122 }
119 } 123 }
120} 124}