aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs94
1 files changed, 45 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4973663..f83a4d2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -33,12 +33,12 @@ using OpenMetaverse;
33using log4net; 33using log4net;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Client; 35using OpenSim.Framework.Client;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes.Animation; 37using OpenSim.Region.Framework.Scenes.Animation;
39using OpenSim.Region.Framework.Scenes.Types; 38using OpenSim.Region.Framework.Scenes.Types;
40using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41using OpenSim.Services.Interfaces;
42 42
43namespace OpenSim.Region.Framework.Scenes 43namespace OpenSim.Region.Framework.Scenes
44{ 44{
@@ -256,6 +256,8 @@ namespace OpenSim.Region.Framework.Scenes
256 256
257 // For teleports and crossings callbacks 257 // For teleports and crossings callbacks
258 string m_callbackURI; 258 string m_callbackURI;
259 UUID m_originRegionID;
260
259 ulong m_rootRegionHandle; 261 ulong m_rootRegionHandle;
260 262
261 /// <value> 263 /// <value>
@@ -1112,8 +1114,10 @@ namespace OpenSim.Region.Framework.Scenes
1112 /// This is called upon a very important packet sent from the client, 1114 /// This is called upon a very important packet sent from the client,
1113 /// so it's client-controlled. Never call this method directly. 1115 /// so it's client-controlled. Never call this method directly.
1114 /// </summary> 1116 /// </summary>
1115 public void CompleteMovement() 1117 public void CompleteMovement(IClientAPI client)
1116 { 1118 {
1119 //m_log.Debug("[SCENE PRESENCE]: CompleteMovement");
1120
1117 Vector3 look = Velocity; 1121 Vector3 look = Velocity;
1118 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1122 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1119 { 1123 {
@@ -1138,7 +1142,7 @@ namespace OpenSim.Region.Framework.Scenes
1138 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1142 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1139 { 1143 {
1140 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); 1144 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1141 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); 1145 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1142 m_callbackURI = null; 1146 m_callbackURI = null;
1143 } 1147 }
1144 1148
@@ -1146,6 +1150,21 @@ namespace OpenSim.Region.Framework.Scenes
1146 1150
1147 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1151 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1148 SendInitialData(); 1152 SendInitialData();
1153
1154 // Create child agents in neighbouring regions
1155 if (!m_isChildAgent)
1156 {
1157 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1158 if (m_agentTransfer != null)
1159 m_agentTransfer.EnableChildAgents(this);
1160 else
1161 m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active");
1162
1163 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1164 if (friendsModule != null)
1165 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1166 }
1167
1149 } 1168 }
1150 1169
1151 /// <summary> 1170 /// <summary>
@@ -2204,6 +2223,7 @@ namespace OpenSim.Region.Framework.Scenes
2204 { 2223 {
2205 if (m_isChildAgent) 2224 if (m_isChildAgent)
2206 { 2225 {
2226 // WHAT???
2207 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); 2227 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
2208 2228
2209 // we have to reset the user's child agent connections. 2229 // we have to reset the user's child agent connections.
@@ -2227,7 +2247,9 @@ namespace OpenSim.Region.Framework.Scenes
2227 2247
2228 if (m_scene.SceneGridService != null) 2248 if (m_scene.SceneGridService != null)
2229 { 2249 {
2230 m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); 2250 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
2251 if (m_agentTransfer != null)
2252 m_agentTransfer.EnableChildAgents(this);
2231 } 2253 }
2232 2254
2233 return; 2255 return;
@@ -2524,14 +2546,9 @@ namespace OpenSim.Region.Framework.Scenes
2524 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 2546 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
2525 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); 2547 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
2526 2548
2527 if (!m_isChildAgent)
2528 {
2529 m_scene.InformClientOfNeighbours(this);
2530 }
2531
2532 SendInitialFullUpdateToAllClients(); 2549 SendInitialFullUpdateToAllClients();
2533 SendAppearanceToAllOtherAgents(); 2550 SendAppearanceToAllOtherAgents();
2534 } 2551 }
2535 2552
2536 /// <summary> 2553 /// <summary>
2537 /// Tell the client for this scene presence what items it should be wearing now 2554 /// Tell the client for this scene presence what items it should be wearing now
@@ -2613,14 +2630,19 @@ namespace OpenSim.Region.Framework.Scenes
2613 } 2630 }
2614 } 2631 }
2615 } 2632 }
2633
2616 } 2634 }
2617 2635
2636
2618 #endregion Bake Cache Check 2637 #endregion Bake Cache Check
2619 2638
2620 m_appearance.SetAppearance(textureEntry, visualParams); 2639 m_appearance.SetAppearance(textureEntry, visualParams);
2621 if (m_appearance.AvatarHeight > 0) 2640 if (m_appearance.AvatarHeight > 0)
2622 SetHeight(m_appearance.AvatarHeight); 2641 SetHeight(m_appearance.AvatarHeight);
2623 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2642
2643 // This is not needed, because only the transient data changed
2644 //AvatarData adata = new AvatarData(m_appearance);
2645 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2624 2646
2625 SendAppearanceToAllOtherAgents(); 2647 SendAppearanceToAllOtherAgents();
2626 if (!m_startAnimationSet) 2648 if (!m_startAnimationSet)
@@ -2640,7 +2662,8 @@ namespace OpenSim.Region.Framework.Scenes
2640 public void SetWearable(int wearableId, AvatarWearable wearable) 2662 public void SetWearable(int wearableId, AvatarWearable wearable)
2641 { 2663 {
2642 m_appearance.SetWearable(wearableId, wearable); 2664 m_appearance.SetWearable(wearableId, wearable);
2643 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2665 AvatarData adata = new AvatarData(m_appearance);
2666 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2644 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2667 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2645 } 2668 }
2646 2669
@@ -2963,11 +2986,14 @@ namespace OpenSim.Region.Framework.Scenes
2963 // For now, assign god level 200 to anyone 2986 // For now, assign god level 200 to anyone
2964 // who is granted god powers, but has no god level set. 2987 // who is granted god powers, but has no god level set.
2965 // 2988 //
2966 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); 2989 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
2967 if (profile.UserProfile.GodLevel > 0) 2990 if (account != null)
2968 m_godlevel = profile.UserProfile.GodLevel; 2991 {
2969 else 2992 if (account.UserLevel > 0)
2970 m_godlevel = 200; 2993 m_godlevel = account.UserLevel;
2994 else
2995 m_godlevel = 200;
2996 }
2971 } 2997 }
2972 else 2998 else
2973 { 2999 {
@@ -3033,7 +3059,7 @@ namespace OpenSim.Region.Framework.Scenes
3033 public void CopyTo(AgentData cAgent) 3059 public void CopyTo(AgentData cAgent)
3034 { 3060 {
3035 cAgent.AgentID = UUID; 3061 cAgent.AgentID = UUID;
3036 cAgent.RegionHandle = m_rootRegionHandle; 3062 cAgent.RegionID = Scene.RegionInfo.RegionID;
3037 3063
3038 cAgent.Position = AbsolutePosition; 3064 cAgent.Position = AbsolutePosition;
3039 cAgent.Velocity = m_velocity; 3065 cAgent.Velocity = m_velocity;
@@ -3132,7 +3158,7 @@ namespace OpenSim.Region.Framework.Scenes
3132 3158
3133 public void CopyFrom(AgentData cAgent) 3159 public void CopyFrom(AgentData cAgent)
3134 { 3160 {
3135 m_rootRegionHandle = cAgent.RegionHandle; 3161 m_originRegionID = cAgent.RegionID;
3136 3162
3137 m_callbackURI = cAgent.CallbackURI; 3163 m_callbackURI = cAgent.CallbackURI;
3138 3164
@@ -3490,36 +3516,6 @@ namespace OpenSim.Region.Framework.Scenes
3490 } 3516 }
3491 } 3517 }
3492 3518
3493 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
3494 {
3495 lock (m_attachments)
3496 {
3497 // Validate
3498 foreach (SceneObjectGroup gobj in m_attachments)
3499 {
3500 if (gobj == null || gobj.IsDeleted)
3501 return false;
3502 }
3503
3504 foreach (SceneObjectGroup gobj in m_attachments)
3505 {
3506 // If the prim group is null then something must have happened to it!
3507 if (gobj != null && gobj.RootPart != null)
3508 {
3509 // Set the parent localID to 0 so it transfers over properly.
3510 gobj.RootPart.SetParentLocalId(0);
3511 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3512 gobj.RootPart.IsAttachment = false;
3513 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3514 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
3515 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);
3516 }
3517 }
3518 m_attachments.Clear();
3519
3520 return true;
3521 }
3522 }
3523 3519
3524 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) 3520 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
3525 { 3521 {