diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 715a9b6..d4af9fc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1057,30 +1057,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
1057 | 1057 | ||
1058 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 1058 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
1059 | 1059 | ||
1060 | UUID groupUUID = UUID.Zero; | 1060 | UUID groupUUID = ControllingClient.ActiveGroupId; |
1061 | string GroupName = string.Empty; | 1061 | string groupName = string.Empty; |
1062 | ulong groupPowers = 0; | 1062 | ulong groupPowers = 0; |
1063 | 1063 | ||
1064 | // ---------------------------------- | 1064 | // ---------------------------------- |
1065 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status | 1065 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status |
1066 | try | 1066 | try |
1067 | { | 1067 | { |
1068 | if (gm != null) | 1068 | if (groupUUID != UUID.Zero && gm != null) |
1069 | { | 1069 | { |
1070 | groupUUID = ControllingClient.ActiveGroupId; | ||
1071 | GroupRecord record = gm.GetGroupRecord(groupUUID); | 1070 | GroupRecord record = gm.GetGroupRecord(groupUUID); |
1072 | if (record != null) | 1071 | if (record != null) |
1073 | GroupName = record.GroupName; | 1072 | groupName = record.GroupName; |
1073 | |||
1074 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); | 1074 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); |
1075 | |||
1075 | if (groupMembershipData != null) | 1076 | if (groupMembershipData != null) |
1076 | groupPowers = groupMembershipData.GroupPowers; | 1077 | groupPowers = groupMembershipData.GroupPowers; |
1077 | } | 1078 | } |
1078 | ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, | 1079 | |
1079 | Grouptitle); | 1080 | ControllingClient.SendAgentDataUpdate( |
1081 | m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle); | ||
1080 | } | 1082 | } |
1081 | catch (Exception e) | 1083 | catch (Exception e) |
1082 | { | 1084 | { |
1083 | m_log.Debug("[AGENTUPDATE]: " + e.ToString()); | 1085 | m_log.Error("[AGENTUPDATE]: Error ", e); |
1084 | } | 1086 | } |
1085 | // ------------------------------------ | 1087 | // ------------------------------------ |
1086 | 1088 | ||
@@ -3471,8 +3473,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3471 | Vector3 pos2 = AbsolutePosition; | 3473 | Vector3 pos2 = AbsolutePosition; |
3472 | Vector3 origPosition = pos2; | 3474 | Vector3 origPosition = pos2; |
3473 | Vector3 vel = Velocity; | 3475 | Vector3 vel = Velocity; |
3474 | int neighbor = 0; | ||
3475 | int[] fix = new int[2]; | ||
3476 | 3476 | ||
3477 | // Compute the avatar position in the next physics tick. | 3477 | // Compute the avatar position in the next physics tick. |
3478 | // If the avatar will be crossing, we force the crossing to happen now | 3478 | // If the avatar will be crossing, we force the crossing to happen now |
@@ -3505,23 +3505,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3505 | if (m_requestedSitTargetUUID == UUID.Zero) | 3505 | if (m_requestedSitTargetUUID == UUID.Zero) |
3506 | { | 3506 | { |
3507 | m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); | 3507 | m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader); |
3508 | const float borderFudge = 0.1f; | 3508 | |
3509 | |||
3510 | if (origPosition.X < 0) | ||
3511 | origPosition.X = borderFudge; | ||
3512 | else if (origPosition.X > (float)m_scene.RegionInfo.RegionSizeX) | ||
3513 | origPosition.X = (float)m_scene.RegionInfo.RegionSizeX - borderFudge; | ||
3514 | if (origPosition.Y < 0) | ||
3515 | origPosition.Y = borderFudge; | ||
3516 | else if (origPosition.Y > (float)m_scene.RegionInfo.RegionSizeY) | ||
3517 | origPosition.Y = (float)m_scene.RegionInfo.RegionSizeY - borderFudge; | ||
3518 | Velocity = Vector3.Zero; | 3509 | Velocity = Vector3.Zero; |
3519 | AbsolutePosition = origPosition; | 3510 | AbsolutePosition = EnforceSanityOnPosition(origPosition); |
3520 | 3511 | ||
3521 | AddToPhysicalScene(isFlying); | 3512 | AddToPhysicalScene(isFlying); |
3522 | } | 3513 | } |
3523 | } | 3514 | } |
3524 | |||
3525 | } | 3515 | } |
3526 | } | 3516 | } |
3527 | else | 3517 | else |
@@ -3539,6 +3529,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3539 | } | 3529 | } |
3540 | } | 3530 | } |
3541 | 3531 | ||
3532 | // Given a position, make sure it is within the current region. | ||
3533 | // If just outside some border, the returned position will be just inside the border on that side. | ||
3534 | private Vector3 EnforceSanityOnPosition(Vector3 origPosition) | ||
3535 | { | ||
3536 | const float borderFudge = 0.1f; | ||
3537 | Vector3 ret = origPosition; | ||
3538 | |||
3539 | // Sanity checking on the position to make sure it is in the region we couldn't cross from | ||
3540 | float extentX = (float)m_scene.RegionInfo.RegionSizeX; | ||
3541 | float extentY = (float)m_scene.RegionInfo.RegionSizeY; | ||
3542 | IRegionCombinerModule combiner = m_scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
3543 | if (combiner != null) | ||
3544 | { | ||
3545 | // If a mega-region, the size could be much bigger | ||
3546 | Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | ||
3547 | extentX = megaExtent.X; | ||
3548 | extentY = megaExtent.Y; | ||
3549 | } | ||
3550 | if (ret.X < 0) | ||
3551 | ret.X = borderFudge; | ||
3552 | else if (ret.X >= extentX) | ||
3553 | ret.X = extentX - borderFudge; | ||
3554 | if (ret.Y < 0) | ||
3555 | ret.Y = borderFudge; | ||
3556 | else if (ret.Y >= extentY) | ||
3557 | ret.Y = extentY - borderFudge; | ||
3558 | |||
3559 | return ret; | ||
3560 | } | ||
3561 | |||
3542 | /// <summary> | 3562 | /// <summary> |
3543 | /// Moves the agent outside the region bounds | 3563 | /// Moves the agent outside the region bounds |
3544 | /// Tells neighbor region that we're crossing to it | 3564 | /// Tells neighbor region that we're crossing to it |