diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs index 21be82a305..4833f27cfb 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs @@ -78,6 +78,21 @@ namespace OpenSim.Region.Environment return buildEvent("EnableSimulator", llsdBody); } + public static OSD DisableSimulator(ulong Handle) + { + OSDMap llsdSimInfo = new OSDMap(1); + + llsdSimInfo.Add("Handle", new OSDBinary(regionHandleToByteArray(Handle))); + + OSDArray arr = new OSDArray(1); + arr.Add(llsdSimInfo); + + OSDMap llsdBody = new OSDMap(1); + llsdBody.Add("SimulatorInfo", arr); + + return buildEvent("DisableSimulator", llsdBody); + } + public static OSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID AgentID, UUID SessionID) diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index 9dd2426b61..5d34773e41 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -149,6 +149,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (destRegionUp) { + // Fixing a bug where teleporting while sitting results in the avatar ending up removed from // both regions if (avatar.ParentID != (uint)0) @@ -169,6 +170,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid agent.child = false; m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); + if (eq != null) + { + OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint); + eq.Enqueue(Item, avatar.UUID); + } + else + { + avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint); + // TODO: make Event Queue disablable! + } + m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, position, false); Thread.Sleep(2000); @@ -223,6 +235,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid { //SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); SendCloseChildAgentConnections(avatar.UUID, childRegions); + if (eq != null) + { + OSD Item = EventQueueHelper.DisableSimulator(m_regionInfo.RegionHandle); + eq.Enqueue(Item, avatar.UUID); + } + Thread.Sleep(2000); CloseConnection(avatar.UUID); } // if (teleport success) // seems to be always success here diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 64da9d4904..54d4298056 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -662,6 +662,7 @@ namespace OpenSim.Region.Environment.Scenes if (destRegionUp) { + // Fixing a bug where teleporting while sitting results in the avatar ending up removed from // both regions if (avatar.ParentID != (uint)0) @@ -681,6 +682,16 @@ namespace OpenSim.Region.Environment.Scenes avatar.Scene.RemoveCapsHandler(avatar.UUID); agent.child = false; m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); + + if (eq != null) + { + OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint); + eq.Enqueue(Item, avatar.UUID); + } + else + { + avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint); + } m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, position, false); @@ -724,8 +735,14 @@ namespace OpenSim.Region.Environment.Scenes uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) { - SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList()); + //SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList()); SendCloseChildAgentConnections(avatar.UUID, childRegions); + if (eq != null) + { + OSD Item = EventQueueHelper.DisableSimulator(m_regionInfo.RegionHandle); + eq.Enqueue(Item, avatar.UUID); + } + Thread.Sleep(2000); CloseConnection(avatar.UUID); } // if (teleport success) // seems to be always success here