From 4fed301e65b0eec38101c05bb52267200a8fda6b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 14 Feb 2014 23:43:07 +0000 Subject: Don't request group information in SP.MakeRootAgent() if the presence belongs to no group (UUID.Zero) This was trigger the XmlRpcGroups errors described in http://opensimulator.org/mantis/view.php?id=6986 Introduced in commit 5b73b9c4 (Wed Dec 11 01:39:56 2013) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 715a9b6..576b8c2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1057,30 +1057,32 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); - UUID groupUUID = UUID.Zero; - string GroupName = string.Empty; + UUID groupUUID = ControllingClient.ActiveGroupId; + string groupName = string.Empty; ulong groupPowers = 0; // ---------------------------------- // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status try { - if (gm != null) + if (groupUUID != UUID.Zero && gm != null) { - groupUUID = ControllingClient.ActiveGroupId; GroupRecord record = gm.GetGroupRecord(groupUUID); if (record != null) - GroupName = record.GroupName; + groupName = record.GroupName; + GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); + if (groupMembershipData != null) groupPowers = groupMembershipData.GroupPowers; } - ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, - Grouptitle); + + ControllingClient.SendAgentDataUpdate( + m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle); } catch (Exception e) { - m_log.Debug("[AGENTUPDATE]: " + e.ToString()); + m_log.Error("[AGENTUPDATE]: Error ", e); } // ------------------------------------ -- cgit v1.1 From 7fc289c039ca3cdbad0f050e17c1b1d13e684c73 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 15 Feb 2014 17:02:53 -0800 Subject: Properly restore position on crossing failure for mega-regions. Fix odd "cannot cross into banned parcel" viewer error message when crossing into non-existant region. Proper permission failure messages are now returned. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 ++++++++++++++++-------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 576b8c2..d4af9fc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3473,8 +3473,6 @@ namespace OpenSim.Region.Framework.Scenes Vector3 pos2 = AbsolutePosition; Vector3 origPosition = pos2; Vector3 vel = Velocity; - int neighbor = 0; - int[] fix = new int[2]; // Compute the avatar position in the next physics tick. // If the avatar will be crossing, we force the crossing to happen now @@ -3507,23 +3505,13 @@ namespace OpenSim.Region.Framework.Scenes if (m_requestedSitTargetUUID == UUID.Zero) { m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); - const float borderFudge = 0.1f; - - if (origPosition.X < 0) - origPosition.X = borderFudge; - else if (origPosition.X > (float)m_scene.RegionInfo.RegionSizeX) - origPosition.X = (float)m_scene.RegionInfo.RegionSizeX - borderFudge; - if (origPosition.Y < 0) - origPosition.Y = borderFudge; - else if (origPosition.Y > (float)m_scene.RegionInfo.RegionSizeY) - origPosition.Y = (float)m_scene.RegionInfo.RegionSizeY - borderFudge; + Velocity = Vector3.Zero; - AbsolutePosition = origPosition; + AbsolutePosition = EnforceSanityOnPosition(origPosition); AddToPhysicalScene(isFlying); } } - } } else @@ -3541,6 +3529,36 @@ namespace OpenSim.Region.Framework.Scenes } } + // Given a position, make sure it is within the current region. + // If just outside some border, the returned position will be just inside the border on that side. + private Vector3 EnforceSanityOnPosition(Vector3 origPosition) + { + const float borderFudge = 0.1f; + Vector3 ret = origPosition; + + // Sanity checking on the position to make sure it is in the region we couldn't cross from + float extentX = (float)m_scene.RegionInfo.RegionSizeX; + float extentY = (float)m_scene.RegionInfo.RegionSizeY; + IRegionCombinerModule combiner = m_scene.RequestModuleInterface(); + if (combiner != null) + { + // If a mega-region, the size could be much bigger + Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); + extentX = megaExtent.X; + extentY = megaExtent.Y; + } + if (ret.X < 0) + ret.X = borderFudge; + else if (ret.X >= extentX) + ret.X = extentX - borderFudge; + if (ret.Y < 0) + ret.Y = borderFudge; + else if (ret.Y >= extentY) + ret.Y = extentY - borderFudge; + + return ret; + } + /// /// Moves the agent outside the region bounds /// Tells neighbor region that we're crossing to it -- cgit v1.1