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 bcf22c3..29f607b 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{
@@ -217,7 +217,12 @@ namespace OpenSim.Region.Framework.Scenes
217 // Agent's Draw distance. 217 // Agent's Draw distance.
218 protected float m_DrawDistance; 218 protected float m_DrawDistance;
219 219
220 protected AvatarAppearance m_appearance; 220 protected AvatarAppearance m_appearance;
221
222 public List<SceneObjectGroup> Attachments
223 {
224 get { return m_attachments; }
225 }
221 226
222 // neighbouring regions we have enabled a child agent in 227 // neighbouring regions we have enabled a child agent in
223 // holds the seed cap for the child agent in that region 228 // holds the seed cap for the child agent in that region
@@ -246,6 +251,8 @@ namespace OpenSim.Region.Framework.Scenes
246 251
247 // For teleports and crossings callbacks 252 // For teleports and crossings callbacks
248 string m_callbackURI; 253 string m_callbackURI;
254 UUID m_originRegionID;
255
249 ulong m_rootRegionHandle; 256 ulong m_rootRegionHandle;
250 257
251 /// <value> 258 /// <value>
@@ -1073,6 +1080,8 @@ namespace OpenSim.Region.Framework.Scenes
1073 /// </summary> 1080 /// </summary>
1074 public void CompleteMovement() 1081 public void CompleteMovement()
1075 { 1082 {
1083 //m_log.Debug("[SCENE PRESENCE]: CompleteMovement");
1084
1076 Vector3 look = Velocity; 1085 Vector3 look = Velocity;
1077 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1086 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1078 { 1087 {
@@ -1097,7 +1106,7 @@ namespace OpenSim.Region.Framework.Scenes
1097 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1106 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1098 { 1107 {
1099 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); 1108 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1100 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); 1109 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1101 m_callbackURI = null; 1110 m_callbackURI = null;
1102 } 1111 }
1103 1112
@@ -1106,6 +1115,16 @@ namespace OpenSim.Region.Framework.Scenes
1106 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1115 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1107 SendInitialData(); 1116 SendInitialData();
1108 1117
1118 // Create child agents in neighbouring regions
1119 if (!m_isChildAgent)
1120 {
1121 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1122 if (m_agentTransfer != null)
1123 m_agentTransfer.EnableChildAgents(this);
1124 else
1125 m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active");
1126 }
1127
1109 } 1128 }
1110 1129
1111 /// <summary> 1130 /// <summary>
@@ -2164,6 +2183,7 @@ namespace OpenSim.Region.Framework.Scenes
2164 { 2183 {
2165 if (m_isChildAgent) 2184 if (m_isChildAgent)
2166 { 2185 {
2186 // WHAT???
2167 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); 2187 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
2168 2188
2169 // we have to reset the user's child agent connections. 2189 // we have to reset the user's child agent connections.
@@ -2187,7 +2207,9 @@ namespace OpenSim.Region.Framework.Scenes
2187 2207
2188 if (m_scene.SceneGridService != null) 2208 if (m_scene.SceneGridService != null)
2189 { 2209 {
2190 m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); 2210 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
2211 if (m_agentTransfer != null)
2212 m_agentTransfer.EnableChildAgents(this);
2191 } 2213 }
2192 2214
2193 return; 2215 return;
@@ -2484,14 +2506,9 @@ namespace OpenSim.Region.Framework.Scenes
2484 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 2506 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
2485 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); 2507 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
2486 2508
2487 if (!m_isChildAgent)
2488 {
2489 m_scene.InformClientOfNeighbours(this);
2490 }
2491
2492 SendInitialFullUpdateToAllClients(); 2509 SendInitialFullUpdateToAllClients();
2493 SendAppearanceToAllOtherAgents(); 2510 SendAppearanceToAllOtherAgents();
2494 } 2511 }
2495 2512
2496 /// <summary> 2513 /// <summary>
2497 /// Tell the client for this scene presence what items it should be wearing now 2514 /// Tell the client for this scene presence what items it should be wearing now
@@ -2571,14 +2588,19 @@ namespace OpenSim.Region.Framework.Scenes
2571 } 2588 }
2572 } 2589 }
2573 } 2590 }
2591
2574 } 2592 }
2575 2593
2594
2576 #endregion Bake Cache Check 2595 #endregion Bake Cache Check
2577 2596
2578 m_appearance.SetAppearance(textureEntry, visualParams); 2597 m_appearance.SetAppearance(textureEntry, visualParams);
2579 if (m_appearance.AvatarHeight > 0) 2598 if (m_appearance.AvatarHeight > 0)
2580 SetHeight(m_appearance.AvatarHeight); 2599 SetHeight(m_appearance.AvatarHeight);
2581 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2600
2601 // This is not needed, because only the transient data changed
2602 //AvatarData adata = new AvatarData(m_appearance);
2603 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2582 2604
2583 SendAppearanceToAllOtherAgents(); 2605 SendAppearanceToAllOtherAgents();
2584 if (!m_startAnimationSet) 2606 if (!m_startAnimationSet)
@@ -2598,7 +2620,8 @@ namespace OpenSim.Region.Framework.Scenes
2598 public void SetWearable(int wearableId, AvatarWearable wearable) 2620 public void SetWearable(int wearableId, AvatarWearable wearable)
2599 { 2621 {
2600 m_appearance.SetWearable(wearableId, wearable); 2622 m_appearance.SetWearable(wearableId, wearable);
2601 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2623 AvatarData adata = new AvatarData(m_appearance);
2624 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2602 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2625 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2603 } 2626 }
2604 2627
@@ -2882,11 +2905,14 @@ namespace OpenSim.Region.Framework.Scenes
2882 // For now, assign god level 200 to anyone 2905 // For now, assign god level 200 to anyone
2883 // who is granted god powers, but has no god level set. 2906 // who is granted god powers, but has no god level set.
2884 // 2907 //
2885 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); 2908 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
2886 if (profile.UserProfile.GodLevel > 0) 2909 if (account != null)
2887 m_godlevel = profile.UserProfile.GodLevel; 2910 {
2888 else 2911 if (account.UserLevel > 0)
2889 m_godlevel = 200; 2912 m_godlevel = account.UserLevel;
2913 else
2914 m_godlevel = 200;
2915 }
2890 } 2916 }
2891 else 2917 else
2892 { 2918 {
@@ -2952,7 +2978,7 @@ namespace OpenSim.Region.Framework.Scenes
2952 public void CopyTo(AgentData cAgent) 2978 public void CopyTo(AgentData cAgent)
2953 { 2979 {
2954 cAgent.AgentID = UUID; 2980 cAgent.AgentID = UUID;
2955 cAgent.RegionHandle = m_rootRegionHandle; 2981 cAgent.RegionID = Scene.RegionInfo.RegionID;
2956 2982
2957 cAgent.Position = AbsolutePosition; 2983 cAgent.Position = AbsolutePosition;
2958 cAgent.Velocity = m_velocity; 2984 cAgent.Velocity = m_velocity;
@@ -3051,7 +3077,7 @@ namespace OpenSim.Region.Framework.Scenes
3051 3077
3052 public void CopyFrom(AgentData cAgent) 3078 public void CopyFrom(AgentData cAgent)
3053 { 3079 {
3054 m_rootRegionHandle = cAgent.RegionHandle; 3080 m_originRegionID = cAgent.RegionID;
3055 3081
3056 m_callbackURI = cAgent.CallbackURI; 3082 m_callbackURI = cAgent.CallbackURI;
3057 3083
@@ -3410,36 +3436,6 @@ namespace OpenSim.Region.Framework.Scenes
3410 } 3436 }
3411 } 3437 }
3412 3438
3413 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
3414 {
3415 lock (m_attachments)
3416 {
3417 // Validate
3418 foreach (SceneObjectGroup gobj in m_attachments)
3419 {
3420 if (gobj == null || gobj.IsDeleted)
3421 return false;
3422 }
3423
3424 foreach (SceneObjectGroup gobj in m_attachments)
3425 {
3426 // If the prim group is null then something must have happened to it!
3427 if (gobj != null && gobj.RootPart != null)
3428 {
3429 // Set the parent localID to 0 so it transfers over properly.
3430 gobj.RootPart.SetParentLocalId(0);
3431 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3432 gobj.RootPart.IsAttachment = false;
3433 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3434 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
3435 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);
3436 }
3437 }
3438 m_attachments.Clear();
3439
3440 return true;
3441 }
3442 }
3443 3439
3444 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) 3440 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
3445 { 3441 {