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.cs137
1 files changed, 70 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4695df7..ff97183 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -652,9 +652,6 @@ namespace OpenSim.Region.Framework.Scenes
652 RegisterToEvents(); 652 RegisterToEvents();
653 SetDirectionVectors(); 653 SetDirectionVectors();
654 654
655 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
656 if (userInfo != null)
657 userInfo.OnItemReceived += ItemReceived;
658 } 655 }
659 656
660 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 657 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
@@ -833,11 +830,11 @@ namespace OpenSim.Region.Framework.Scenes
833 830
834 m_scene.SwapRootAgentCount(false); 831 m_scene.SwapRootAgentCount(false);
835 832
836 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); 833 //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
837 if (userInfo != null) 834 //if (userInfo != null)
838 userInfo.FetchInventory(); 835 // userInfo.FetchInventory();
839 else 836 //else
840 m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 837 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
841 838
842 // On the next prim update, all objects will be sent 839 // On the next prim update, all objects will be sent
843 // 840 //
@@ -1021,7 +1018,9 @@ namespace OpenSim.Region.Framework.Scenes
1021 } 1018 }
1022 1019
1023 /// <summary> 1020 /// <summary>
1024 /// Complete Avatar's movement into the region 1021 /// Complete Avatar's movement into the region.
1022 /// This is called upon a very important packet sent from the client,
1023 /// so it's client-controlled. Never call this method directly.
1025 /// </summary> 1024 /// </summary>
1026 public void CompleteMovement() 1025 public void CompleteMovement()
1027 { 1026 {
@@ -1042,22 +1041,19 @@ namespace OpenSim.Region.Framework.Scenes
1042 AbsolutePosition = pos; 1041 AbsolutePosition = pos;
1043 } 1042 }
1044 1043
1045 if (m_isChildAgent) 1044 m_isChildAgent = false;
1046 { 1045 bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1047 m_isChildAgent = false; 1046 MakeRootAgent(AbsolutePosition, m_flying);
1048 bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1049 MakeRootAgent(AbsolutePosition, m_flying);
1050
1051 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1052 {
1053 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1054 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1055 m_callbackURI = null;
1056 }
1057 1047
1058 //m_log.DebugFormat("Completed movement"); 1048 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1049 {
1050 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1051 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1052 m_callbackURI = null;
1059 } 1053 }
1060 1054
1055 //m_log.DebugFormat("Completed movement");
1056
1061 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1057 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1062 SendInitialData(); 1058 SendInitialData();
1063 1059
@@ -3154,6 +3150,20 @@ namespace OpenSim.Region.Framework.Scenes
3154 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); 3150 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3155 } 3151 }
3156 3152
3153 //Attachments
3154 List<int> attPoints = m_appearance.GetAttachedPoints();
3155 if (attPoints != null)
3156 {
3157 m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3158 int i = 0;
3159 AttachmentData[] attachs = new AttachmentData[attPoints.Count];
3160 foreach (int point in attPoints)
3161 {
3162 attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3163 }
3164 cAgent.Attachments = attachs;
3165 }
3166
3157 // Animations 3167 // Animations
3158 try 3168 try
3159 { 3169 {
@@ -3219,6 +3229,19 @@ namespace OpenSim.Region.Framework.Scenes
3219 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); 3229 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3220 } 3230 }
3221 3231
3232 // Attachments
3233 try
3234 {
3235 if (cAgent.Attachments != null)
3236 {
3237 foreach (AttachmentData att in cAgent.Attachments)
3238 {
3239 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3240 }
3241 }
3242 }
3243 catch { }
3244
3222 // Animations 3245 // Animations
3223 try 3246 try
3224 { 3247 {
@@ -3729,69 +3752,49 @@ namespace OpenSim.Region.Framework.Scenes
3729 return flags; 3752 return flags;
3730 } 3753 }
3731 3754
3732 private void ItemReceived(UUID itemID) 3755 /// <summary>
3756 /// RezAttachments. This should only be called upon login on the first region.
3757 /// Attachment rezzings on crossings and TPs are done in a different way.
3758 /// </summary>
3759 public void RezAttachments()
3733 { 3760 {
3734 if (IsChildAgent)
3735 return;
3736
3737 if (null == m_appearance) 3761 if (null == m_appearance)
3738 { 3762 {
3739 m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); 3763 m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID);
3740 return; 3764 return;
3741 } 3765 }
3742 3766
3743 int attachpoint = m_appearance.GetAttachpoint(itemID); 3767 List<int> attPoints = m_appearance.GetAttachedPoints();
3744 if (attachpoint == 0) 3768 foreach (int p in attPoints)
3745 return;
3746
3747 UUID asset = m_appearance.GetAttachedAsset(attachpoint);
3748 if (UUID.Zero == asset) // We have just logged in
3749 { 3769 {
3770 UUID itemID = m_appearance.GetAttachedItem(p);
3771 UUID assetID = m_appearance.GetAttachedAsset(p);
3772
3773 // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
3774 // But they're not used anyway, the item is being looked up for now, so let's proceed.
3775 //if (UUID.Zero == assetID)
3776 //{
3777 // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID);
3778 // continue;
3779 //}
3780
3750 try 3781 try
3751 { 3782 {
3752 // Rez from inventory 3783 // Rez from inventory
3753 asset = m_scene.RezSingleAttachment(ControllingClient, 3784 UUID asset = m_scene.RezSingleAttachment(ControllingClient,
3754 itemID, (uint)attachpoint); 3785 itemID, (uint)p);
3755 // Corner case: We are not yet a Scene Entity 3786
3756 // Setting attachment info in RezSingleAttachment will fail 3787 m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3757 // Set it here 3788 p, itemID, assetID, asset);
3758 //
3759 m_appearance.SetAttachment((int)attachpoint, itemID,
3760 asset);
3761 m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}",
3762 itemID.ToString(), asset);
3763 3789
3764 } 3790 }
3765 catch (Exception e) 3791 catch (Exception e)
3766 { 3792 {
3767 m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); 3793 m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString());
3768 } 3794 }
3769 3795
3770 return;
3771 } 3796 }
3772 3797
3773 SceneObjectPart att = m_scene.GetSceneObjectPart(asset);
3774
3775 // If this is null, then the asset has not yet appeared in world
3776 // so we revisit this when it does
3777 //
3778 if (att != null && att.UUID != asset) // Yes. It's really needed
3779 {
3780 m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString());
3781
3782 // This will throw if crossing katty-korner
3783 // So catch it here to avoid the noid
3784 //
3785 try
3786 {
3787 // Attach from world, if not already attached
3788 if (att.ParentGroup != null && !att.IsAttachment)
3789 m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false);
3790 }
3791 catch (NullReferenceException)
3792 {
3793 }
3794 }
3795 } 3798 }
3796 } 3799 }
3797} 3800}