diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 90 |
1 files changed, 41 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6b95624..b8a937a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -33,12 +33,12 @@ using OpenMetaverse; | |||
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Client; | 35 | using OpenSim.Framework.Client; |
36 | using OpenSim.Framework.Communications.Cache; | ||
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes.Animation; | 37 | using OpenSim.Region.Framework.Scenes.Animation; |
39 | using OpenSim.Region.Framework.Scenes.Types; | 38 | using OpenSim.Region.Framework.Scenes.Types; |
40 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
41 | using OpenSim.Services.Interfaces; | ||
42 | 42 | ||
43 | namespace OpenSim.Region.Framework.Scenes | 43 | namespace OpenSim.Region.Framework.Scenes |
44 | { | 44 | { |
@@ -225,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
225 | // Agent's Draw distance. | 225 | // Agent's Draw distance. |
226 | protected float m_DrawDistance; | 226 | protected float m_DrawDistance; |
227 | 227 | ||
228 | protected AvatarAppearance m_appearance; | 228 | protected AvatarAppearance m_appearance; |
229 | 229 | ||
230 | // neighbouring regions we have enabled a child agent in | 230 | // neighbouring regions we have enabled a child agent in |
231 | // holds the seed cap for the child agent in that region | 231 | // holds the seed cap for the child agent in that region |
@@ -254,6 +254,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
254 | 254 | ||
255 | // For teleports and crossings callbacks | 255 | // For teleports and crossings callbacks |
256 | string m_callbackURI; | 256 | string m_callbackURI; |
257 | UUID m_originRegionID; | ||
258 | |||
257 | ulong m_rootRegionHandle; | 259 | ulong m_rootRegionHandle; |
258 | 260 | ||
259 | /// <value> | 261 | /// <value> |
@@ -1081,6 +1083,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1081 | /// </summary> | 1083 | /// </summary> |
1082 | public void CompleteMovement() | 1084 | public void CompleteMovement() |
1083 | { | 1085 | { |
1086 | //m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); | ||
1087 | |||
1084 | Vector3 look = Velocity; | 1088 | Vector3 look = Velocity; |
1085 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | 1089 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) |
1086 | { | 1090 | { |
@@ -1105,7 +1109,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1105 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1109 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1106 | { | 1110 | { |
1107 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | 1111 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); |
1108 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | 1112 | Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); |
1109 | m_callbackURI = null; | 1113 | m_callbackURI = null; |
1110 | } | 1114 | } |
1111 | 1115 | ||
@@ -1113,6 +1117,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1113 | 1117 | ||
1114 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1118 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1115 | SendInitialData(); | 1119 | SendInitialData(); |
1120 | |||
1121 | // Create child agents in neighbouring regions | ||
1122 | if (!m_isChildAgent) | ||
1123 | { | ||
1124 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
1125 | if (m_agentTransfer != null) | ||
1126 | m_agentTransfer.EnableChildAgents(this); | ||
1127 | else | ||
1128 | m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); | ||
1129 | } | ||
1130 | |||
1116 | } | 1131 | } |
1117 | 1132 | ||
1118 | /// <summary> | 1133 | /// <summary> |
@@ -2171,6 +2186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2171 | { | 2186 | { |
2172 | if (m_isChildAgent) | 2187 | if (m_isChildAgent) |
2173 | { | 2188 | { |
2189 | // WHAT??? | ||
2174 | m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); | 2190 | m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); |
2175 | 2191 | ||
2176 | // we have to reset the user's child agent connections. | 2192 | // we have to reset the user's child agent connections. |
@@ -2194,7 +2210,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2194 | 2210 | ||
2195 | if (m_scene.SceneGridService != null) | 2211 | if (m_scene.SceneGridService != null) |
2196 | { | 2212 | { |
2197 | m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); | 2213 | IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
2214 | if (m_agentTransfer != null) | ||
2215 | m_agentTransfer.EnableChildAgents(this); | ||
2198 | } | 2216 | } |
2199 | 2217 | ||
2200 | return; | 2218 | return; |
@@ -2491,14 +2509,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2491 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, | 2509 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, |
2492 | pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); | 2510 | pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); |
2493 | 2511 | ||
2494 | if (!m_isChildAgent) | ||
2495 | { | ||
2496 | m_scene.InformClientOfNeighbours(this); | ||
2497 | } | ||
2498 | |||
2499 | SendInitialFullUpdateToAllClients(); | 2512 | SendInitialFullUpdateToAllClients(); |
2500 | SendAppearanceToAllOtherAgents(); | 2513 | SendAppearanceToAllOtherAgents(); |
2501 | } | 2514 | } |
2502 | 2515 | ||
2503 | /// <summary> | 2516 | /// <summary> |
2504 | /// Tell the client for this scene presence what items it should be wearing now | 2517 | /// Tell the client for this scene presence what items it should be wearing now |
@@ -2578,14 +2591,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2578 | } | 2591 | } |
2579 | } | 2592 | } |
2580 | } | 2593 | } |
2594 | |||
2581 | } | 2595 | } |
2582 | 2596 | ||
2597 | |||
2583 | #endregion Bake Cache Check | 2598 | #endregion Bake Cache Check |
2584 | 2599 | ||
2585 | m_appearance.SetAppearance(textureEntry, visualParams); | 2600 | m_appearance.SetAppearance(textureEntry, visualParams); |
2586 | if (m_appearance.AvatarHeight > 0) | 2601 | if (m_appearance.AvatarHeight > 0) |
2587 | SetHeight(m_appearance.AvatarHeight); | 2602 | SetHeight(m_appearance.AvatarHeight); |
2588 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 2603 | |
2604 | // This is not needed, because only the transient data changed | ||
2605 | //AvatarData adata = new AvatarData(m_appearance); | ||
2606 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2589 | 2607 | ||
2590 | SendAppearanceToAllOtherAgents(); | 2608 | SendAppearanceToAllOtherAgents(); |
2591 | if (!m_startAnimationSet) | 2609 | if (!m_startAnimationSet) |
@@ -2605,7 +2623,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2605 | public void SetWearable(int wearableId, AvatarWearable wearable) | 2623 | public void SetWearable(int wearableId, AvatarWearable wearable) |
2606 | { | 2624 | { |
2607 | m_appearance.SetWearable(wearableId, wearable); | 2625 | m_appearance.SetWearable(wearableId, wearable); |
2608 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); | 2626 | AvatarData adata = new AvatarData(m_appearance); |
2627 | m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2609 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | 2628 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); |
2610 | } | 2629 | } |
2611 | 2630 | ||
@@ -2889,11 +2908,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2889 | // For now, assign god level 200 to anyone | 2908 | // For now, assign god level 200 to anyone |
2890 | // who is granted god powers, but has no god level set. | 2909 | // who is granted god powers, but has no god level set. |
2891 | // | 2910 | // |
2892 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); | 2911 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID); |
2893 | if (profile.UserProfile.GodLevel > 0) | 2912 | if (account != null) |
2894 | m_godlevel = profile.UserProfile.GodLevel; | 2913 | { |
2895 | else | 2914 | if (account.UserLevel > 0) |
2896 | m_godlevel = 200; | 2915 | m_godlevel = account.UserLevel; |
2916 | else | ||
2917 | m_godlevel = 200; | ||
2918 | } | ||
2897 | } | 2919 | } |
2898 | else | 2920 | else |
2899 | { | 2921 | { |
@@ -2959,7 +2981,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2959 | public void CopyTo(AgentData cAgent) | 2981 | public void CopyTo(AgentData cAgent) |
2960 | { | 2982 | { |
2961 | cAgent.AgentID = UUID; | 2983 | cAgent.AgentID = UUID; |
2962 | cAgent.RegionHandle = m_rootRegionHandle; | 2984 | cAgent.RegionID = Scene.RegionInfo.RegionID; |
2963 | 2985 | ||
2964 | cAgent.Position = AbsolutePosition; | 2986 | cAgent.Position = AbsolutePosition; |
2965 | cAgent.Velocity = m_velocity; | 2987 | cAgent.Velocity = m_velocity; |
@@ -3058,7 +3080,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3058 | 3080 | ||
3059 | public void CopyFrom(AgentData cAgent) | 3081 | public void CopyFrom(AgentData cAgent) |
3060 | { | 3082 | { |
3061 | m_rootRegionHandle = cAgent.RegionHandle; | 3083 | m_originRegionID = cAgent.RegionID; |
3062 | 3084 | ||
3063 | m_callbackURI = cAgent.CallbackURI; | 3085 | m_callbackURI = cAgent.CallbackURI; |
3064 | 3086 | ||
@@ -3416,36 +3438,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3416 | } | 3438 | } |
3417 | } | 3439 | } |
3418 | 3440 | ||
3419 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) | ||
3420 | { | ||
3421 | lock (m_attachments) | ||
3422 | { | ||
3423 | // Validate | ||
3424 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3425 | { | ||
3426 | if (gobj == null || gobj.IsDeleted) | ||
3427 | return false; | ||
3428 | } | ||
3429 | |||
3430 | foreach (SceneObjectGroup gobj in m_attachments) | ||
3431 | { | ||
3432 | // If the prim group is null then something must have happened to it! | ||
3433 | if (gobj != null && gobj.RootPart != null) | ||
3434 | { | ||
3435 | // Set the parent localID to 0 so it transfers over properly. | ||
3436 | gobj.RootPart.SetParentLocalId(0); | ||
3437 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; | ||
3438 | gobj.RootPart.IsAttachment = false; | ||
3439 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
3440 | m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle); | ||
3441 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent); | ||
3442 | } | ||
3443 | } | ||
3444 | m_attachments.Clear(); | ||
3445 | |||
3446 | return true; | ||
3447 | } | ||
3448 | } | ||
3449 | 3441 | ||
3450 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) | 3442 | public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) |
3451 | { | 3443 | { |