aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2014-08-12 22:46:28 +0200
committerMelanie Thielker2014-08-12 22:46:28 +0200
commit96d89c590663b2fa20bb993122963e728d321e06 (patch)
treefd19e9d9ba3067c3c387442bc438ffa10737e85d /OpenSim/Region
parentMerge branch 'ubitworkmaster' (diff)
parentfix the damm thing (diff)
downloadopensim-SC-96d89c590663b2fa20bb993122963e728d321e06.zip
opensim-SC-96d89c590663b2fa20bb993122963e728d321e06.tar.gz
opensim-SC-96d89c590663b2fa20bb993122963e728d321e06.tar.bz2
opensim-SC-96d89c590663b2fa20bb993122963e728d321e06.tar.xz
Merge branch 'ubitworkmaster'
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs92
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs31
2 files changed, 73 insertions, 50 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
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index d2a6828..2764465 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -195,6 +195,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
195 } 195 }
196 196
197 scene.EventManager.OnNewClient += OnNewClient; 197 scene.EventManager.OnNewClient += OnNewClient;
198 scene.EventManager.OnMakeRootAgent += OnMakeRoot;
199 scene.EventManager.OnMakeChildAgent += OnMakeChild;
198 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 200 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
199 // The InstantMessageModule itself doesn't do this, 201 // The InstantMessageModule itself doesn't do this,
200 // so lets see if things explode if we don't do it 202 // so lets see if things explode if we don't do it
@@ -245,19 +247,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
245 #endregion 247 #endregion
246 248
247 #region EventHandlers 249 #region EventHandlers
250
251 private void OnMakeRoot(ScenePresence sp)
252 {
253 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
254
255 sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
256 // Used for Notices and Group Invites/Accept/Reject
257 sp.ControllingClient.OnInstantMessage += OnInstantMessage;
258 // Send client their groups information.
259// SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
260 // only send data viwer will ask rest later
261 OnAgentDataUpdateRequest(sp.ControllingClient, sp.UUID, sp.UUID);
262 }
263
264 private void OnMakeChild(ScenePresence sp)
265 {
266 if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
267
268 sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
269 sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
270 }
271
248 private void OnNewClient(IClientAPI client) 272 private void OnNewClient(IClientAPI client)
249 { 273 {
250 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 274 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
251 275
252 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
253 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 276 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
254 client.OnRequestAvatarProperties += OnRequestAvatarProperties; 277 client.OnRequestAvatarProperties += OnRequestAvatarProperties;
255
256 // Used for Notices and Group Invites/Accept/Reject
257 client.OnInstantMessage += OnInstantMessage;
258
259 // Send client their groups information.
260 SendAgentGroupDataUpdate(client, client.AgentId);
261 } 278 }
262 279
263 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 280 private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)