diff options
author | Melanie Thielker | 2008-08-19 07:11:58 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-19 07:11:58 +0000 |
commit | 29530f30296271f2d5641091e45d5f396a7d4dec (patch) | |
tree | c0c01f8eabe0b8c3b0db20b3eb3c3c68018d450c /OpenSim/Region | |
parent | * This reverts a change where m_regions[RegionHandle] was replaced instead of... (diff) | |
download | opensim-SC-29530f30296271f2d5641091e45d5f396a7d4dec.zip opensim-SC-29530f30296271f2d5641091e45d5f396a7d4dec.tar.gz opensim-SC-29530f30296271f2d5641091e45d5f396a7d4dec.tar.bz2 opensim-SC-29530f30296271f2d5641091e45d5f396a7d4dec.tar.xz |
Attachment persistence!!! Patch #9170 (Mantis #1171)
Attachments now persist across logouts. Mostly untested.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 37 |
2 files changed, 45 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 784d04c..e145f4a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -2308,15 +2308,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2308 | EventManager.TriggerStopScript(part.LocalId, itemID); | 2308 | EventManager.TriggerStopScript(part.LocalId, itemID); |
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | // public void TestFunction() | ||
2312 | // { | ||
2313 | // IInventoryModule imod = RequestModuleInterface<IInventoryModule>(); | ||
2314 | // if (imod == null) | ||
2315 | // return; | ||
2316 | // | ||
2317 | // imod.TestFunction(); | ||
2318 | // } | ||
2319 | |||
2320 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, | 2311 | public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, |
2321 | uint AttachmentPt, uint ItemFlags, uint NextOwnerMask) | 2312 | uint AttachmentPt, uint ItemFlags, uint NextOwnerMask) |
2322 | { | 2313 | { |
@@ -2328,13 +2319,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
2328 | return; | 2319 | return; |
2329 | } | 2320 | } |
2330 | 2321 | ||
2322 | RezSingleAttachment(att, remoteClient, itemID, AttachmentPt, | ||
2323 | ItemFlags, NextOwnerMask); | ||
2324 | } | ||
2325 | |||
2326 | public void RezSingleAttachment(SceneObjectGroup att, | ||
2327 | IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, | ||
2328 | uint ItemFlags, uint NextOwnerMask) | ||
2329 | { | ||
2331 | if (att.RootPart != null) | 2330 | if (att.RootPart != null) |
2332 | AttachmentPt = att.RootPart.AttachmentPoint; | 2331 | AttachmentPt = att.RootPart.AttachmentPoint; |
2333 | 2332 | ||
2334 | ScenePresence presence; | 2333 | ScenePresence presence; |
2335 | if(TryGetAvatar(remoteClient.AgentId, out presence)) | 2334 | if(TryGetAvatar(remoteClient.AgentId, out presence)) |
2336 | { | 2335 | { |
2337 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.GetFromAssetID()); | 2336 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.UUID); |
2338 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); | 2337 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); |
2339 | if(ava != null) | 2338 | if(ava != null) |
2340 | { | 2339 | { |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5669af6..af7ae47 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -36,6 +36,7 @@ using libsecondlife.Packets; | |||
36 | using log4net; | 36 | using log4net; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications.Cache; | 38 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Region.Environment.Interfaces; | ||
39 | using OpenSim.Region.Environment.Types; | 40 | using OpenSim.Region.Environment.Types; |
40 | using OpenSim.Region.Physics.Manager; | 41 | using OpenSim.Region.Physics.Manager; |
41 | 42 | ||
@@ -416,7 +417,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
416 | RegisterToEvents(); | 417 | RegisterToEvents(); |
417 | SetDirectionVectors(); | 418 | SetDirectionVectors(); |
418 | 419 | ||
419 | 420 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); | |
421 | userInfo.OnItemReceived += ItemReceived; | ||
420 | } | 422 | } |
421 | 423 | ||
422 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 424 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
@@ -604,6 +606,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
604 | /// </summary> | 606 | /// </summary> |
605 | public void MakeRootAgent(LLVector3 pos, bool isFlying) | 607 | public void MakeRootAgent(LLVector3 pos, bool isFlying) |
606 | { | 608 | { |
609 | IAvatarFactory ava = m_scene.RequestModuleInterface<IAvatarFactory>(); | ||
610 | if(ava != null) | ||
611 | { | ||
612 | ava.TryGetAvatarAppearance(m_uuid, out m_appearance); | ||
613 | } | ||
614 | |||
607 | // m_log.DebugFormat( | 615 | // m_log.DebugFormat( |
608 | // "[SCENE PRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2} at pos {3}", | 616 | // "[SCENE PRESENCE]: Upgrading child agent {0}, {1} to a root agent in {2} at pos {3}", |
609 | // Name, UUID, m_scene.RegionInfo.RegionName, pos); | 617 | // Name, UUID, m_scene.RegionInfo.RegionName, pos); |
@@ -2862,5 +2870,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
2862 | //DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | 2870 | //DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
2863 | return flags; | 2871 | return flags; |
2864 | } | 2872 | } |
2873 | |||
2874 | private void ItemReceived(LLUUID itemID) | ||
2875 | { | ||
2876 | int attachpoint = m_appearance.GetAttachpoint(itemID); | ||
2877 | if (attachpoint == 0) | ||
2878 | return; | ||
2879 | |||
2880 | SceneObjectPart att = m_scene.GetSceneObjectPart(m_appearance.GetAttachedAsset(attachpoint)); | ||
2881 | |||
2882 | |||
2883 | // If this is null, then we have just rezzed in. Non null means | ||
2884 | // we're crossing | ||
2885 | // | ||
2886 | if (att != null) | ||
2887 | { | ||
2888 | System.Console.WriteLine("Attach from world {0}", itemID.ToString()); | ||
2889 | // Attach from world | ||
2890 | if(att.ParentGroup != null) | ||
2891 | m_scene.RezSingleAttachment(att.ParentGroup, ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2892 | } | ||
2893 | else | ||
2894 | { | ||
2895 | System.Console.WriteLine("Rez attachment {0}", itemID.ToString()); | ||
2896 | // Rez from inventory | ||
2897 | m_scene.RezSingleAttachment(ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2898 | } | ||
2899 | } | ||
2865 | } | 2900 | } |
2866 | } | 2901 | } |