diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 102 |
1 files changed, 53 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d76f029..0b644b9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | 129 | ||
130 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation | 130 | private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation |
131 | private Vector3 m_avUnscriptedSitPos; // for non-scripted prims | 131 | private Vector3 m_avUnscriptedSitPos; // for non-scripted prims |
132 | private Vector3 m_lastPosition; | 132 | private Vector3 m_lastPosition; |
133 | private Vector3 m_lastWorldPosition; | 133 | private Vector3 m_lastWorldPosition; |
134 | private Quaternion m_lastRotation; | 134 | private Quaternion m_lastRotation; |
135 | private Vector3 m_lastVelocity; | 135 | private Vector3 m_lastVelocity; |
@@ -715,8 +715,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
715 | // Request info about all the (root) agents in this region | 715 | // Request info about all the (root) agents in this region |
716 | // Note: This won't send data *to* other clients in that region (children don't send) | 716 | // Note: This won't send data *to* other clients in that region (children don't send) |
717 | SendInitialFullUpdateToAllClients(); | 717 | SendInitialFullUpdateToAllClients(); |
718 | |||
719 | RegisterToEvents(); | 718 | RegisterToEvents(); |
719 | if (m_controllingClient != null) | ||
720 | { | ||
721 | m_controllingClient.ProcessPendingPackets(); | ||
722 | } | ||
720 | SetDirectionVectors(); | 723 | SetDirectionVectors(); |
721 | } | 724 | } |
722 | 725 | ||
@@ -858,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
858 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 861 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
859 | 862 | ||
860 | m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; | 863 | m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; |
861 | |||
862 | m_scene.SetRootAgentScene(m_uuid); | 864 | m_scene.SetRootAgentScene(m_uuid); |
863 | 865 | ||
864 | // Moved this from SendInitialData to ensure that m_appearance is initialized | 866 | // Moved this from SendInitialData to ensure that m_appearance is initialized |
@@ -875,22 +877,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
875 | { | 877 | { |
876 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); | 878 | Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); |
877 | pos.Y = crossedBorder.BorderLine.Z - 1; | 879 | pos.Y = crossedBorder.BorderLine.Z - 1; |
878 | } | 880 | } |
879 | 881 | ||
880 | //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet. | 882 | //If they're TP'ing in or logging in, we haven't had time to add any known child regions yet. |
881 | //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent, | 883 | //This has the unfortunate consequence that if somebody is TP'ing who is already a child agent, |
882 | //they'll bypass the landing point. But I can't think of any decent way of fixing this. | 884 | //they'll bypass the landing point. But I can't think of any decent way of fixing this. |
883 | if (KnownChildRegionHandles.Count == 0) | 885 | if (KnownChildRegionHandles.Count == 0) |
884 | { | 886 | { |
885 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 887 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
886 | if (land != null) | 888 | if (land != null) |
887 | { | 889 | { |
888 | //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni. | 890 | //Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni. |
889 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_userLevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid) | 891 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_userLevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid) |
890 | { | 892 | { |
891 | pos = land.LandData.UserLocation; | 893 | pos = land.LandData.UserLocation; |
892 | } | 894 | } |
893 | } | 895 | } |
894 | } | 896 | } |
895 | 897 | ||
896 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) | 898 | if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) |
@@ -1027,8 +1029,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1027 | bool isFlying = false; | 1029 | bool isFlying = false; |
1028 | 1030 | ||
1029 | if (m_physicsActor != null) | 1031 | if (m_physicsActor != null) |
1030 | isFlying = m_physicsActor.Flying; | 1032 | isFlying = m_physicsActor.Flying; |
1031 | 1033 | ||
1032 | RemoveFromPhysicalScene(); | 1034 | RemoveFromPhysicalScene(); |
1033 | Velocity = Vector3.Zero; | 1035 | Velocity = Vector3.Zero; |
1034 | AbsolutePosition = pos; | 1036 | AbsolutePosition = pos; |
@@ -1039,7 +1041,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1039 | SetHeight(m_appearance.AvatarHeight); | 1041 | SetHeight(m_appearance.AvatarHeight); |
1040 | } | 1042 | } |
1041 | 1043 | ||
1042 | SendTerseUpdateToAllClients(); | 1044 | SendTerseUpdateToAllClients(); |
1043 | 1045 | ||
1044 | } | 1046 | } |
1045 | 1047 | ||
@@ -1173,7 +1175,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1173 | pos.Z = ground + 1.5f; | 1175 | pos.Z = ground + 1.5f; |
1174 | AbsolutePosition = pos; | 1176 | AbsolutePosition = pos; |
1175 | } | 1177 | } |
1176 | |||
1177 | m_isChildAgent = false; | 1178 | m_isChildAgent = false; |
1178 | bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1179 | bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1179 | MakeRootAgent(AbsolutePosition, m_flying); | 1180 | MakeRootAgent(AbsolutePosition, m_flying); |
@@ -1745,14 +1746,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1745 | // else | 1746 | // else |
1746 | // { // single or child prim | 1747 | // { // single or child prim |
1747 | 1748 | ||
1748 | // } | 1749 | // } |
1749 | if (part == null) //CW: Part may be gone. llDie() for example. | 1750 | if (part == null) //CW: Part may be gone. llDie() for example. |
1750 | { | 1751 | { |
1751 | partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 1752 | partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
1752 | } | 1753 | } |
1753 | else | 1754 | else |
1754 | { | 1755 | { |
1755 | partRot = part.GetWorldRotation(); | 1756 | partRot = part.GetWorldRotation(); |
1756 | } | 1757 | } |
1757 | 1758 | ||
1758 | Quaternion partIRot = Quaternion.Inverse(partRot); | 1759 | Quaternion partIRot = Quaternion.Inverse(partRot); |
@@ -1760,22 +1761,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1760 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av | 1761 | Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av |
1761 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av | 1762 | Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av |
1762 | 1763 | ||
1763 | 1764 | ||
1764 | if (m_physicsActor == null) | 1765 | if (m_physicsActor == null) |
1765 | { | 1766 | { |
1766 | AddToPhysicalScene(false); | 1767 | AddToPhysicalScene(false); |
1768 | } | ||
1769 | //CW: If the part isn't null then we can set the current position | ||
1770 | if (part != null) | ||
1771 | { | ||
1772 | Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! | ||
1773 | AbsolutePosition = avWorldStandUp; //KF: Fix stand up. | ||
1774 | part.IsOccupied = false; | ||
1767 | } | 1775 | } |
1768 | //CW: If the part isn't null then we can set the current position | 1776 | else |
1769 | if (part != null) | 1777 | { |
1770 | { | 1778 | //CW: Since the part doesn't exist, a coarse standup position isn't an issue |
1771 | Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! | 1779 | AbsolutePosition = m_lastWorldPosition; |
1772 | AbsolutePosition = avWorldStandUp; //KF: Fix stand up. | ||
1773 | part.IsOccupied = false; | ||
1774 | } | ||
1775 | else | ||
1776 | { | ||
1777 | //CW: Since the part doesn't exist, a coarse standup position isn't an issue | ||
1778 | AbsolutePosition = m_lastWorldPosition; | ||
1779 | } | 1780 | } |
1780 | 1781 | ||
1781 | m_parentPosition = Vector3.Zero; | 1782 | m_parentPosition = Vector3.Zero; |
@@ -1930,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1930 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) | 1931 | // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5) |
1931 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) ) | 1932 | if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) ) |
1932 | { | 1933 | { |
1933 | autopilot = false; // close enough | 1934 | autopilot = false; // close enough |
1934 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. | 1935 | m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup. |
1935 | Not using the part's position because returning the AV to the last known standing | 1936 | Not using the part's position because returning the AV to the last known standing |
1936 | position is likely to be more friendly, isn't it? */ | 1937 | position is likely to be more friendly, isn't it? */ |
@@ -1939,7 +1940,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1939 | } // else the autopilot will get us close | 1940 | } // else the autopilot will get us close |
1940 | } | 1941 | } |
1941 | else | 1942 | else |
1942 | { // its a scripted sit | 1943 | { // its a scripted sit |
1943 | m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup. | 1944 | m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup. |
1944 | I *am* using the part's position this time because we have no real idea how far away | 1945 | I *am* using the part's position this time because we have no real idea how far away |
1945 | the avatar is from the sit target. */ | 1946 | the avatar is from the sit target. */ |
@@ -3744,7 +3745,10 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
3744 | m_scene = scene; | 3745 | m_scene = scene; |
3745 | 3746 | ||
3746 | RegisterToEvents(); | 3747 | RegisterToEvents(); |
3747 | 3748 | if (m_controllingClient != null) | |
3749 | { | ||
3750 | m_controllingClient.ProcessPendingPackets(); | ||
3751 | } | ||
3748 | /* | 3752 | /* |
3749 | AbsolutePosition = client.StartPos; | 3753 | AbsolutePosition = client.StartPos; |
3750 | 3754 | ||