aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs90
1 files changed, 41 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 675fb69..6b6fa7c 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{
@@ -227,7 +227,7 @@ namespace OpenSim.Region.Framework.Scenes
227 // Agent's Draw distance. 227 // Agent's Draw distance.
228 protected float m_DrawDistance; 228 protected float m_DrawDistance;
229 229
230 protected AvatarAppearance m_appearance; 230 protected AvatarAppearance m_appearance;
231 231
232 // neighbouring regions we have enabled a child agent in 232 // neighbouring regions we have enabled a child agent in
233 // holds the seed cap for the child agent in that region 233 // holds the seed cap for the child agent in that region
@@ -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>
@@ -1114,6 +1116,8 @@ namespace OpenSim.Region.Framework.Scenes
1114 /// </summary> 1116 /// </summary>
1115 public void CompleteMovement() 1117 public void CompleteMovement()
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,17 @@ 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
1149 } 1164 }
1150 1165
1151 /// <summary> 1166 /// <summary>
@@ -2212,6 +2227,7 @@ namespace OpenSim.Region.Framework.Scenes
2212 { 2227 {
2213 if (m_isChildAgent) 2228 if (m_isChildAgent)
2214 { 2229 {
2230 // WHAT???
2215 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); 2231 m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!");
2216 2232
2217 // we have to reset the user's child agent connections. 2233 // we have to reset the user's child agent connections.
@@ -2235,7 +2251,9 @@ namespace OpenSim.Region.Framework.Scenes
2235 2251
2236 if (m_scene.SceneGridService != null) 2252 if (m_scene.SceneGridService != null)
2237 { 2253 {
2238 m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); 2254 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
2255 if (m_agentTransfer != null)
2256 m_agentTransfer.EnableChildAgents(this);
2239 } 2257 }
2240 2258
2241 return; 2259 return;
@@ -2532,14 +2550,9 @@ namespace OpenSim.Region.Framework.Scenes
2532 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 2550 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
2533 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot)); 2551 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
2534 2552
2535 if (!m_isChildAgent)
2536 {
2537 m_scene.InformClientOfNeighbours(this);
2538 }
2539
2540 SendInitialFullUpdateToAllClients(); 2553 SendInitialFullUpdateToAllClients();
2541 SendAppearanceToAllOtherAgents(); 2554 SendAppearanceToAllOtherAgents();
2542 } 2555 }
2543 2556
2544 /// <summary> 2557 /// <summary>
2545 /// Tell the client for this scene presence what items it should be wearing now 2558 /// Tell the client for this scene presence what items it should be wearing now
@@ -2621,14 +2634,19 @@ namespace OpenSim.Region.Framework.Scenes
2621 } 2634 }
2622 } 2635 }
2623 } 2636 }
2637
2624 } 2638 }
2625 2639
2640
2626 #endregion Bake Cache Check 2641 #endregion Bake Cache Check
2627 2642
2628 m_appearance.SetAppearance(textureEntry, visualParams); 2643 m_appearance.SetAppearance(textureEntry, visualParams);
2629 if (m_appearance.AvatarHeight > 0) 2644 if (m_appearance.AvatarHeight > 0)
2630 SetHeight(m_appearance.AvatarHeight); 2645 SetHeight(m_appearance.AvatarHeight);
2631 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2646
2647 // This is not needed, because only the transient data changed
2648 //AvatarData adata = new AvatarData(m_appearance);
2649 //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2632 2650
2633 SendAppearanceToAllOtherAgents(); 2651 SendAppearanceToAllOtherAgents();
2634 if (!m_startAnimationSet) 2652 if (!m_startAnimationSet)
@@ -2648,7 +2666,8 @@ namespace OpenSim.Region.Framework.Scenes
2648 public void SetWearable(int wearableId, AvatarWearable wearable) 2666 public void SetWearable(int wearableId, AvatarWearable wearable)
2649 { 2667 {
2650 m_appearance.SetWearable(wearableId, wearable); 2668 m_appearance.SetWearable(wearableId, wearable);
2651 m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); 2669 AvatarData adata = new AvatarData(m_appearance);
2670 m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
2652 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); 2671 m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
2653 } 2672 }
2654 2673
@@ -2968,11 +2987,14 @@ namespace OpenSim.Region.Framework.Scenes
2968 // For now, assign god level 200 to anyone 2987 // For now, assign god level 200 to anyone
2969 // who is granted god powers, but has no god level set. 2988 // who is granted god powers, but has no god level set.
2970 // 2989 //
2971 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); 2990 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
2972 if (profile.UserProfile.GodLevel > 0) 2991 if (account != null)
2973 m_godlevel = profile.UserProfile.GodLevel; 2992 {
2974 else 2993 if (account.UserLevel > 0)
2975 m_godlevel = 200; 2994 m_godlevel = account.UserLevel;
2995 else
2996 m_godlevel = 200;
2997 }
2976 } 2998 }
2977 else 2999 else
2978 { 3000 {
@@ -3038,7 +3060,7 @@ namespace OpenSim.Region.Framework.Scenes
3038 public void CopyTo(AgentData cAgent) 3060 public void CopyTo(AgentData cAgent)
3039 { 3061 {
3040 cAgent.AgentID = UUID; 3062 cAgent.AgentID = UUID;
3041 cAgent.RegionHandle = m_rootRegionHandle; 3063 cAgent.RegionID = Scene.RegionInfo.RegionID;
3042 3064
3043 cAgent.Position = AbsolutePosition; 3065 cAgent.Position = AbsolutePosition;
3044 cAgent.Velocity = m_velocity; 3066 cAgent.Velocity = m_velocity;
@@ -3137,7 +3159,7 @@ namespace OpenSim.Region.Framework.Scenes
3137 3159
3138 public void CopyFrom(AgentData cAgent) 3160 public void CopyFrom(AgentData cAgent)
3139 { 3161 {
3140 m_rootRegionHandle = cAgent.RegionHandle; 3162 m_originRegionID = cAgent.RegionID;
3141 3163
3142 m_callbackURI = cAgent.CallbackURI; 3164 m_callbackURI = cAgent.CallbackURI;
3143 3165
@@ -3495,36 +3517,6 @@ namespace OpenSim.Region.Framework.Scenes
3495 } 3517 }
3496 } 3518 }
3497 3519
3498 public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent)
3499 {
3500 lock (m_attachments)
3501 {
3502 // Validate
3503 foreach (SceneObjectGroup gobj in m_attachments)
3504 {
3505 if (gobj == null || gobj.IsDeleted)
3506 return false;
3507 }
3508
3509 foreach (SceneObjectGroup gobj in m_attachments)
3510 {
3511 // If the prim group is null then something must have happened to it!
3512 if (gobj != null && gobj.RootPart != null)
3513 {
3514 // Set the parent localID to 0 so it transfers over properly.
3515 gobj.RootPart.SetParentLocalId(0);
3516 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
3517 gobj.RootPart.IsAttachment = false;
3518 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
3519 m_log.DebugFormat("[ATTACHMENT]: Sending attachment {0} to region {1}", gobj.UUID, regionHandle);
3520 m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj, silent);
3521 }
3522 }
3523 m_attachments.Clear();
3524
3525 return true;
3526 }
3527 }
3528 3520
3529 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene) 3521 public void initializeScenePresence(IClientAPI client, RegionInfo region, Scene scene)
3530 { 3522 {