aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs57
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs61
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs124
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs9
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs19
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
13 files changed, 156 insertions, 155 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index ce0b2fb..a626b82 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Framework
62 UUID AgentID { get; set; } 62 UUID AgentID { get; set; }
63 63
64 OSDMap Pack(); 64 OSDMap Pack();
65 void Unpack(OSDMap map); 65 void Unpack(OSDMap map, IScene scene);
66 } 66 }
67 67
68 /// <summary> 68 /// <summary>
@@ -122,7 +122,7 @@ namespace OpenSim.Framework
122 return args; 122 return args;
123 } 123 }
124 124
125 public void Unpack(OSDMap args) 125 public void Unpack(OSDMap args, IScene scene)
126 { 126 {
127 if (args.ContainsKey("region_handle")) 127 if (args.ContainsKey("region_handle"))
128 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); 128 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -329,6 +329,10 @@ namespace OpenSim.Framework
329 329
330 public string CallbackURI; 330 public string CallbackURI;
331 331
332 // These two must have the same Count
333 public List<ISceneObject> AttachmentObjects;
334 public List<string> AttachmentObjectStates;
335
332 public virtual OSDMap Pack() 336 public virtual OSDMap Pack()
333 { 337 {
334 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 338 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -441,7 +445,30 @@ namespace OpenSim.Framework
441 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 445 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
442 args["callback_uri"] = OSD.FromString(CallbackURI); 446 args["callback_uri"] = OSD.FromString(CallbackURI);
443 447
448 // Attachment objects for fatpack messages
449 if (AttachmentObjects != null)
450 {
451 int i = 0;
452 OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
453 foreach (ISceneObject so in AttachmentObjects)
454 {
455 OSDMap info = new OSDMap(4);
456 info["sog"] = OSD.FromString(so.ToXml2());
457 info["extra"] = OSD.FromString(so.ExtraToXmlString());
458 info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
459 try
460 {
461 info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
462 }
463 catch (IndexOutOfRangeException e)
464 {
465 m_log.WarnFormat("[CHILD AGENT DATA]: scrtips list is shorter than object list.");
466 }
444 467
468 attObjs.Add(info);
469 }
470 args["attach_objects"] = attObjs;
471 }
445 return args; 472 return args;
446 } 473 }
447 474
@@ -450,7 +477,7 @@ namespace OpenSim.Framework
450 /// Avoiding reflection makes it painful to write, but that's the price! 477 /// Avoiding reflection makes it painful to write, but that's the price!
451 /// </summary> 478 /// </summary>
452 /// <param name="hash"></param> 479 /// <param name="hash"></param>
453 public virtual void Unpack(OSDMap args) 480 public virtual void Unpack(OSDMap args, IScene scene)
454 { 481 {
455 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); 482 m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
456 483
@@ -628,6 +655,26 @@ namespace OpenSim.Framework
628 655
629 if (args["callback_uri"] != null) 656 if (args["callback_uri"] != null)
630 CallbackURI = args["callback_uri"].AsString(); 657 CallbackURI = args["callback_uri"].AsString();
658
659 // Attachment objects
660 if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
661 {
662 OSDArray attObjs = (OSDArray)(args["attach_objects"]);
663 AttachmentObjects = new List<ISceneObject>();
664 AttachmentObjectStates = new List<string>();
665 foreach (OSD o in attObjs)
666 {
667 if (o.Type == OSDType.Map)
668 {
669 OSDMap info = (OSDMap)o;
670 ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
671 so.ExtraFromXmlString(info["extra"].AsString());
672 so.HasGroupChanged = info["modified"].AsBoolean();
673 AttachmentObjects.Add(so);
674 AttachmentObjectStates.Add(info["state"].AsString());
675 }
676 }
677 }
631 } 678 }
632 679
633 public AgentData() 680 public AgentData()
@@ -655,9 +702,9 @@ namespace OpenSim.Framework
655 return base.Pack(); 702 return base.Pack();
656 } 703 }
657 704
658 public override void Unpack(OSDMap map) 705 public override void Unpack(OSDMap map, IScene scene)
659 { 706 {
660 base.Unpack(map); 707 base.Unpack(map, scene);
661 } 708 }
662 } 709 }
663} 710}
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index e7f8bfc..76de6be 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Framework.Tests
115 position2 = new AgentPosition(); 115 position2 = new AgentPosition();
116 116
117 Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition"); 117 Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
118 position2.Unpack(position1.Pack()); 118 position2.Unpack(position1.Pack(), null);
119 119
120 Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed"); 120 Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
121 Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed"); 121 Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index ff26264..520d794 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -562,14 +562,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
562 /// <param name="sp"></param> 562 /// <param name="sp"></param>
563 /// <param name="so"></param> 563 /// <param name="so"></param>
564 /// <param name="attachmentpoint"></param> 564 /// <param name="attachmentpoint"></param>
565 /// <param name="AttachOffset"></param> 565 /// <param name="attachOffset"></param>
566 /// <param name="silent"></param> 566 /// <param name="silent"></param>
567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) 567 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
568 { 568 {
569 // don't attach attachments to child agents
570 if (avatar.IsChildAgent) return;
571 569
572// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); 570 m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name,
571 attachmentpoint, attachOffset, so.RootPart.AttachedPos);
573 572
574 so.DetachFromBackup(); 573 so.DetachFromBackup();
575 574
@@ -590,8 +589,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
590 so.RootPart.PhysActor = null; 589 so.RootPart.PhysActor = null;
591 } 590 }
592 591
593 so.AbsolutePosition = AttachOffset; 592 so.AbsolutePosition = attachOffset;
594 so.RootPart.AttachedPos = AttachOffset; 593 so.RootPart.AttachedPos = attachOffset;
595 so.RootPart.IsAttachment = true; 594 so.RootPart.IsAttachment = true;
596 595
597 so.RootPart.SetParentLocalId(avatar.LocalId); 596 so.RootPart.SetParentLocalId(avatar.LocalId);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c88be7d..1054785 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -285,11 +285,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
285 } 285 }
286 286
287 string reason; 287 string reason;
288 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason)) 288 string version;
289 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
289 { 290 {
290 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason); 291 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
291 return; 292 return;
292 } 293 }
294 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
293 295
294 sp.ControllingClient.SendTeleportStart(teleportFlags); 296 sp.ControllingClient.SendTeleportStart(teleportFlags);
295 297
@@ -371,20 +373,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
371 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 373 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
372 } 374 }
373 375
374 // Expect avatar crossing is a heavy-duty function at the destination.
375 // That is where MakeRoot is called, which fetches appearance and inventory.
376 // Plus triggers OnMakeRoot, which spawns a series of asynchronous updates.
377 //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
378 // position, false);
379
380 //{
381 // avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
382 // // We should close that agent we just created over at destination...
383 // List<ulong> lst = new List<ulong>();
384 // lst.Add(reg.RegionHandle);
385 // SendCloseChildAgentAsync(avatar.UUID, lst);
386 // return;
387 //}
388 376
389 SetInTransit(sp.UUID); 377 SetInTransit(sp.UUID);
390 378
@@ -426,7 +414,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
426 414
427 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 415 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
428 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation 416 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
429 // that the client contacted the destination before we send the attachments and close things here. 417 // that the client contacted the destination before we close things here.
430 if (!WaitForCallback(sp.UUID)) 418 if (!WaitForCallback(sp.UUID))
431 { 419 {
432 m_log.WarnFormat( 420 m_log.WarnFormat(
@@ -437,14 +425,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
437 return; 425 return;
438 } 426 }
439 427
440 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 428 // For backwards compatibility
441 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 429 if (version == "Unknown" || version == string.Empty)
430 {
431 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
432 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old simulator, sending attachments one by one...");
433 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
434 }
435
436 // May need to logout or other cleanup
437 AgentHasMovedAway(sp, logout);
442 438
443 // Well, this is it. The agent is over there. 439 // Well, this is it. The agent is over there.
444 KillEntity(sp.Scene, sp.LocalId); 440 KillEntity(sp.Scene, sp.LocalId);
445 441
446 // May need to logout or other cleanup
447 AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
448 442
449 // Now let's make it officially a child agent 443 // Now let's make it officially a child agent
450 sp.MakeChildAgent(); 444 sp.MakeChildAgent();
@@ -513,8 +507,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
513 507
514 } 508 }
515 509
516 protected virtual void AgentHasMovedAway(UUID sessionID, bool logout) 510 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
517 { 511 {
512 foreach (SceneObjectGroup sop in sp.Attachments)
513 {
514 sop.Scene.DeleteSceneObject(sop, true);
515 }
516 sp.Attachments.Clear();
518 } 517 }
519 518
520 protected void KillEntity(Scene scene, uint localID) 519 protected void KillEntity(Scene scene, uint localID)
@@ -784,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
784 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 783 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
785 784
786 string reason; 785 string reason;
787 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason)) 786 string version;
787 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
788 { 788 {
789 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); 789 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
790 if (r == null) 790 if (r == null)
@@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
804 agent.InTransit(); 804 agent.InTransit();
805 805
806 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 806 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
807 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, CrossAgentToNewRegionCompleted, d); 807 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
808 808
809 return true; 809 return true;
810 } 810 }
@@ -861,17 +861,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
861 icon.EndInvoke(iar); 861 icon.EndInvoke(iar);
862 } 862 }
863 863
864 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying); 864 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
865 865
866 /// <summary> 866 /// <summary>
867 /// This Closes child agents on neighbouring regions 867 /// This Closes child agents on neighbouring regions
868 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 868 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
869 /// </summary> 869 /// </summary>
870 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying) 870 protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version)
871 { 871 {
872 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 872 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
873 873
874 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); 874 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
875 875
876 Scene m_scene = agent.Scene; 876 Scene m_scene = agent.Scene;
877 877
@@ -945,7 +945,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
945 agent.SendOtherAgentsAvatarDataToMe(); 945 agent.SendOtherAgentsAvatarDataToMe();
946 agent.SendOtherAgentsAppearanceToMe(); 946 agent.SendOtherAgentsAppearanceToMe();
947 947
948 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 948 // Backwards compatibility
949 if (version == "Unknown" || version == string.Empty)
950 {
951 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
952 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
953 }
954
955 AgentHasMovedAway(agent, false);
949 956
950 // the user may change their profile information in other region, 957 // the user may change their profile information in other region,
951 // so the userinfo in UserProfileCache is not reliable any more, delete it 958 // so the userinfo in UserProfileCache is not reliable any more, delete it
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 79e76b4..5c53f78 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -142,11 +142,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
142 return false; 142 return false;
143 } 143 }
144 144
145 protected override void AgentHasMovedAway(UUID sessionID, bool logout) 145 protected override void AgentHasMovedAway(ScenePresence sp, bool logout)
146 { 146 {
147 base.AgentHasMovedAway(sp, logout);
147 if (logout) 148 if (logout)
148 // Log them out of this grid 149 // Log them out of this grid
149 m_aScene.PresenceService.LogoutAgent(sessionID); 150 m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
150 } 151 }
151 152
152 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 153 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index a298b65..2cf02b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -41,6 +41,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService 41 public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
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 // Version of this service
45 private const string m_Version = "SIMULATION/0.1";
46
44 private List<Scene> m_sceneList = new List<Scene>(); 47 private List<Scene> m_sceneList = new List<Scene>();
45 48
46 private IEntityTransferModule m_AgentTransferModule; 49 private IEntityTransferModule m_AgentTransferModule;
@@ -257,9 +260,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 260 return false;
258 } 261 }
259 262
260 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 263 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
261 { 264 {
262 reason = "Communications failure"; 265 reason = "Communications failure";
266 version = m_Version;
263 if (destination == null) 267 if (destination == null)
264 return false; 268 return false;
265 269
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 67f4d60..7858f2a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -229,19 +229,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
229 229
230 } 230 }
231 231
232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
233 { 233 {
234 reason = "Communications failure"; 234 reason = "Communications failure";
235 version = "Unknown";
235 if (destination == null) 236 if (destination == null)
236 return false; 237 return false;
237 238
238 // Try local first 239 // Try local first
239 if (m_localBackend.QueryAccess(destination, id, position, out reason)) 240 if (m_localBackend.QueryAccess(destination, id, position, out version, out reason))
240 return true; 241 return true;
241 242
242 // else do the remote thing 243 // else do the remote thing
243 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 244 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
244 return m_remoteConnector.QueryAccess(destination, id, position, out reason); 245 return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason);
245 246
246 return false; 247 return false;
247 248
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 01de824..696c6ee 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2316,7 +2316,9 @@ namespace OpenSim.Region.Framework.Scenes
2316 /// <returns></returns> 2316 /// <returns></returns>
2317 public bool IncomingCreateObject(ISceneObject sog) 2317 public bool IncomingCreateObject(ISceneObject sog)
2318 { 2318 {
2319 //m_log.Debug(" >>> IncomingCreateObject(sog) <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); 2319 //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
2320 // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
2321
2320 SceneObjectGroup newObject; 2322 SceneObjectGroup newObject;
2321 try 2323 try
2322 { 2324 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 19a9506..bccbe68 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3361,6 +3361,8 @@ namespace OpenSim.Region.Framework.Scenes
3361 { 3361 {
3362 SceneObjectGroup sog = Copy(false); 3362 SceneObjectGroup sog = Copy(false);
3363 sog.m_isDeleted = false; 3363 sog.m_isDeleted = false;
3364 sog.RootPart.IsAttachment = false;
3365 sog.RootPart.GroupPosition = sog.RootPart.AttachedPos;
3364 return sog; 3366 return sog;
3365 } 3367 }
3366 3368
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e4413a9..507fc50 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3078,54 +3078,6 @@ namespace OpenSim.Region.Framework.Scenes
3078 3078
3079 cAgent.Appearance = new AvatarAppearance(m_appearance); 3079 cAgent.Appearance = new AvatarAppearance(m_appearance);
3080 3080
3081/*
3082 try
3083 {
3084 // We might not pass the Wearables in all cases...
3085 // They're only needed so that persistent changes to the appearance
3086 // are preserved in the new region where the user is moving to.
3087 // But in Hypergrid we might not let this happen.
3088 int i = 0;
3089 UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
3090 foreach (AvatarWearable aw in m_appearance.Wearables)
3091 {
3092 if (aw != null)
3093 {
3094 wears[i++] = aw.ItemID;
3095 wears[i++] = aw.AssetID;
3096 }
3097 else
3098 {
3099 wears[i++] = UUID.Zero;
3100 wears[i++] = UUID.Zero;
3101 }
3102 }
3103 cAgent.Wearables = wears;
3104
3105 cAgent.VisualParams = m_appearance.VisualParams;
3106
3107 if (m_appearance.Texture != null)
3108 cAgent.AgentTextures = m_appearance.Texture.GetBytes();
3109 }
3110 catch (Exception e)
3111 {
3112 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3113 }
3114
3115 //Attachments
3116 List<int> attPoints = m_appearance.GetAttachedPoints();
3117 if (attPoints != null)
3118 {
3119 //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3120 int i = 0;
3121 AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
3122 foreach (int point in attPoints)
3123 {
3124 attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3125 }
3126 cAgent.Attachments = attachs;
3127 }
3128*/
3129 lock (scriptedcontrols) 3081 lock (scriptedcontrols)
3130 { 3082 {
3131 ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; 3083 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
@@ -3145,9 +3097,21 @@ namespace OpenSim.Region.Framework.Scenes
3145 } 3097 }
3146 catch { } 3098 catch { }
3147 3099
3148 // cAgent.GroupID = ?? 3100 // Attachment objects
3149 // Groups??? 3101 if (m_attachments != null && m_attachments.Count > 0)
3150 3102 {
3103 cAgent.AttachmentObjects = new List<ISceneObject>();
3104 cAgent.AttachmentObjectStates = new List<string>();
3105 IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
3106 foreach (SceneObjectGroup sog in m_attachments)
3107 {
3108 // We need to make a copy and pass that copy
3109 // because of transfers withn the same sim
3110 ISceneObject clone = sog.CloneForNewScene();
3111 cAgent.AttachmentObjects.Add(clone);
3112 cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
3113 }
3114 }
3151 } 3115 }
3152 3116
3153 public void CopyFrom(AgentData cAgent) 3117 public void CopyFrom(AgentData cAgent)
@@ -3188,50 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes
3188 AddToPhysicalScene(isFlying); 3152 AddToPhysicalScene(isFlying);
3189 } 3153 }
3190 3154
3191/*
3192 uint i = 0;
3193 try
3194 {
3195 if (cAgent.Wearables == null)
3196 cAgent.Wearables = new UUID[0];
3197 AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
3198 for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
3199 {
3200 UUID itemId = cAgent.Wearables[n];
3201 UUID assetId = cAgent.Wearables[n + 1];
3202 wears[i++] = new AvatarWearable(itemId, assetId);
3203 }
3204 // m_appearance.Wearables = wears;
3205 Primitive.TextureEntry textures = null;
3206 if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
3207 textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
3208
3209 byte[] visuals = null;
3210
3211 if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
3212 visuals = (byte[])cAgent.VisualParams.Clone();
3213
3214 m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
3215 }
3216 catch (Exception e)
3217 {
3218 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3219 }
3220
3221 // Attachments
3222 try
3223 {
3224 if (cAgent.Attachments != null)
3225 {
3226 m_appearance.ClearAttachments();
3227 foreach (AvatarAttachment att in cAgent.Attachments)
3228 {
3229 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3230 }
3231 }
3232 }
3233 catch { }
3234*/
3235 try 3155 try
3236 { 3156 {
3237 lock (scriptedcontrols) 3157 lock (scriptedcontrols)
@@ -3261,8 +3181,18 @@ namespace OpenSim.Region.Framework.Scenes
3261 } 3181 }
3262 catch { } 3182 catch { }
3263 3183
3264 //cAgent.GroupID = ?? 3184 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3265 //Groups??? 3185 {
3186 m_attachments = new List<SceneObjectGroup>();
3187 int i = 0;
3188 foreach (ISceneObject so in cAgent.AttachmentObjects)
3189 {
3190 ((SceneObjectGroup)so).LocalId = 0;
3191 ((SceneObjectGroup)so).RootPart.UpdateFlag = 0;
3192 so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
3193 m_scene.IncomingCreateObject(so);
3194 }
3195 }
3266 } 3196 }
3267 3197
3268 public bool CopyAgent(out IAgentData agent) 3198 public bool CopyAgent(out IAgentData agent)
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 372a59c..8b6fb4f 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Server.Handlers.Simulation
50 public class AgentHandler 50 public class AgentHandler
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
53 private ISimulationService m_SimulationService; 54 private ISimulationService m_SimulationService;
54 55
55 protected bool m_Proxy = false; 56 protected bool m_Proxy = false;
@@ -275,7 +276,7 @@ namespace OpenSim.Server.Handlers.Simulation
275 AgentData agent = new AgentData(); 276 AgentData agent = new AgentData();
276 try 277 try
277 { 278 {
278 agent.Unpack(args); 279 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
279 } 280 }
280 catch (Exception ex) 281 catch (Exception ex)
281 { 282 {
@@ -295,7 +296,7 @@ namespace OpenSim.Server.Handlers.Simulation
295 AgentPosition agent = new AgentPosition(); 296 AgentPosition agent = new AgentPosition();
296 try 297 try
297 { 298 {
298 agent.Unpack(args); 299 agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle));
299 } 300 }
300 catch (Exception ex) 301 catch (Exception ex)
301 { 302 {
@@ -342,7 +343,8 @@ namespace OpenSim.Server.Handlers.Simulation
342 destination.RegionID = regionID; 343 destination.RegionID = regionID;
343 344
344 string reason; 345 string reason;
345 bool result = m_SimulationService.QueryAccess(destination, id, position, out reason); 346 string version;
347 bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason);
346 348
347 responsedata["int_response_code"] = HttpStatusCode.OK; 349 responsedata["int_response_code"] = HttpStatusCode.OK;
348 350
@@ -350,6 +352,7 @@ namespace OpenSim.Server.Handlers.Simulation
350 352
351 resp["success"] = OSD.FromBoolean(result); 353 resp["success"] = OSD.FromBoolean(result);
352 resp["reason"] = OSD.FromString(reason); 354 resp["reason"] = OSD.FromString(reason);
355 resp["version"] = OSD.FromString(version);
353 356
354 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); 357 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
355 } 358 }
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 93b3ae6..415b4f0 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -241,7 +241,7 @@ namespace OpenSim.Services.Connectors.Simulation
241 if (args != null) 241 if (args != null)
242 { 242 {
243 agent = new CompleteAgentData(); 243 agent = new CompleteAgentData();
244 agent.Unpack(args); 244 agent.Unpack(args, null);
245 return true; 245 return true;
246 } 246 }
247 } 247 }
@@ -256,9 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
256 256
257 /// <summary> 257 /// <summary>
258 /// </summary> 258 /// </summary>
259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason) 259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
260 { 260 {
261 reason = "Failed to contact destination"; 261 reason = "Failed to contact destination";
262 version = "Unknown";
262 263
263 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); 264 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
264 265
@@ -274,23 +275,27 @@ namespace OpenSim.Services.Connectors.Simulation
274 try 275 try
275 { 276 {
276 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); 277 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
278 OSDMap data = (OSDMap)result["_Result"];
279
277 bool success = result["success"].AsBoolean(); 280 bool success = result["success"].AsBoolean();
278 reason = result["reason"].AsString(); 281 reason = data["reason"].AsString();
282 if (data["version"] != null)
283 version = data["version"].AsString();
279 284
280 //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success); 285 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString());
281 286
282 if (!success) 287 if (!success)
283 { 288 {
284 if (result.ContainsKey("Message")) 289 if (data.ContainsKey("Message"))
285 { 290 {
286 string message = result["Message"].AsString(); 291 string message = data["Message"].AsString();
287 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region 292 if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region
288 { 293 {
289 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); 294 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
290 return true; 295 return true;
291 } 296 }
292 297
293 reason = result["Message"]; 298 reason = data["Message"];
294 } 299 }
295 else 300 else
296 { 301 {
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 55c9cc5..5f9ce6d 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces
67 67
68 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 68 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
69 69
70 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason); 70 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason);
71 71
72 /// <summary> 72 /// <summary>
73 /// Message from receiving region to departing region, telling it got contacted by the client. 73 /// Message from receiving region to departing region, telling it got contacted by the client.