aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2013-03-07 06:41:03 -0800
committerDiva Canto2013-03-07 06:41:03 -0800
commitfdebee25db35174468e19d0f6ed8931797c1f000 (patch)
tree3d38c72fb40e2bf7a457343c1ad724b5c46e9dfd
parentFixed inconsistency in comments. Thanks Ai Austin. (diff)
parentminor: remove some completely unused string local vars added recently in comm... (diff)
downloadopensim-SC_OLD-fdebee25db35174468e19d0f6ed8931797c1f000.zip
opensim-SC_OLD-fdebee25db35174468e19d0f6ed8931797c1f000.tar.gz
opensim-SC_OLD-fdebee25db35174468e19d0f6ed8931797c1f000.tar.bz2
opensim-SC_OLD-fdebee25db35174468e19d0f6ed8931797c1f000.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs17
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs299
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs9
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs103
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs157
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs39
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs36
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs39
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs50
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs178
-rwxr-xr-xbin/OpenMetaverse.StructuredData.dllbin102400 -> 114688 bytes
-rwxr-xr-xbin/OpenMetaverse.dllbin1765376 -> 1925120 bytes
-rwxr-xr-xbin/OpenMetaverseTypes.dllbin114688 -> 122880 bytes
-rw-r--r--prebuild.xml1
26 files changed, 718 insertions, 313 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 70c531c..58312ab 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1912,6 +1912,12 @@ namespace OpenSim.Framework.Servers.HttpServer
1912 m_rpcHandlers.Remove(method); 1912 m_rpcHandlers.Remove(method);
1913 } 1913 }
1914 1914
1915 public void RemoveJsonRPCHandler(string method)
1916 {
1917 lock(jsonRpcHandlers)
1918 jsonRpcHandlers.Remove(method);
1919 }
1920
1915 public bool RemoveLLSDHandler(string path, LLSDMethod handler) 1921 public bool RemoveLLSDHandler(string path, LLSDMethod handler)
1916 { 1922 {
1917 lock (m_llsdHandlers) 1923 lock (m_llsdHandlers)
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index 71ca3ff..d162bc1 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -140,6 +140,8 @@ namespace OpenSim.Framework.Servers.HttpServer
140 void RemoveStreamHandler(string httpMethod, string path); 140 void RemoveStreamHandler(string httpMethod, string path);
141 141
142 void RemoveXmlRPCHandler(string method); 142 void RemoveXmlRPCHandler(string method);
143
144 void RemoveJsonRPCHandler(string method);
143 145
144 string GetHTTP404(string host); 146 string GetHTTP404(string host);
145 147
diff --git a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs
index bb8825b..ee96b47 100644
--- a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs
@@ -108,6 +108,7 @@ namespace OpenSim.Framework.Servers.HttpServer
108 private int _bufferLength; 108 private int _bufferLength;
109 private bool _closing; 109 private bool _closing;
110 private bool _upgraded; 110 private bool _upgraded;
111 private int _maxPayloadBytes = 41943040;
111 112
112 private const string HandshakeAcceptText = 113 private const string HandshakeAcceptText =
113 "HTTP/1.1 101 Switching Protocols\r\n" + 114 "HTTP/1.1 101 Switching Protocols\r\n" +
@@ -196,6 +197,15 @@ namespace OpenSim.Framework.Servers.HttpServer
196 } 197 }
197 198
198 /// <summary> 199 /// <summary>
200 /// Max Payload Size in bytes. Defaults to 40MB, but could be set upon connection before calling handshake and upgrade.
201 /// </summary>
202 public int MaxPayloadSize
203 {
204 get { return _maxPayloadBytes; }
205 set { _maxPayloadBytes = value; }
206 }
207
208 /// <summary>
199 /// This triggers the websocket start the upgrade process 209 /// This triggers the websocket start the upgrade process
200 /// </summary> 210 /// </summary>
201 public void HandshakeAndUpgrade() 211 public void HandshakeAndUpgrade()
@@ -367,7 +377,12 @@ namespace OpenSim.Framework.Servers.HttpServer
367 if (headerread) 377 if (headerread)
368 { 378 {
369 _socketState.FrameComplete = false; 379 _socketState.FrameComplete = false;
370 380 if (pheader.PayloadLen > (ulong) _maxPayloadBytes)
381 {
382 Close("Invalid Payload size");
383
384 return;
385 }
371 if (pheader.PayloadLen > 0) 386 if (pheader.PayloadLen > 0)
372 { 387 {
373 if ((int) pheader.PayloadLen > _bufferPosition - offset) 388 if ((int) pheader.PayloadLen > _bufferPosition - offset)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
index 33b1f77..45d33cd 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/MeshUploadFlagModule.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Region.ClientStack.Linden
57 public bool Enabled { get; private set; } 57 public bool Enabled { get; private set; }
58 58
59 private Scene m_scene; 59 private Scene m_scene;
60 private UUID m_agentID;
61 60
62 #region ISharedRegionModule Members 61 #region ISharedRegionModule Members
63 62
@@ -118,25 +117,26 @@ namespace OpenSim.Region.ClientStack.Linden
118 public void RegisterCaps(UUID agentID, Caps caps) 117 public void RegisterCaps(UUID agentID, Caps caps)
119 { 118 {
120 IRequestHandler reqHandler 119 IRequestHandler reqHandler
121 = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), MeshUploadFlag, "MeshUploadFlag", agentID.ToString()); 120 = new RestHTTPHandler(
121 "GET", "/CAPS/" + UUID.Random(), ht => MeshUploadFlag(ht, agentID), "MeshUploadFlag", agentID.ToString());
122 122
123 caps.RegisterHandler("MeshUploadFlag", reqHandler); 123 caps.RegisterHandler("MeshUploadFlag", reqHandler);
124 m_agentID = agentID; 124
125 } 125 }
126 126
127 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod) 127 private Hashtable MeshUploadFlag(Hashtable mDhttpMethod, UUID agentID)
128 { 128 {
129// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request"); 129// m_log.DebugFormat("[MESH UPLOAD FLAG MODULE]: MeshUploadFlag request");
130 130
131 OSDMap data = new OSDMap(); 131 OSDMap data = new OSDMap();
132 ScenePresence sp = m_scene.GetScenePresence(m_agentID); 132 ScenePresence sp = m_scene.GetScenePresence(agentID);
133 data["username"] = sp.Firstname + "." + sp.Lastname; 133 data["username"] = sp.Firstname + "." + sp.Lastname;
134 data["display_name_next_update"] = new OSDDate(DateTime.Now); 134 data["display_name_next_update"] = new OSDDate(DateTime.Now);
135 data["legacy_first_name"] = sp.Firstname; 135 data["legacy_first_name"] = sp.Firstname;
136 data["mesh_upload_status"] = "valid"; 136 data["mesh_upload_status"] = "valid";
137 data["display_name"] = sp.Firstname + " " + sp.Lastname; 137 data["display_name"] = sp.Firstname + " " + sp.Lastname;
138 data["legacy_last_name"] = sp.Lastname; 138 data["legacy_last_name"] = sp.Lastname;
139 data["id"] = m_agentID; 139 data["id"] = agentID;
140 data["is_display_name_default"] = true; 140 data["is_display_name_default"] = true;
141 141
142 //Send back data 142 //Send back data
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 5675870..6742d99 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -790,7 +790,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
790 handshake.RegionInfo3.ColoName = Utils.EmptyBytes; 790 handshake.RegionInfo3.ColoName = Utils.EmptyBytes;
791 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); 791 handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType);
792 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; 792 handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes;
793 793 handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[0];
794
794 OutPacket(handshake, ThrottleOutPacketType.Task); 795 OutPacket(handshake, ThrottleOutPacketType.Task);
795 } 796 }
796 797
@@ -3571,6 +3572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3571 3572
3572 avp.Sender.IsTrial = false; 3573 avp.Sender.IsTrial = false;
3573 avp.Sender.ID = agentID; 3574 avp.Sender.ID = agentID;
3575 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
3574 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3576 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3575 OutPacket(avp, ThrottleOutPacketType.Task); 3577 OutPacket(avp, ThrottleOutPacketType.Task);
3576 } 3578 }
@@ -4192,7 +4194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4192 pack.Stat = stats.StatsBlock; 4194 pack.Stat = stats.StatsBlock;
4193 4195
4194 pack.Header.Reliable = false; 4196 pack.Header.Reliable = false;
4195 4197 pack.RegionInfo = new SimStatsPacket.RegionInfoBlock[0];
4196 OutPacket(pack, ThrottleOutPacketType.Task); 4198 OutPacket(pack, ThrottleOutPacketType.Task);
4197 } 4199 }
4198 4200
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 8a3eeaa..b6a7481 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -241,12 +241,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
241 241
242// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); 242// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
243 243
244 List<SceneObjectGroup> attachments = sp.GetAttachments();
245
246 if (attachments.Count <= 0)
247 return;
248
249 Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>();
250
251 foreach (SceneObjectGroup so in attachments)
252 {
253 // Scripts MUST be snapshotted before the object is
254 // removed from the scene because doing otherwise will
255 // clobber the run flag
256 // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from
257 // scripts performing attachment operations at the same time. Getting object states stops the scripts.
258 scriptStates[so] = PrepareScriptInstanceForSave(so, false);
259 }
260
244 lock (sp.AttachmentsSyncLock) 261 lock (sp.AttachmentsSyncLock)
245 { 262 {
246 foreach (SceneObjectGroup so in sp.GetAttachments()) 263 foreach (SceneObjectGroup so in attachments)
247 { 264 UpdateDetachedObject(sp, so, scriptStates[so]);
248 UpdateDetachedObject(sp, so);
249 }
250 265
251 sp.ClearAttachments(); 266 sp.ClearAttachments();
252 } 267 }
@@ -285,32 +300,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
285 300
286 private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp) 301 private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp)
287 { 302 {
288 lock (sp.AttachmentsSyncLock)
289 {
290// m_log.DebugFormat( 303// m_log.DebugFormat(
291// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", 304// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
292// group.Name, group.LocalId, sp.Name, attachmentPt, silent); 305// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
293 306
294 if (group.GetSittingAvatarsCount() != 0) 307 if (group.GetSittingAvatarsCount() != 0)
295 { 308 {
296// m_log.WarnFormat( 309// m_log.WarnFormat(
297// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it", 310// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it",
298// group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount()); 311// group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount());
299 312
300 return false; 313 return false;
301 } 314 }
302 315
303 if (sp.GetAttachments(attachmentPt).Contains(group)) 316 if (sp.GetAttachments(attachmentPt).Contains(group))
304 { 317 {
305 // m_log.WarnFormat( 318// m_log.WarnFormat(
306 // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", 319// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
307 // group.Name, group.LocalId, sp.Name, AttachmentPt); 320// group.Name, group.LocalId, sp.Name, AttachmentPt);
308 321
309 return false; 322 return false;
310 } 323 }
311 324
325 // Remove any previous attachments
326 List<SceneObjectGroup> existingAttachments = sp.GetAttachments(attachmentPt);
327
328 // At the moment we can only deal with a single attachment
329 if (existingAttachments.Count != 0 && existingAttachments[0].FromItemID != UUID.Zero)
330 DetachSingleAttachmentToInv(sp, group);
331
332 lock (sp.AttachmentsSyncLock)
333 {
312 Vector3 attachPos = group.AbsolutePosition; 334 Vector3 attachPos = group.AbsolutePosition;
313 335
314 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 336 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
315 // be removed when that functionality is implemented in opensim 337 // be removed when that functionality is implemented in opensim
316 attachmentPt &= 0x7f; 338 attachmentPt &= 0x7f;
@@ -322,14 +344,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
322 { 344 {
323 attachPos = Vector3.Zero; 345 attachPos = Vector3.Zero;
324 } 346 }
325 347
326 // AttachmentPt 0 means the client chose to 'wear' the attachment. 348 // AttachmentPt 0 means the client chose to 'wear' the attachment.
327 if (attachmentPt == 0) 349 if (attachmentPt == 0)
328 { 350 {
329 // Check object for stored attachment point 351 // Check object for stored attachment point
330 attachmentPt = group.AttachmentPoint; 352 attachmentPt = group.AttachmentPoint;
331 } 353 }
332 354
333 // if we still didn't find a suitable attachment point....... 355 // if we still didn't find a suitable attachment point.......
334 if (attachmentPt == 0) 356 if (attachmentPt == 0)
335 { 357 {
@@ -337,13 +359,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
337 attachmentPt = (uint)AttachmentPoint.LeftHand; 359 attachmentPt = (uint)AttachmentPoint.LeftHand;
338 attachPos = Vector3.Zero; 360 attachPos = Vector3.Zero;
339 } 361 }
340 362
341 group.AttachmentPoint = attachmentPt; 363 group.AttachmentPoint = attachmentPt;
342 group.AbsolutePosition = attachPos; 364 group.AbsolutePosition = attachPos;
343 365
344 if (sp.PresenceType != PresenceType.Npc) 366 if (sp.PresenceType != PresenceType.Npc)
345 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp); 367 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp);
346 368
347 AttachToAgent(sp, group, attachmentPt, attachPos, silent); 369 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
348 } 370 }
349 371
@@ -352,21 +374,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
352 374
353 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp) 375 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp)
354 { 376 {
355 // Remove any previous attachments
356 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
357
358 // At the moment we can only deal with a single attachment
359 if (attachments.Count != 0)
360 {
361 if (attachments[0].FromItemID != UUID.Zero)
362 DetachSingleAttachmentToInvInternal(sp, attachments[0]);
363 // Error logging commented because UUID.Zero now means temp attachment
364// else
365// m_log.WarnFormat(
366// "[ATTACHMENTS MODULE]: When detaching existing attachment {0} {1} at point {2} to make way for {3} {4} for {5}, couldn't find the associated item ID to adjust inventory attachment record!",
367// attachments[0].Name, attachments[0].LocalId, attachmentPt, group.Name, group.LocalId, sp.Name);
368 }
369
370 // Add the new attachment to inventory if we don't already have it. 377 // Add the new attachment to inventory if we don't already have it.
371 if (!temp) 378 if (!temp)
372 { 379 {
@@ -426,12 +433,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
426 return; 433 return;
427 434
428 // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); 435 // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
429 lock (sp.AttachmentsSyncLock) 436
437 foreach (KeyValuePair<UUID, uint> rez in rezlist)
430 { 438 {
431 foreach (KeyValuePair<UUID, uint> rez in rezlist) 439 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value);
432 {
433 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value);
434 }
435 } 440 }
436 } 441 }
437 442
@@ -511,25 +516,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
511 516
512 public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) 517 public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so)
513 { 518 {
519 if (so.AttachedAvatar != sp.UUID)
520 {
521 m_log.WarnFormat(
522 "[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}",
523 so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName);
524
525 return;
526 }
527
528 // Scripts MUST be snapshotted before the object is
529 // removed from the scene because doing otherwise will
530 // clobber the run flag
531 // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from
532 // scripts performing attachment operations at the same time. Getting object states stops the scripts.
533 string scriptedState = PrepareScriptInstanceForSave(so, true);
534
514 lock (sp.AttachmentsSyncLock) 535 lock (sp.AttachmentsSyncLock)
515 { 536 {
516 // Save avatar attachment information 537 // Save avatar attachment information
517// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID); 538// m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + sp.UUID + ", ItemID: " + itemID);
518 539
519 if (so.AttachedAvatar != sp.UUID)
520 {
521 m_log.WarnFormat(
522 "[ATTACHMENTS MODULE]: Tried to detach object {0} from {1} {2} but attached avatar id was {3} in {4}",
523 so.Name, sp.Name, sp.UUID, so.AttachedAvatar, m_scene.RegionInfo.RegionName);
524
525 return;
526 }
527
528 bool changed = sp.Appearance.DetachAttachment(so.FromItemID); 540 bool changed = sp.Appearance.DetachAttachment(so.FromItemID);
529 if (changed && m_scene.AvatarFactory != null) 541 if (changed && m_scene.AvatarFactory != null)
530 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); 542 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
531 543
532 DetachSingleAttachmentToInvInternal(sp, so); 544 sp.RemoveAttachment(so);
545 UpdateDetachedObject(sp, so, scriptedState);
533 } 546 }
534 } 547 }
535 548
@@ -739,8 +752,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
739 return newItem; 752 return newItem;
740 } 753 }
741 754
742 private string GetObjectScriptStates(SceneObjectGroup grp) 755 /// <summary>
756 /// Prepares the script instance for save.
757 /// </summary>
758 /// <remarks>
759 /// This involves triggering the detach event and getting the script state (which also stops the script)
760 /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a
761 /// running script is performing attachment operations.
762 /// </remarks>
763 /// <returns>
764 /// The script state ready for persistence.
765 /// </returns>
766 /// <param name='grp'>
767 /// </param>
768 /// <param name='fireDetachEvent'>
769 /// If true, then fire the script event before we save its state.
770 /// </param>
771 private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent)
743 { 772 {
773 if (fireDetachEvent)
774 m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);
775
744 using (StringWriter sw = new StringWriter()) 776 using (StringWriter sw = new StringWriter())
745 { 777 {
746 using (XmlTextWriter writer = new XmlTextWriter(sw)) 778 using (XmlTextWriter writer = new XmlTextWriter(sw))
@@ -752,7 +784,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
752 } 784 }
753 } 785 }
754 786
755 private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so) 787 private void UpdateDetachedObject(IScenePresence sp, SceneObjectGroup so, string scriptedState)
756 { 788 {
757 // Don't save attachments for HG visitors, it 789 // Don't save attachments for HG visitors, it
758 // messes up their inventory. When a HG visitor logs 790 // messes up their inventory. When a HG visitor logs
@@ -765,11 +797,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
765 && (m_scene.UserManagementModule == null 797 && (m_scene.UserManagementModule == null
766 || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID)); 798 || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID));
767 799
768 // Scripts MUST be snapshotted before the object is
769 // removed from the scene because doing otherwise will
770 // clobber the run flag
771 string scriptedState = GetObjectScriptStates(so);
772
773 // Remove the object from the scene so no more updates 800 // Remove the object from the scene so no more updates
774 // are sent. Doing this before the below changes will ensure 801 // are sent. Doing this before the below changes will ensure
775 // updates can't cause "HUD artefacts" 802 // updates can't cause "HUD artefacts"
@@ -793,91 +820,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
793 so.RemoveScriptInstances(true); 820 so.RemoveScriptInstances(true);
794 } 821 }
795 822
796 private void DetachSingleAttachmentToInvInternal(IScenePresence sp, SceneObjectGroup so)
797 {
798 // m_log.DebugFormat("[ATTACHMENTS MODULE]: Detaching item {0} to inventory for {1}", itemID, sp.Name);
799
800 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero);
801 sp.RemoveAttachment(so);
802
803 UpdateDetachedObject(sp, so);
804 }
805
806 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 823 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
807 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) 824 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt)
808 { 825 {
809 if (m_invAccessModule == null) 826 if (m_invAccessModule == null)
810 return null; 827 return null;
811 828
812 lock (sp.AttachmentsSyncLock) 829 SceneObjectGroup objatt;
830
831 if (itemID != UUID.Zero)
832 objatt = m_invAccessModule.RezObject(sp.ControllingClient,
833 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
834 false, false, sp.UUID, true);
835 else
836 objatt = m_invAccessModule.RezObject(sp.ControllingClient,
837 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
838 false, false, sp.UUID, true);
839
840 if (objatt == null)
813 { 841 {
814 SceneObjectGroup objatt; 842 m_log.WarnFormat(
843 "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
844 itemID, sp.Name, attachmentPt);
815 845
816 if (itemID != UUID.Zero) 846 return null;
817 objatt = m_invAccessModule.RezObject(sp.ControllingClient, 847 }
818 itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
819 false, false, sp.UUID, true);
820 else
821 objatt = m_invAccessModule.RezObject(sp.ControllingClient,
822 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
823 false, false, sp.UUID, true);
824 848
825 if (objatt != null) 849 // Remove any previous attachments
826 { 850 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
851
852 // At the moment we can only deal with a single attachment
853 if (attachments.Count != 0)
854 DetachSingleAttachmentToInv(sp, attachments[0]);
855
856 lock (sp.AttachmentsSyncLock)
857 {
827// m_log.DebugFormat( 858// m_log.DebugFormat(
828// "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}", 859// "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}",
829// objatt.Name, sp.Name, attachmentPt, m_scene.Name); 860// objatt.Name, sp.Name, attachmentPt, m_scene.Name);
830 861
831 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. 862 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
832 objatt.HasGroupChanged = false; 863 objatt.HasGroupChanged = false;
833 bool tainted = false; 864 bool tainted = false;
834 if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) 865 if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)
835 tainted = true; 866 tainted = true;
836 867
837 // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal 868 // FIXME: Detect whether it's really likely for AttachObject to throw an exception in the normal
838 // course of events. If not, then it's probably not worth trying to recover the situation 869 // course of events. If not, then it's probably not worth trying to recover the situation
839 // since this is more likely to trigger further exceptions and confuse later debugging. If 870 // since this is more likely to trigger further exceptions and confuse later debugging. If
840 // exceptions can be thrown in expected error conditions (not NREs) then make this consistent 871 // exceptions can be thrown in expected error conditions (not NREs) then make this consistent
841 // since other normal error conditions will simply return false instead. 872 // since other normal error conditions will simply return false instead.
842 // This will throw if the attachment fails 873 // This will throw if the attachment fails
843 try 874 try
844 { 875 {
845 AttachObjectInternal(sp, objatt, attachmentPt, false, false); 876 AttachObjectInternal(sp, objatt, attachmentPt, false, false);
846 } 877 }
847 catch (Exception e) 878 catch (Exception e)
848 { 879 {
849 m_log.ErrorFormat( 880 m_log.ErrorFormat(
850 "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", 881 "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
851 objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); 882 objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
852
853 // Make sure the object doesn't stick around and bail
854 sp.RemoveAttachment(objatt);
855 m_scene.DeleteSceneObject(objatt, false);
856 return null;
857 }
858 883
859 if (tainted) 884 // Make sure the object doesn't stick around and bail
860 objatt.HasGroupChanged = true; 885 sp.RemoveAttachment(objatt);
886 m_scene.DeleteSceneObject(objatt, false);
887 return null;
888 }
861 889
862 // Fire after attach, so we don't get messy perms dialogs 890 if (tainted)
863 // 4 == AttachedRez 891 objatt.HasGroupChanged = true;
864 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
865 objatt.ResumeScripts();
866 892
867 // Do this last so that event listeners have access to all the effects of the attachment 893 // Fire after attach, so we don't get messy perms dialogs
868 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); 894 // 4 == AttachedRez
895 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
896 objatt.ResumeScripts();
869 897
870 return objatt; 898 // Do this last so that event listeners have access to all the effects of the attachment
871 } 899 m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
872 else
873 {
874 m_log.WarnFormat(
875 "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
876 itemID, sp.Name, attachmentPt);
877 }
878 }
879 900
880 return null; 901 return objatt;
902 }
881 } 903 }
882 904
883 /// <summary> 905 /// <summary>
@@ -1027,17 +1049,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1027 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 1049 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
1028 if (sp != null) 1050 if (sp != null)
1029 { 1051 {
1030 lock (sp.AttachmentsSyncLock) 1052 List<SceneObjectGroup> attachments = sp.GetAttachments();
1053
1054 foreach (SceneObjectGroup group in attachments)
1031 { 1055 {
1032 List<SceneObjectGroup> attachments = sp.GetAttachments(); 1056 if (group.FromItemID == itemID && group.FromItemID != UUID.Zero)
1033
1034 foreach (SceneObjectGroup group in attachments)
1035 { 1057 {
1036 if (group.FromItemID == itemID && group.FromItemID != UUID.Zero) 1058 DetachSingleAttachmentToInv(sp, group);
1037 { 1059 return;
1038 DetachSingleAttachmentToInv(sp, group);
1039 return;
1040 }
1041 } 1060 }
1042 } 1061 }
1043 } 1062 }
@@ -1055,4 +1074,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1055 1074
1056 #endregion 1075 #endregion
1057 } 1076 }
1058} 1077} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 07c3666..01b1668 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1206,6 +1206,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1206 // region doesn't take it 1206 // region doesn't take it
1207 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); 1207 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
1208 1208
1209 m_log.WarnFormat(
1210 "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.",
1211 neighbourRegion.RegionName, agent.Name);
1212
1209 ReInstantiateScripts(agent); 1213 ReInstantiateScripts(agent);
1210 agent.AddToPhysicalScene(isFlying); 1214 agent.AddToPhysicalScene(isFlying);
1211 1215
@@ -1225,6 +1229,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1225 neighbourRegion.RegionHandle); 1229 neighbourRegion.RegionHandle);
1226 return agent; 1230 return agent;
1227 } 1231 }
1232
1228 // No turning back 1233 // No turning back
1229 agent.IsChildAgent = true; 1234 agent.IsChildAgent = true;
1230 1235
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 4c9ee06..64feec1 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -414,8 +414,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
414 } 414 }
415 private void RegisterStatsManagerRegionStatistics() 415 private void RegisterStatsManagerRegionStatistics()
416 { 416 {
417 string regionName = m_scene.RegionInfo.RegionName;
418
419 MakeStat("RootAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetRootAgentCount(); }); 417 MakeStat("RootAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetRootAgentCount(); });
420 MakeStat("ChildAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetChildAgentCount(); }); 418 MakeStat("ChildAgents", "avatars", (s) => { s.Value = m_scene.SceneGraph.GetChildAgentCount(); });
421 MakeStat("TotalPrims", "objects", (s) => { s.Value = m_scene.SceneGraph.GetTotalObjectsCount(); }); 419 MakeStat("TotalPrims", "objects", (s) => { s.Value = m_scene.SceneGraph.GetTotalObjectsCount(); });
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 3c18074..a413546 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -219,12 +219,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
219 { 219 {
220// m_log.DebugFormat( 220// m_log.DebugFormat(
221// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 221// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
222// s.RegionInfo.RegionName, destination.RegionHandle); 222// destination.RegionName, destination.RegionID);
223 223
224 return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); 224 return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData);
225 } 225 }
226 226
227// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); 227// m_log.DebugFormat(
228// "[LOCAL COMMS]: Did not find region {0} {1} for ChildAgentUpdate",
229// destination.RegionName, destination.RegionID);
230
228 return false; 231 return false;
229 } 232 }
230 233
@@ -239,7 +242,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
239 // note that we really don't need the GridRegion for this call 242 // note that we really don't need the GridRegion for this call
240 foreach (Scene s in m_scenes.Values) 243 foreach (Scene s in m_scenes.Values)
241 { 244 {
242 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 245// m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
243 s.IncomingChildAgentDataUpdate(cAgentData); 246 s.IncomingChildAgentDataUpdate(cAgentData);
244 } 247 }
245 248
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
index 345f01b..b67312e 100644
--- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs
@@ -41,6 +41,16 @@ namespace OpenSim.Region.Framework.Interfaces
41 Value = 3 41 Value = 3
42 } 42 }
43 43
44 public enum JsonStoreValueType
45 {
46 Undefined = 0,
47 Boolean = 1,
48 Integer = 2,
49 Float = 3,
50 String = 4,
51 UUID = 5
52 }
53
44 public delegate void TakeValueCallback(string s); 54 public delegate void TakeValueCallback(string s);
45 55
46 public interface IJsonStoreModule 56 public interface IJsonStoreModule
@@ -49,7 +59,9 @@ namespace OpenSim.Region.Framework.Interfaces
49 bool CreateStore(string value, ref UUID result); 59 bool CreateStore(string value, ref UUID result);
50 bool DestroyStore(UUID storeID); 60 bool DestroyStore(UUID storeID);
51 61
52 JsonStoreNodeType GetPathType(UUID storeID, string path); 62 JsonStoreNodeType GetNodeType(UUID storeID, string path);
63 JsonStoreValueType GetValueType(UUID storeID, string path);
64
53 bool TestStore(UUID storeID); 65 bool TestStore(UUID storeID);
54 66
55 bool SetValue(UUID storeID, string path, string value, bool useJson); 67 bool SetValue(UUID storeID, string path, string value, bool useJson);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 39a885c..a7c7539 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1613,32 +1613,28 @@ namespace OpenSim.Region.Framework.Scenes
1613 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1613 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1614 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1614 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1615 1615
1616
1617 //m_log.Debug("[CONTROL]: " +flags); 1616 //m_log.Debug("[CONTROL]: " +flags);
1618 // Applies a satisfying roll effect to the avatar when flying. 1617 // Applies a satisfying roll effect to the avatar when flying.
1619 if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0) && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)) 1618 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) != 0 && (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
1620 { 1619 {
1621 1620 ApplyFlyingRoll(
1622 ApplyFlyingRoll(FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1621 FLY_ROLL_RADIANS_PER_UPDATE,
1623 1622 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1624 1623 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1625 } 1624 }
1626 else if (((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0) && 1625 else if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) != 0 &&
1627 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)) 1626 (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
1628 { 1627 {
1629 ApplyFlyingRoll(-FLY_ROLL_RADIANS_PER_UPDATE, ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0), ((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0)); 1628 ApplyFlyingRoll(
1630 1629 -FLY_ROLL_RADIANS_PER_UPDATE,
1631 1630 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0,
1631 (flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0);
1632 } 1632 }
1633 else 1633 else
1634 { 1634 {
1635 if (m_AngularVelocity.Z != 0) 1635 if (m_AngularVelocity.Z != 0)
1636 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE); 1636 m_AngularVelocity.Z += CalculateFlyingRollResetToZero(FLY_ROLL_RESET_RADIANS_PER_UPDATE);
1637 1637 }
1638 }
1639
1640
1641
1642 1638
1643 if (Flying && IsColliding && controlland) 1639 if (Flying && IsColliding && controlland)
1644 { 1640 {
@@ -2400,7 +2396,8 @@ namespace OpenSim.Region.Framework.Scenes
2400 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2396 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2401 public void AddNewMovement(Vector3 vec) 2397 public void AddNewMovement(Vector3 vec)
2402 { 2398 {
2403// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); 2399// m_log.DebugFormat(
2400// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1} for {2}", vec, Rotation, Name);
2404 2401
2405 Vector3 direc = vec * Rotation; 2402 Vector3 direc = vec * Rotation;
2406 direc.Normalize(); 2403 direc.Normalize();
@@ -2420,6 +2417,8 @@ namespace OpenSim.Region.Framework.Scenes
2420 2417
2421 direc *= 0.03f * 128f * SpeedModifier; 2418 direc *= 0.03f * 128f * SpeedModifier;
2422 2419
2420// m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
2421
2423 if (PhysicsActor != null) 2422 if (PhysicsActor != null)
2424 { 2423 {
2425 if (Flying) 2424 if (Flying)
@@ -2453,6 +2452,8 @@ namespace OpenSim.Region.Framework.Scenes
2453 } 2452 }
2454 } 2453 }
2455 2454
2455// m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name);
2456
2456 // TODO: Add the force instead of only setting it to support multiple forces per frame? 2457 // TODO: Add the force instead of only setting it to support multiple forces per frame?
2457 m_forceToApply = direc; 2458 m_forceToApply = direc;
2458 } 2459 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5faf131..bbfbbfc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -289,108 +289,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
289// 289//
290// Assert.That(presence, Is.Null, "presence is not null"); 290// Assert.That(presence, Is.Null, "presence is not null");
291// } 291// }
292
293 // I'm commenting this test because it does not represent
294 // crossings. The Thread.Sleep's in here are not meaningful mocks,
295 // and they sometimes fail in panda.
296 // We need to talk in order to develop a test
297 // that really tests region crossings. There are 3 async components,
298 // but things are synchronous among them. So there should be
299 // 3 threads in here.
300 //[Test]
301// public void T021_TestCrossToNewRegion()
302// {
303// TestHelpers.InMethod();
304//
305// scene.RegisterRegionWithGrid();
306// scene2.RegisterRegionWithGrid();
307//
308// // Adding child agent to region 1001
309// string reason;
310// scene2.NewUserConnection(acd1,0, out reason);
311// scene2.AddNewClient(testclient, PresenceType.User);
312//
313// ScenePresence presence = scene.GetScenePresence(agent1);
314// presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
315//
316// ScenePresence presence2 = scene2.GetScenePresence(agent1);
317//
318// // Adding neighbour region caps info to presence2
319//
320// string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
321// presence2.AddNeighbourRegion(region1, cap);
322//
323// Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
324// Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
325//
326// // Cross to x+1
327// presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
328// presence.Update();
329//
330// EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
331//
332// // Mimicking communication between client and server, by waiting OK from client
333// // sent by TestClient.CrossRegion call. Originally, this is network comm.
334// if (!wh.WaitOne(5000,false))
335// {
336// presence.Update();
337// if (!wh.WaitOne(8000,false))
338// throw new ArgumentException("1 - Timeout waiting for signal/variable.");
339// }
340//
341// // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
342// // would normally be fired after receiving the reply packet from comm. done on the last line.
343// testclient.CompleteMovement();
344//
345// // Crossings are asynchronous
346// int timer = 10;
347//
348// // Make sure cross hasn't already finished
349// if (!presence.IsInTransit && !presence.IsChildAgent)
350// {
351// // If not and not in transit yet, give it some more time
352// Thread.Sleep(5000);
353// }
354//
355// // Enough time, should at least be in transit by now.
356// while (presence.IsInTransit && timer > 0)
357// {
358// Thread.Sleep(1000);
359// timer-=1;
360// }
361//
362// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
363// Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
364// Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
365//
366// // Cross Back
367// presence2.AbsolutePosition = new Vector3(-10, 3, 100);
368// presence2.Update();
369//
370// if (!wh.WaitOne(5000,false))
371// {
372// presence2.Update();
373// if (!wh.WaitOne(8000,false))
374// throw new ArgumentException("2 - Timeout waiting for signal/variable.");
375// }
376// testclient.CompleteMovement();
377//
378// if (!presence2.IsInTransit && !presence2.IsChildAgent)
379// {
380// // If not and not in transit yet, give it some more time
381// Thread.Sleep(5000);
382// }
383//
384// // Enough time, should at least be in transit by now.
385// while (presence2.IsInTransit && timer > 0)
386// {
387// Thread.Sleep(1000);
388// timer-=1;
389// }
390//
391// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
392// Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
393// Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
394// }
395 } 292 }
396} \ No newline at end of file 293} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
new file mode 100644
index 0000000..81a2fcc
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -0,0 +1,157 @@
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 Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.Framework;
39using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 [TestFixture]
47 public class ScenePresenceCrossingTests : OpenSimTestCase
48 {
49 [TestFixtureSetUp]
50 public void FixtureInit()
51 {
52 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
53 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
54 }
55
56 [TestFixtureTearDown]
57 public void TearDown()
58 {
59 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
60 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
61 // tests really shouldn't).
62 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
63 }
64
65 [Test]
66 public void TestCrossOnSameSimulator()
67 {
68 TestHelpers.InMethod();
69// TestHelpers.EnableLogging();
70
71 UUID userId = TestHelpers.ParseTail(0x1);
72
73// TestEventQueueGetModule eqmA = new TestEventQueueGetModule();
74 EntityTransferModule etmA = new EntityTransferModule();
75 EntityTransferModule etmB = new EntityTransferModule();
76 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
77
78 IConfigSource config = new IniConfigSource();
79 IConfig modulesConfig = config.AddConfig("Modules");
80 modulesConfig.Set("EntityTransferModule", etmA.Name);
81 modulesConfig.Set("SimulationServices", lscm.Name);
82// IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
83
84 // In order to run a single threaded regression test we do not want the entity transfer module waiting
85 // for a callback from the destination scene before removing its avatar data.
86// entityTransferConfig.Set("wait_for_callback", false);
87
88 SceneHelpers sh = new SceneHelpers();
89 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
90 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
91
92 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
93 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
94// SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA);
95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
96
97 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
98 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
99
100// originalSp.Flying = true;
101
102// Console.WriteLine("First pos {0}", originalSp.AbsolutePosition);
103
104// eqmA.ClearEvents();
105
106 AgentUpdateArgs moveArgs = new AgentUpdateArgs();
107 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
108 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
109 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
110
111 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
112
113 sceneA.Update(1);
114
115// Console.WriteLine("Second pos {0}", originalSp.AbsolutePosition);
116
117 // FIXME: This is a sufficient number of updates to for the presence to reach the northern border.
118 // But really we want to do this in a more robust way.
119 for (int i = 0; i < 100; i++)
120 {
121 sceneA.Update(1);
122// Console.WriteLine("Pos {0}", originalSp.AbsolutePosition);
123 }
124
125 // Need to sort processing of EnableSimulator message on adding scene presences before we can test eqm
126 // messages
127// Dictionary<UUID, List<TestEventQueueGetModule.Event>> eqmEvents = eqmA.Events;
128//
129// Assert.That(eqmEvents.Count, Is.EqualTo(1));
130// Assert.That(eqmEvents.ContainsKey(originalSp.UUID), Is.True);
131//
132// List<TestEventQueueGetModule.Event> spEqmEvents = eqmEvents[originalSp.UUID];
133//
134// Assert.That(spEqmEvents.Count, Is.EqualTo(1));
135// Assert.That(spEqmEvents[0].Name, Is.EqualTo("CrossRegion"));
136
137 // sceneA should now only have a child agent
138 ScenePresence spAfterCrossSceneA = sceneA.GetScenePresence(originalSp.UUID);
139 Assert.That(spAfterCrossSceneA.IsChildAgent, Is.True);
140
141 ScenePresence spAfterCrossSceneB = sceneB.GetScenePresence(originalSp.UUID);
142
143 // Agent remains a child until the client triggers complete movement
144 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True);
145
146 TestClient sceneBTc = ((TestClient)spAfterCrossSceneB.ControllingClient);
147
148 int agentMovementCompleteReceived = 0;
149 sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => agentMovementCompleteReceived++;
150
151 sceneBTc.CompleteMovement();
152
153 Assert.That(agentMovementCompleteReceived, Is.EqualTo(1));
154 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.False);
155 }
156 }
157} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 40adba1..e498c6a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
145 /// 145 ///
146 /// </summary> 146 /// </summary>
147 // ----------------------------------------------------------------- 147 // -----------------------------------------------------------------
148 public JsonStoreNodeType PathType(string expr) 148 public JsonStoreNodeType GetNodeType(string expr)
149 { 149 {
150 Stack<string> path; 150 Stack<string> path;
151 if (! ParsePathExpression(expr,out path)) 151 if (! ParsePathExpression(expr,out path))
@@ -173,6 +173,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
173 /// 173 ///
174 /// </summary> 174 /// </summary>
175 // ----------------------------------------------------------------- 175 // -----------------------------------------------------------------
176 public JsonStoreValueType GetValueType(string expr)
177 {
178 Stack<string> path;
179 if (! ParsePathExpression(expr,out path))
180 return JsonStoreValueType.Undefined;
181
182 OSD result = ProcessPathExpression(ValueStore,path);
183
184 if (result == null)
185 return JsonStoreValueType.Undefined;
186
187 if (result is OSDMap)
188 return JsonStoreValueType.Undefined;
189
190 if (result is OSDArray)
191 return JsonStoreValueType.Undefined;
192
193 if (result is OSDBoolean)
194 return JsonStoreValueType.Boolean;
195
196 if (result is OSDInteger)
197 return JsonStoreValueType.Integer;
198
199 if (result is OSDReal)
200 return JsonStoreValueType.Float;
201
202 if (result is OSDString)
203 return JsonStoreValueType.String;
204
205 return JsonStoreValueType.Undefined;
206 }
207
208 // -----------------------------------------------------------------
209 /// <summary>
210 ///
211 /// </summary>
212 // -----------------------------------------------------------------
176 public int ArrayLength(string expr) 213 public int ArrayLength(string expr)
177 { 214 {
178 Stack<string> path; 215 Stack<string> path;
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index e78a2f4..5fbfcc5 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -270,7 +270,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
270 /// 270 ///
271 /// </summary> 271 /// </summary>
272 // ----------------------------------------------------------------- 272 // -----------------------------------------------------------------
273 public JsonStoreNodeType GetPathType(UUID storeID, string path) 273 public JsonStoreNodeType GetNodeType(UUID storeID, string path)
274 { 274 {
275 if (! m_enabled) return JsonStoreNodeType.Undefined; 275 if (! m_enabled) return JsonStoreNodeType.Undefined;
276 276
@@ -287,7 +287,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
287 try 287 try
288 { 288 {
289 lock (map) 289 lock (map)
290 return map.PathType(path); 290 return map.GetNodeType(path);
291 } 291 }
292 catch (Exception e) 292 catch (Exception e)
293 { 293 {
@@ -302,6 +302,38 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
302 /// 302 ///
303 /// </summary> 303 /// </summary>
304 // ----------------------------------------------------------------- 304 // -----------------------------------------------------------------
305 public JsonStoreValueType GetValueType(UUID storeID, string path)
306 {
307 if (! m_enabled) return JsonStoreValueType.Undefined;
308
309 JsonStore map = null;
310 lock (m_JsonValueStore)
311 {
312 if (! m_JsonValueStore.TryGetValue(storeID,out map))
313 {
314 m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
315 return JsonStoreValueType.Undefined;
316 }
317 }
318
319 try
320 {
321 lock (map)
322 return map.GetValueType(path);
323 }
324 catch (Exception e)
325 {
326 m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e);
327 }
328
329 return JsonStoreValueType.Undefined;
330 }
331
332 // -----------------------------------------------------------------
333 /// <summary>
334 ///
335 /// </summary>
336 // -----------------------------------------------------------------
305 public bool SetValue(UUID storeID, string path, string value, bool useJson) 337 public bool SetValue(UUID storeID, string path, string value, bool useJson)
306 { 338 {
307 if (! m_enabled) return false; 339 if (! m_enabled) return false;
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index e13eb56..4a754a9 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -192,16 +192,32 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
192#region ScriptConstantsInterface 192#region ScriptConstantsInterface
193 193
194 [ScriptConstant] 194 [ScriptConstant]
195 public static readonly int JSON_TYPE_UNDEF = (int)JsonStoreNodeType.Undefined; 195 public static readonly int JSON_NODETYPE_UNDEF = (int)JsonStoreNodeType.Undefined;
196 196
197 [ScriptConstant] 197 [ScriptConstant]
198 public static readonly int JSON_TYPE_OBJECT = (int)JsonStoreNodeType.Object; 198 public static readonly int JSON_NODETYPE_OBJECT = (int)JsonStoreNodeType.Object;
199 199
200 [ScriptConstant] 200 [ScriptConstant]
201 public static readonly int JSON_TYPE_ARRAY = (int)JsonStoreNodeType.Array; 201 public static readonly int JSON_NODETYPE_ARRAY = (int)JsonStoreNodeType.Array;
202 202
203 [ScriptConstant] 203 [ScriptConstant]
204 public static readonly int JSON_TYPE_VALUE = (int)JsonStoreNodeType.Value; 204 public static readonly int JSON_NODETYPE_VALUE = (int)JsonStoreNodeType.Value;
205
206 [ScriptConstant]
207 public static readonly int JSON_VALUETYPE_UNDEF = (int)JsonStoreValueType.Undefined;
208
209 [ScriptConstant]
210 public static readonly int JSON_VALUETYPE_BOOLEAN = (int)JsonStoreValueType.Boolean;
211
212 [ScriptConstant]
213 public static readonly int JSON_VALUETYPE_INTEGER = (int)JsonStoreValueType.Integer;
214
215 [ScriptConstant]
216 public static readonly int JSON_VALUETYPE_FLOAT = (int)JsonStoreValueType.Float;
217
218 [ScriptConstant]
219 public static readonly int JSON_VALUETYPE_STRING = (int)JsonStoreValueType.String;
220
205 221
206#endregion 222#endregion
207 223
@@ -310,9 +326,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
310 /// </summary> 326 /// </summary>
311 // ----------------------------------------------------------------- 327 // -----------------------------------------------------------------
312 [ScriptInvocation] 328 [ScriptInvocation]
313 public int JsonGetPathType(UUID hostID, UUID scriptID, UUID storeID, string path) 329 public int JsonGetNodeType(UUID hostID, UUID scriptID, UUID storeID, string path)
330 {
331 return (int)m_store.GetNodeType(storeID,path);
332 }
333
334 // -----------------------------------------------------------------
335 /// <summary>
336 ///
337 /// </summary>
338 // -----------------------------------------------------------------
339 [ScriptInvocation]
340 public int JsonGetValueType(UUID hostID, UUID scriptID, UUID storeID, string path)
314 { 341 {
315 return (int)m_store.GetPathType(storeID,path); 342 return (int)m_store.GetValueType(storeID,path);
316 } 343 }
317 344
318 // ----------------------------------------------------------------- 345 // -----------------------------------------------------------------
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index b64dbd4..bfa9937 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -158,8 +158,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
158 158
159 Assert.That(dsrv, Is.EqualTo(1)); 159 Assert.That(dsrv, Is.EqualTo(1));
160 160
161 int tprv = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); 161 int tprv = (int)InvokeOp("JsonGetNodeType", storeId, "Hello");
162 Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 162 Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
163 } 163 }
164 164
165 [Test] 165 [Test]
@@ -277,8 +277,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
277 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); 277 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
278 Assert.That(returnValue, Is.EqualTo(1)); 278 Assert.That(returnValue, Is.EqualTo(1));
279 279
280 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); 280 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello");
281 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 281 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
282 282
283 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); 283 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
284 Assert.That(returnValue2, Is.EqualTo("")); 284 Assert.That(returnValue2, Is.EqualTo(""));
@@ -291,8 +291,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
291 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); 291 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
292 Assert.That(returnValue, Is.EqualTo(1)); 292 Assert.That(returnValue, Is.EqualTo(1));
293 293
294 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); 294 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello");
295 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 295 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
296 296
297 string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); 297 string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello");
298 Assert.That(returnValue2, Is.EqualTo("")); 298 Assert.That(returnValue2, Is.EqualTo(""));
@@ -306,11 +306,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
306 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); 306 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
307 Assert.That(returnValue, Is.EqualTo(1)); 307 Assert.That(returnValue, Is.EqualTo(1));
308 308
309 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[0]"); 309 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[0]");
310 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); 310 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE));
311 311
312 result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[1]"); 312 result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[1]");
313 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 313 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
314 314
315 string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); 315 string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]");
316 Assert.That(stringReturnValue, Is.EqualTo("value2")); 316 Assert.That(stringReturnValue, Is.EqualTo("value2"));
@@ -433,7 +433,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
433 } 433 }
434 434
435 [Test] 435 [Test]
436 public void TestJsonGetPathType() 436 public void TestJsonGetNodeType()
437 { 437 {
438 TestHelpers.InMethod(); 438 TestHelpers.InMethod();
439// TestHelpers.EnableLogging(); 439// TestHelpers.EnableLogging();
@@ -441,41 +441,41 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
441 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); 441 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }");
442 442
443 { 443 {
444 int result = (int)InvokeOp("JsonGetPathType", storeId, "."); 444 int result = (int)InvokeOp("JsonGetNodeType", storeId, ".");
445 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); 445 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT));
446 } 446 }
447 447
448 { 448 {
449 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); 449 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello");
450 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); 450 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT));
451 } 451 }
452 452
453 { 453 {
454 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World"); 454 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World");
455 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_ARRAY)); 455 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_ARRAY));
456 } 456 }
457 457
458 { 458 {
459 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[0]"); 459 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[0]");
460 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); 460 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE));
461 } 461 }
462 462
463 { 463 {
464 int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[1]"); 464 int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[1]");
465 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); 465 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE));
466 } 466 }
467 467
468 // Test for non-existant path 468 // Test for non-existant path
469 { 469 {
470 int result = (int)InvokeOp("JsonGetPathType", storeId, "foo"); 470 int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo");
471 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 471 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
472 } 472 }
473 473
474 // Test for non-existant store 474 // Test for non-existant store
475 { 475 {
476 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 476 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
477 int result = (int)InvokeOp("JsonGetPathType", fakeStoreId, "."); 477 int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, ".");
478 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); 478 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
479 } 479 }
480 } 480 }
481 481
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index c4b9117..0816b7b 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -102,6 +102,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
102 102
103 public override float Simulate(float timeStep) 103 public override float Simulate(float timeStep)
104 { 104 {
105// Console.WriteLine("Simulating");
106
105 float fps = 0; 107 float fps = 0;
106 for (int i = 0; i < _actors.Count; ++i) 108 for (int i = 0; i < _actors.Count; ++i)
107 { 109 {
@@ -109,8 +111,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
109 Vector3 actorPosition = actor.Position; 111 Vector3 actorPosition = actor.Position;
110 Vector3 actorVelocity = actor.Velocity; 112 Vector3 actorVelocity = actor.Velocity;
111 113
112 actorPosition.X += actor.Velocity.X*timeStep; 114// Console.WriteLine(
113 actorPosition.Y += actor.Velocity.Y*timeStep; 115// "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity);
116
117 actorPosition.X += actor.Velocity.X * timeStep;
118 actorPosition.Y += actor.Velocity.Y * timeStep;
114 119
115 if (actor.Position.Y < 0) 120 if (actor.Position.Y < 0)
116 { 121 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ab087af..dd7ee24 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10920,7 +10920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10920 10920
10921 LSL_List result = new LSL_List(); 10921 LSL_List result = new LSL_List();
10922 10922
10923 if (obj != null && obj.OwnerID != m_host.OwnerID) 10923 if (obj != null && obj.OwnerID == m_host.OwnerID)
10924 { 10924 {
10925 LSL_List remaining = GetPrimParams(obj, rules, ref result); 10925 LSL_List remaining = GetPrimParams(obj, rules, ref result);
10926 10926
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index d0922aa..21bae27 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -266,6 +266,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
266 { 266 {
267 llist[i] = new LSL_Float((float)result[i]); 267 llist[i] = new LSL_Float((float)result[i]);
268 } 268 }
269 else if (result[i] is double)
270 {
271 llist[i] = new LSL_Float((double)result[i]);
272 }
269 else if (result[i] is UUID) 273 else if (result[i] is UUID)
270 { 274 {
271 llist[i] = new LSL_Key(result[i].ToString()); 275 llist[i] = new LSL_Key(result[i].ToString());
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 182f4d9..a448cc5 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Tests.Common.Mock
60 public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } 60 public List<ImagePacketPacket> SentImagePacketPackets { get; private set; }
61 public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } 61 public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; }
62 62
63 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
64
63// disable warning: public events, part of the public API 65// disable warning: public events, part of the public API
64#pragma warning disable 67 66#pragma warning disable 67
65 67
@@ -566,6 +568,8 @@ namespace OpenSim.Tests.Common.Mock
566 568
567 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 569 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
568 { 570 {
571 if (OnReceivedMoveAgentIntoRegion != null)
572 OnReceivedMoveAgentIntoRegion(regInfo, pos, look);
569 } 573 }
570 574
571 public virtual AgentCircuitData RequestClientInfo() 575 public virtual AgentCircuitData RequestClientInfo()
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
new file mode 100644
index 0000000..6707019
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
@@ -0,0 +1,178 @@
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;
30using System.Collections.Generic;
31using System.Net;
32using System.Reflection;
33using System.Threading;
34using log4net;
35using Nini.Config;
36using Mono.Addins;
37using OpenMetaverse;
38using OpenMetaverse.StructuredData;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes;
43
44namespace OpenSim.Tests.Common
45{
46 public class TestEventQueueGetModule : IEventQueue, INonSharedRegionModule
47 {
48 public class Event
49 {
50 public string Name { get; set; }
51 public object[] Args { get; set; }
52
53 public Event(string name, object[] args)
54 {
55 name = Name;
56 args = Args;
57 }
58 }
59
60 public Dictionary<UUID, List<Event>> Events { get; set; }
61
62 public void Initialise(IConfigSource source) {}
63
64 public void Close() {}
65
66 public void AddRegion(Scene scene)
67 {
68 Events = new Dictionary<UUID, List<Event>>();
69 scene.RegisterModuleInterface<IEventQueue>(this);
70 }
71
72 public void RemoveRegion (Scene scene) {}
73
74 public void RegionLoaded (Scene scene) {}
75
76 public string Name { get { return "TestEventQueueGetModule"; } }
77
78 public Type ReplaceableInterface { get { return null; } }
79
80 private void AddEvent(UUID avatarID, string name, params object[] args)
81 {
82 Console.WriteLine("Adding event {0} for {1}", name, avatarID);
83
84 List<Event> avEvents;
85
86 if (!Events.ContainsKey(avatarID))
87 {
88 avEvents = new List<Event>();
89 Events[avatarID] = avEvents;
90 }
91 else
92 {
93 avEvents = Events[avatarID];
94 }
95
96 avEvents.Add(new Event(name, args));
97 }
98
99 public void ClearEvents()
100 {
101 if (Events != null)
102 Events.Clear();
103 }
104
105 public bool Enqueue(OSD o, UUID avatarID)
106 {
107 AddEvent(avatarID, "Enqueue", o);
108 return true;
109 }
110
111 public void DisableSimulator(ulong handle, UUID avatarID)
112 {
113 AddEvent(avatarID, "DisableSimulator", handle);
114 }
115
116 public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID)
117 {
118 AddEvent(avatarID, "EnableSimulator", handle);
119 }
120
121 public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath)
122 {
123 AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath);
124 }
125
126 public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID)
127 {
128 AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL);
129 }
130
131 public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID)
132 {
133 AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID);
134 }
135
136 public void ChatterboxInvitation(
137 UUID sessionID, string sessionName, UUID fromAgent, string message, UUID toAgent, string fromName,
138 byte dialog, uint timeStamp, bool offline, int parentEstateID, Vector3 position, uint ttl,
139 UUID transactionID, bool fromGroup, byte[] binaryBucket)
140 {
141 AddEvent(
142 toAgent, "ChatterboxInvitation", sessionID, sessionName, fromAgent, message, toAgent, fromName, dialog,
143 timeStamp, offline, parentEstateID, position, ttl, transactionID, fromGroup, binaryBucket);
144 }
145
146 public void ChatterBoxSessionAgentListUpdates (UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, bool isModerator, bool textMute)
147 {
148 AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute);
149 }
150
151 public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
152 {
153 AddEvent(avatarID, "ParcelProperties", parcelPropertiesMessage);
154 }
155
156 public void GroupMembership (OpenMetaverse.Packets.AgentGroupDataUpdatePacket groupUpdate, UUID avatarID)
157 {
158 AddEvent(avatarID, "GroupMembership", groupUpdate);
159 }
160
161 public OSD ScriptRunningEvent (UUID objectID, UUID itemID, bool running, bool mono)
162 {
163 Console.WriteLine("ONE");
164 throw new System.NotImplementedException ();
165 }
166
167 public OSD BuildEvent (string eventName, OSD eventBody)
168 {
169 Console.WriteLine("TWO");
170 throw new System.NotImplementedException ();
171 }
172
173 public void partPhysicsProperties (uint localID, byte physhapetype, float density, float friction, float bounce, float gravmod, UUID avatarID)
174 {
175 AddEvent(avatarID, "partPhysicsProperties", localID, physhapetype, density, friction, bounce, gravmod);
176 }
177 }
178} \ No newline at end of file
diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll
index 5c0b3c6..c7216ce 100755
--- a/bin/OpenMetaverse.StructuredData.dll
+++ b/bin/OpenMetaverse.StructuredData.dll
Binary files differ
diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll
index 511096e..3e210ba 100755
--- a/bin/OpenMetaverse.dll
+++ b/bin/OpenMetaverse.dll
Binary files differ
diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll
index 8bc8885..6cc4c5a 100755
--- a/bin/OpenMetaverseTypes.dll
+++ b/bin/OpenMetaverseTypes.dll
Binary files differ
diff --git a/prebuild.xml b/prebuild.xml
index 2b8e963..0045128 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2833,6 +2833,7 @@
2833 <Reference name="Nini" path="../../../bin/"/> 2833 <Reference name="Nini" path="../../../bin/"/>
2834 <Reference name="nunit.framework" path="../../../bin/"/> 2834 <Reference name="nunit.framework" path="../../../bin/"/>
2835 <Reference name="OpenMetaverse" path="../../../bin/"/> 2835 <Reference name="OpenMetaverse" path="../../../bin/"/>
2836 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
2836 <Reference name="OpenMetaverseTypes" path="../../../bin/"/> 2837 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
2837 <Reference name="OpenSim.Data"/> 2838 <Reference name="OpenSim.Data"/>
2838 <Reference name="OpenSim.Data.Null"/> 2839 <Reference name="OpenSim.Data.Null"/>