aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs86
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs2
6 files changed, 105 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 416826c..f64a7a0 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -202,8 +202,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
202 202
203 string reason = String.Empty; 203 string reason = String.Empty;
204 204
205 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 205 if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
206 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
207 { 206 {
208 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", 207 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
209 reason)); 208 reason));
@@ -282,9 +281,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
282 avatar.CopyTo(agent); 281 avatar.CopyTo(agent);
283 agent.Position = position; 282 agent.Position = position;
284 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 283 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
285 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 284 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
286 285
287 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 286 m_scene.SimulationService.UpdateAgent(reg, agent);
288 287
289 m_log.DebugFormat( 288 m_log.DebugFormat(
290 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID); 289 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
@@ -322,8 +321,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
322 avatar.Scene.InformClientOfNeighbours(avatar); 321 avatar.Scene.InformClientOfNeighbours(avatar);
323 322
324 // Finally, kill the agent we just created at the destination. 323 // Finally, kill the agent we just created at the destination.
325 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); 324 m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
326
327 return; 325 return;
328 } 326 }
329 327
@@ -336,7 +334,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
336 avatar.MakeChildAgent(); 334 avatar.MakeChildAgent();
337 335
338 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 336 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
339 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 337 avatar.CrossAttachmentsIntoNewRegion(reg, true);
340 338
341 339
342 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 340 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a14c853..1c5c247 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1163,15 +1163,21 @@ namespace OpenSim.Region.Framework.Scenes
1163 1163
1164 private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) 1164 private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
1165 { 1165 {
1166 if (folder == null)
1167 return;
1168
1166 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); 1169 m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName);
1167 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); 1170 InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
1168 InventoryFolderBase containingFolder = new InventoryFolderBase(); 1171 InventoryFolderBase containingFolder = new InventoryFolderBase();
1169 containingFolder.ID = folder.ID; 1172 containingFolder.ID = folder.ID;
1170 containingFolder.Owner = client.AgentId; 1173 containingFolder.Owner = client.AgentId;
1171 containingFolder = InventoryService.GetFolder(containingFolder); 1174 containingFolder = InventoryService.GetFolder(containingFolder);
1172 int version = containingFolder.Version; 1175 if (containingFolder != null)
1176 {
1177 int version = containingFolder.Version;
1173 1178
1174 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); 1179 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
1180 }
1175 } 1181 }
1176 1182
1177 /// <summary> 1183 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 20c0622..d8874b2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -253,6 +253,49 @@ namespace OpenSim.Region.Framework.Scenes
253 } 253 }
254 } 254 }
255 255
256 protected ISimulationService m_simulationService;
257 public ISimulationService SimulationService
258 {
259 get
260 {
261 if (m_simulationService == null)
262 m_simulationService = RequestModuleInterface<ISimulationService>();
263 return m_simulationService;
264 }
265 }
266
267 protected IAuthenticationService m_AuthenticationService;
268 public IAuthenticationService AuthenticationService
269 {
270 get
271 {
272 if (m_AuthenticationService == null)
273 m_AuthenticationService = RequestModuleInterface<IAuthenticationService>();
274 return m_AuthenticationService;
275 }
276 }
277
278 protected IPresenceService m_PresenceService;
279 public IPresenceService PresenceService
280 {
281 get
282 {
283 if (m_PresenceService == null)
284 m_PresenceService = RequestModuleInterface<IPresenceService>();
285 return m_PresenceService;
286 }
287 }
288 protected IUserAccountService m_UserAccountService;
289 public IUserAccountService UserAccountService
290 {
291 get
292 {
293 if (m_UserAccountService == null)
294 m_UserAccountService = RequestModuleInterface<IUserAccountService>();
295 return m_UserAccountService;
296 }
297 }
298
256 protected IXMLRPC m_xmlrpcModule; 299 protected IXMLRPC m_xmlrpcModule;
257 protected IWorldComm m_worldCommModule; 300 protected IWorldComm m_worldCommModule;
258 protected IAvatarFactory m_AvatarFactory; 301 protected IAvatarFactory m_AvatarFactory;
@@ -262,8 +305,6 @@ namespace OpenSim.Region.Framework.Scenes
262 } 305 }
263 protected IConfigSource m_config; 306 protected IConfigSource m_config;
264 protected IRegionSerialiserModule m_serialiser; 307 protected IRegionSerialiserModule m_serialiser;
265 protected IInterregionCommsOut m_interregionCommsOut;
266 protected IInterregionCommsIn m_interregionCommsIn;
267 protected IDialogModule m_dialogModule; 308 protected IDialogModule m_dialogModule;
268 protected ITeleportModule m_teleportModule; 309 protected ITeleportModule m_teleportModule;
269 310
@@ -1136,8 +1177,6 @@ namespace OpenSim.Region.Framework.Scenes
1136 XferManager = RequestModuleInterface<IXfer>(); 1177 XferManager = RequestModuleInterface<IXfer>();
1137 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); 1178 m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
1138 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); 1179 m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
1139 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
1140 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
1141 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1180 m_dialogModule = RequestModuleInterface<IDialogModule>();
1142 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1181 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1143 m_teleportModule = RequestModuleInterface<ITeleportModule>(); 1182 m_teleportModule = RequestModuleInterface<ITeleportModule>();
@@ -2155,7 +2194,10 @@ namespace OpenSim.Region.Framework.Scenes
2155 grp.OffsetForNewRegion(pos); 2194 grp.OffsetForNewRegion(pos);
2156 2195
2157 // If we fail to cross the border, then reset the position of the scene object on that border. 2196 // If we fail to cross the border, then reset the position of the scene object on that border.
2158 if (!CrossPrimGroupIntoNewRegion(newRegionHandle, grp, silent)) 2197 uint x = 0, y = 0;
2198 Utils.LongToUInts(newRegionHandle, out x, out y);
2199 GridRegion destination = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
2200 if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent))
2159 { 2201 {
2160 grp.OffsetForNewRegion(oldGroupPosition); 2202 grp.OffsetForNewRegion(oldGroupPosition);
2161 grp.ScheduleGroupForFullUpdate(); 2203 grp.ScheduleGroupForFullUpdate();
@@ -2351,7 +2393,7 @@ namespace OpenSim.Region.Framework.Scenes
2351 /// true if the crossing itself was successful, false on failure 2393 /// true if the crossing itself was successful, false on failure
2352 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region 2394 /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
2353 /// </returns> 2395 /// </returns>
2354 public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) 2396 public bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
2355 { 2397 {
2356 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); 2398 //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
2357 2399
@@ -2359,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes
2359 grp.RootPart.UpdateFlag = 0; 2401 grp.RootPart.UpdateFlag = 0;
2360 //int primcrossingXMLmethod = 0; 2402 //int primcrossingXMLmethod = 0;
2361 2403
2362 if (newRegionHandle != 0) 2404 if (destination != null)
2363 { 2405 {
2364 //string objectState = grp.GetStateSnapshot(); 2406 //string objectState = grp.GetStateSnapshot();
2365 2407
@@ -2372,9 +2414,11 @@ namespace OpenSim.Region.Framework.Scenes
2372 // newRegionHandle, grp.UUID, objectState, 100); 2414 // newRegionHandle, grp.UUID, objectState, 100);
2373 //} 2415 //}
2374 2416
2375 // And the new channel... 2417 //// And the new channel...
2376 if (m_interregionCommsOut != null) 2418 //if (m_interregionCommsOut != null)
2377 successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); 2419 // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
2420 if (m_simulationService != null)
2421 successYN = m_simulationService.CreateObject(destination, grp, true);
2378 2422
2379 if (successYN) 2423 if (successYN)
2380 { 2424 {
@@ -2405,7 +2449,7 @@ namespace OpenSim.Region.Framework.Scenes
2405 } 2449 }
2406 else 2450 else
2407 { 2451 {
2408 m_log.Error("[INTERREGION]: region handle was unexpectedly 0 in Scene.CrossPrimGroupIntoNewRegion()"); 2452 m_log.Error("[INTERREGION]: destination was unexpectedly null in Scene.CrossPrimGroupIntoNewRegion()");
2409 } 2453 }
2410 2454
2411 return successYN; 2455 return successYN;
@@ -2598,10 +2642,9 @@ namespace OpenSim.Region.Framework.Scenes
2598 m_log.Debug(logMsg); 2642 m_log.Debug(logMsg);
2599 */ 2643 */
2600 2644
2601 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2645 //CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2602 2646
2603 ScenePresence sp = CreateAndAddScenePresence(client); 2647 ScenePresence sp = CreateAndAddScenePresence(client);
2604
2605 // HERE!!! Do the initial attachments right here 2648 // HERE!!! Do the initial attachments right here
2606 // first agent upon login is a root agent by design. 2649 // first agent upon login is a root agent by design.
2607 // All other AddNewClient calls find aCircuit.child to be true 2650 // All other AddNewClient calls find aCircuit.child to be true
@@ -2614,6 +2657,7 @@ namespace OpenSim.Region.Framework.Scenes
2614 2657
2615 m_LastLogin = Util.EnvironmentTickCount(); 2658 m_LastLogin = Util.EnvironmentTickCount();
2616 EventManager.TriggerOnNewClient(client); 2659 EventManager.TriggerOnNewClient(client);
2660
2617 } 2661 }
2618 2662
2619 2663
@@ -3289,14 +3333,6 @@ namespace OpenSim.Region.Framework.Scenes
3289 m_sceneGridService.KiPrimitive += SendKillObject; 3333 m_sceneGridService.KiPrimitive += SendKillObject;
3290 m_sceneGridService.OnGetLandData += GetLandData; 3334 m_sceneGridService.OnGetLandData += GetLandData;
3291 3335
3292 if (m_interregionCommsIn != null)
3293 {
3294 m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
3295 m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3296 }
3297 else
3298 m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
3299
3300 } 3336 }
3301 3337
3302 /// <summary> 3338 /// <summary>
@@ -3314,9 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes
3314 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3350 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
3315 m_sceneGridService.OnGetLandData -= GetLandData; 3351 m_sceneGridService.OnGetLandData -= GetLandData;
3316 3352
3317 if (m_interregionCommsIn != null)
3318 m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3319
3320 // this does nothing; should be removed 3353 // this does nothing; should be removed
3321 m_sceneGridService.Close(); 3354 m_sceneGridService.Close();
3322 3355
@@ -3758,9 +3791,10 @@ namespace OpenSim.Region.Framework.Scenes
3758 return m_sceneGridService.ReleaseAgent(id); 3791 return m_sceneGridService.ReleaseAgent(id);
3759 } 3792 }
3760 3793
3761 public void SendReleaseAgent(ulong regionHandle, UUID id, string uri) 3794 public void SendReleaseAgent(UUID origin, UUID id, string uri)
3762 { 3795 {
3763 m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri); 3796 //m_interregionCommsOut.SendReleaseAgent(regionHandle, id, uri);
3797 m_simulationService.ReleaseAgent(origin, id, uri);
3764 } 3798 }
3765 3799
3766 /// <summary> 3800 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index f49d072..f612d17 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Region.Framework.Scenes
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 protected CommunicationsManager m_commsProvider; 59 protected CommunicationsManager m_commsProvider;
60 protected IInterregionCommsOut m_interregionCommsOut;
61 protected RegionInfo m_regionInfo; 60 protected RegionInfo m_regionInfo;
62 protected Scene m_scene; 61 protected Scene m_scene;
63 62
@@ -135,7 +134,6 @@ namespace OpenSim.Region.Framework.Scenes
135 { 134 {
136 m_scene = s; 135 m_scene = s;
137 m_regionInfo = s.RegionInfo; 136 m_regionInfo = s.RegionInfo;
138 m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>();
139 } 137 }
140 138
141 /// <summary> 139 /// <summary>
@@ -255,6 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
255 { 253 {
256 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; 254 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
257 icon.EndInvoke(iar); 255 icon.EndInvoke(iar);
256 m_log.WarnFormat(" --> InformClientOfNeighbourCompleted");
258 } 257 }
259 258
260 /// <summary> 259 /// <summary>
@@ -285,8 +284,8 @@ namespace OpenSim.Region.Framework.Scenes
285 284
286 string reason = String.Empty; 285 string reason = String.Empty;
287 286
288 287
289 bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); 288 bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
290 289
291 if (regionAccepted && newAgent) 290 if (regionAccepted && newAgent)
292 { 291 {
@@ -460,6 +459,7 @@ namespace OpenSim.Region.Framework.Scenes
460 int count = 0; 459 int count = 0;
461 foreach (GridRegion neighbour in neighbours) 460 foreach (GridRegion neighbour in neighbours)
462 { 461 {
462 m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName);
463 // Don't do it if there's already an agent in that region 463 // Don't do it if there's already an agent in that region
464 if (newRegions.Contains(neighbour.RegionHandle)) 464 if (newRegions.Contains(neighbour.RegionHandle))
465 newAgent = true; 465 newAgent = true;
@@ -600,7 +600,10 @@ namespace OpenSim.Region.Framework.Scenes
600 try 600 try
601 { 601 {
602 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); 602 //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
603 m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData); 603 uint x = 0, y = 0;
604 Utils.LongToUInts(regionHandle, out x, out y);
605 GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
606 m_scene.SimulationService.UpdateAgent(destination, cAgentData);
604 } 607 }
605 catch 608 catch
606 { 609 {
@@ -660,7 +663,10 @@ namespace OpenSim.Region.Framework.Scenes
660 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 663 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
661 664
662 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); 665 //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
663 m_interregionCommsOut.SendCloseAgent(regionHandle, agentID); 666 uint x = 0, y = 0;
667 Utils.LongToUInts(regionHandle, out x, out y);
668 GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
669 m_scene.SimulationService.CloseAgent(destination, agentID);
664 } 670 }
665 671
666 private void SendCloseChildAgentCompleted(IAsyncResult iar) 672 private void SendCloseChildAgentCompleted(IAsyncResult iar)
@@ -810,7 +816,7 @@ namespace OpenSim.Region.Framework.Scenes
810 816
811 // Let's create an agent there if one doesn't exist yet. 817 // Let's create an agent there if one doesn't exist yet.
812 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) 818 //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
813 if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) 819 if (!m_scene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
814 { 820 {
815 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", 821 avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
816 reason)); 822 reason));
@@ -896,9 +902,9 @@ namespace OpenSim.Region.Framework.Scenes
896 avatar.CopyTo(agent); 902 avatar.CopyTo(agent);
897 agent.Position = position; 903 agent.Position = position;
898 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 904 agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
899 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 905 "/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionID.ToString() + "/release/";
900 906
901 m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent); 907 m_scene.SimulationService.UpdateAgent(reg, agent);
902 908
903 m_log.DebugFormat( 909 m_log.DebugFormat(
904 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 910 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
@@ -929,7 +935,7 @@ namespace OpenSim.Region.Framework.Scenes
929 avatar.Scene.InformClientOfNeighbours(avatar); 935 avatar.Scene.InformClientOfNeighbours(avatar);
930 936
931 // Finally, kill the agent we just created at the destination. 937 // Finally, kill the agent we just created at the destination.
932 m_interregionCommsOut.SendCloseAgent(reg.RegionHandle, avatar.UUID); 938 m_scene.SimulationService.CloseAgent(reg, avatar.UUID);
933 939
934 return; 940 return;
935 } 941 }
@@ -943,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes
943 avatar.MakeChildAgent(); 949 avatar.MakeChildAgent();
944 950
945 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 951 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
946 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 952 avatar.CrossAttachmentsIntoNewRegion(reg, true);
947 953
948 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 954 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
949 955
@@ -1338,9 +1344,9 @@ namespace OpenSim.Region.Framework.Scenes
1338 if (isFlying) 1344 if (isFlying)
1339 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1345 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1340 cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + 1346 cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
1341 "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; 1347 "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionID.ToString() + "/release/";
1342 1348
1343 m_interregionCommsOut.SendChildAgentUpdate(neighbourHandle, cAgent); 1349 m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
1344 1350
1345 // Next, let's close the child agent connections that are too far away. 1351 // Next, let's close the child agent connections that are too far away.
1346 agent.CloseChildAgents(neighbourx, neighboury); 1352 agent.CloseChildAgents(neighbourx, neighboury);
@@ -1391,7 +1397,7 @@ namespace OpenSim.Region.Framework.Scenes
1391 // now we have a child agent in this region. Request all interesting data about other (root) agents 1397 // now we have a child agent in this region. Request all interesting data about other (root) agents
1392 agent.SendInitialFullUpdateToAllClients(); 1398 agent.SendInitialFullUpdateToAllClients();
1393 1399
1394 agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); 1400 agent.CrossAttachmentsIntoNewRegion(neighbourRegion, true);
1395 1401
1396 // m_scene.SendKillObject(m_localId); 1402 // m_scene.SendKillObject(m_localId);
1397 1403
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8545425..385a9cd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -246,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes
246 246
247 // For teleports and crossings callbacks 247 // For teleports and crossings callbacks
248 string m_callbackURI; 248 string m_callbackURI;
249 UUID m_originRegionID;
250
249 ulong m_rootRegionHandle; 251 ulong m_rootRegionHandle;
250 252
251 /// <value> 253 /// <value>
@@ -890,7 +892,9 @@ namespace OpenSim.Region.Framework.Scenes
890 presence.Animator.SendAnimPackToClient(ControllingClient); 892 presence.Animator.SendAnimPackToClient(ControllingClient);
891 } 893 }
892 894
895 m_log.Warn("BEFORE ON MAKE ROOT");
893 m_scene.EventManager.TriggerOnMakeRootAgent(this); 896 m_scene.EventManager.TriggerOnMakeRootAgent(this);
897 m_log.Warn("AFTER ON MAKE ROOT");
894 } 898 }
895 899
896 /// <summary> 900 /// <summary>
@@ -1094,7 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes
1094 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1098 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1095 { 1099 {
1096 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); 1100 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1097 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); 1101 Scene.SendReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1098 m_callbackURI = null; 1102 m_callbackURI = null;
1099 } 1103 }
1100 1104
@@ -1102,7 +1106,6 @@ namespace OpenSim.Region.Framework.Scenes
1102 1106
1103 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1107 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1104 SendInitialData(); 1108 SendInitialData();
1105
1106 } 1109 }
1107 1110
1108 /// <summary> 1111 /// <summary>
@@ -2482,7 +2485,7 @@ namespace OpenSim.Region.Framework.Scenes
2482 2485
2483 SendInitialFullUpdateToAllClients(); 2486 SendInitialFullUpdateToAllClients();
2484 SendAppearanceToAllOtherAgents(); 2487 SendAppearanceToAllOtherAgents();
2485 } 2488 }
2486 2489
2487 /// <summary> 2490 /// <summary>
2488 /// Tell the client for this scene presence what items it should be wearing now 2491 /// Tell the client for this scene presence what items it should be wearing now
@@ -2937,7 +2940,7 @@ namespace OpenSim.Region.Framework.Scenes
2937 public void CopyTo(AgentData cAgent) 2940 public void CopyTo(AgentData cAgent)
2938 { 2941 {
2939 cAgent.AgentID = UUID; 2942 cAgent.AgentID = UUID;
2940 cAgent.RegionHandle = m_rootRegionHandle; 2943 cAgent.RegionID = Scene.RegionInfo.RegionID;
2941 2944
2942 cAgent.Position = AbsolutePosition; 2945 cAgent.Position = AbsolutePosition;
2943 cAgent.Velocity = m_velocity; 2946 cAgent.Velocity = m_velocity;
@@ -3036,7 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes
3036 3039
3037 public void CopyFrom(AgentData cAgent) 3040 public void CopyFrom(AgentData cAgent)
3038 { 3041 {
3039 m_rootRegionHandle = cAgent.RegionHandle; 3042 m_originRegionID = cAgent.RegionID;
3040 3043
3041 m_callbackURI = cAgent.CallbackURI; 3044 m_callbackURI = cAgent.CallbackURI;
3042 3045
@@ -3406,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
3406 } 3409 }
3407 } 3410 }
3408 3411
3409 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) 3412 public bool CrossAttachmentsIntoNewRegion(GridRegion destination, bool silent)
3410 { 3413 {
3411 lock (m_attachments) 3414 lock (m_attachments)
3412 { 3415 {
@@ -3427,8 +3430,8 @@ namespace OpenSim.Region.Framework.Scenes
3427 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 3430 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3428 gobj.RootPart.IsAttachment = false; 3431 gobj.RootPart.IsAttachment = false;
3429 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); 3432 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3430 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); 3433 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
3431 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); 3434 m_scene.CrossPrimGroupIntoNewRegion(destination, gobj, silent);
3432 } 3435 }
3433 } 3436 }
3434 m_attachments.Clear(); 3437 m_attachments.Clear();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index f00dd66..51134a9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -373,7 +373,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
373 373
374 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); 374 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
375 375
376 Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); 376 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
377 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); 377 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
378 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 378 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
379 } 379 }