diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 62dea07..77d74ee 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -530,11 +530,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
530 | get | 530 | get |
531 | { | 531 | { |
532 | Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0); | 532 | Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0); |
533 | 533 | a.Normalize(); | |
534 | if (a == Vector3.Zero) | 534 | return a; |
535 | return a; | ||
536 | |||
537 | return Util.GetNormalizedVector(a); | ||
538 | } | 535 | } |
539 | } | 536 | } |
540 | #endregion | 537 | #endregion |
@@ -1113,9 +1110,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1113 | 1110 | ||
1114 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); | 1111 | //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); |
1115 | 1112 | ||
1116 | // m_log.InfoFormat( | 1113 | // m_log.InfoFormat( |
1117 | // "[SCENE]: Upgrading child to root agent for {0} in {1}", | 1114 | // "[SCENE]: Upgrading child to root agent for {0} in {1}", |
1118 | // Name, m_scene.RegionInfo.RegionName); | 1115 | // Name, m_scene.RegionInfo.RegionName); |
1119 | 1116 | ||
1120 | if (ParentUUID != UUID.Zero) | 1117 | if (ParentUUID != UUID.Zero) |
1121 | { | 1118 | { |
@@ -1148,44 +1145,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
1148 | // Must reset this here so that a teleport to a region next to an existing region does not keep the flag | 1145 | // Must reset this here so that a teleport to a region next to an existing region does not keep the flag |
1149 | // set and prevent the close of the connection on a subsequent re-teleport. | 1146 | // set and prevent the close of the connection on a subsequent re-teleport. |
1150 | // Should not be needed if we are not trying to tell this region to close | 1147 | // Should not be needed if we are not trying to tell this region to close |
1151 | // DoNotCloseAfterTeleport = false; | 1148 | // DoNotCloseAfterTeleport = false; |
1152 | 1149 | ||
1153 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 1150 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
1154 | if (gm != null) | 1151 | if (gm != null) |
1155 | Grouptitle = gm.GetGroupTitle(m_uuid); | 1152 | Grouptitle = gm.GetGroupTitle(m_uuid); |
1156 | 1153 | ||
1157 | RegionHandle = m_scene.RegionInfo.RegionHandle; | 1154 | RegionHandle = m_scene.RegionInfo.RegionHandle; |
1158 | 1155 | ||
1159 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); | 1156 | m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); |
1160 | 1157 | ||
1158 | /* this should be done by groups module on TriggerOnMakeRootAgent(this) below | ||
1159 | at least XmlIRpcGroups | ||
1161 | UUID groupUUID = UUID.Zero; | 1160 | UUID groupUUID = UUID.Zero; |
1162 | string GroupName = string.Empty; | 1161 | string GroupName = string.Empty; |
1163 | ulong groupPowers = 0; | 1162 | ulong groupPowers = 0; |
1164 | 1163 | ||
1165 | // ---------------------------------- | ||
1166 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status | ||
1167 | try | ||
1168 | { | ||
1169 | |||
1170 | if (gm != null) | ||
1171 | { | ||
1172 | groupUUID = ControllingClient.ActiveGroupId; | ||
1173 | GroupRecord record = gm.GetGroupRecord(groupUUID); | ||
1174 | if (record != null) | ||
1175 | GroupName = record.GroupName; | ||
1176 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); | ||
1177 | if (groupMembershipData != null) | ||
1178 | groupPowers = groupMembershipData.GroupPowers; | ||
1179 | } | ||
1180 | ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, | ||
1181 | Grouptitle); | ||
1182 | } | ||
1183 | catch (Exception e) | ||
1184 | { | ||
1185 | m_log.Debug("[AGENTUPDATE]: " + e.ToString()); | ||
1186 | } | ||
1187 | // ------------------------------------ | ||
1188 | 1164 | ||
1165 | |||
1166 | |||
1167 | // ---------------------------------- | ||
1168 | // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status | ||
1169 | try | ||
1170 | { | ||
1171 | |||
1172 | if (gm != null) | ||
1173 | { | ||
1174 | groupUUID = ControllingClient.ActiveGroupId; | ||
1175 | GroupRecord record = gm.GetGroupRecord(groupUUID); | ||
1176 | if (record != null) | ||
1177 | GroupName = record.GroupName; | ||
1178 | GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); | ||
1179 | if (groupMembershipData != null) | ||
1180 | groupPowers = groupMembershipData.GroupPowers; | ||
1181 | } | ||
1182 | ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, | ||
1183 | Grouptitle); | ||
1184 | } | ||
1185 | catch (Exception e) | ||
1186 | { | ||
1187 | m_log.Debug("[AGENTUPDATE]: " + e.ToString()); | ||
1188 | } | ||
1189 | // ------------------------------------ | ||
1190 | */ | ||
1189 | if (ParentID == 0) | 1191 | if (ParentID == 0) |
1190 | { | 1192 | { |
1191 | // Moved this from SendInitialData to ensure that Appearance is initialized | 1193 | // Moved this from SendInitialData to ensure that Appearance is initialized |
@@ -1225,7 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1225 | 1227 | ||
1226 | if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) | 1228 | if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) |
1227 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | 1229 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; |
1228 | 1230 | ||
1229 | float newPosZ = posZLimit + localAVHeight / 2; | 1231 | float newPosZ = posZLimit + localAVHeight / 2; |
1230 | if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | 1232 | if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) |
1231 | { | 1233 | { |
@@ -1763,17 +1765,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1763 | return; | 1765 | return; |
1764 | } | 1766 | } |
1765 | 1767 | ||
1766 | Vector3 look = Velocity; | ||
1767 | |||
1768 | // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | ||
1769 | if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1)) | ||
1770 | { | ||
1771 | look = new Vector3(0.99f, 0.042f, 0); | ||
1772 | } | ||
1773 | |||
1774 | // Prevent teleporting to an underground location | 1768 | // Prevent teleporting to an underground location |
1775 | // (may crash client otherwise) | 1769 | // (may crash client otherwise) |
1776 | // | 1770 | // |
1771 | |||
1772 | /* this is done in MakeRootAgent | ||
1777 | Vector3 pos = AbsolutePosition; | 1773 | Vector3 pos = AbsolutePosition; |
1778 | float ground = m_scene.GetGroundHeight(pos.X, pos.Y); | 1774 | float ground = m_scene.GetGroundHeight(pos.X, pos.Y); |
1779 | if (pos.Z < ground + 1.5f) | 1775 | if (pos.Z < ground + 1.5f) |
@@ -1781,7 +1777,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1781 | pos.Z = ground + 1.5f; | 1777 | pos.Z = ground + 1.5f; |
1782 | AbsolutePosition = pos; | 1778 | AbsolutePosition = pos; |
1783 | } | 1779 | } |
1784 | 1780 | */ | |
1785 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1781 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1786 | if (!MakeRootAgent(AbsolutePosition, flying)) | 1782 | if (!MakeRootAgent(AbsolutePosition, flying)) |
1787 | { | 1783 | { |
@@ -1792,6 +1788,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1792 | return; | 1788 | return; |
1793 | } | 1789 | } |
1794 | 1790 | ||
1791 | Vector3 look = Lookat; | ||
1792 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | ||
1793 | { | ||
1794 | look = Velocity; | ||
1795 | look.Z = 0; | ||
1796 | look.Normalize(); | ||
1797 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) | ||
1798 | look = new Vector3(0.99f, 0.042f, 0); | ||
1799 | } | ||
1800 | |||
1795 | // Tell the client that we're totally ready | 1801 | // Tell the client that we're totally ready |
1796 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1802 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1797 | 1803 | ||