diff options
Diffstat (limited to 'OpenSim/Region/Framework')
7 files changed, 51 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 0516cb1..70ea7cf 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -44,10 +44,15 @@ namespace OpenSim.Region.Framework.Interfaces | |||
44 | void RezAttachments(IScenePresence sp); | 44 | void RezAttachments(IScenePresence sp); |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Save the attachments that have change on this presence. | 47 | /// Derez the attachements for a scene presence that is closing. |
48 | /// </summary> | 48 | /// </summary> |
49 | /// <param name="sp"></param> | 49 | /// <remarks> |
50 | void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted); | 50 | /// Attachment changes are saved. |
51 | /// </remarks> | ||
52 | /// <param name="sp">The presence closing</param> | ||
53 | /// <param name="saveChanged">Save changed attachments.</param> | ||
54 | /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para> | ||
55 | void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted); | ||
51 | 56 | ||
52 | /// <summary> | 57 | /// <summary> |
53 | /// Delete all the presence's attachments from the scene | 58 | /// Delete all the presence's attachments from the scene |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48..42dbedc 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
77 | /// <param name="itemID">The item ID of the script.</param> | 77 | /// <param name="itemID">The item ID of the script.</param> |
78 | bool GetScriptState(UUID itemID); | 78 | bool GetScriptState(UUID itemID); |
79 | 79 | ||
80 | void SetRunEnable(UUID instanceID, bool enable); | ||
81 | |||
80 | void SaveAllState(); | 82 | void SaveAllState(); |
81 | 83 | ||
82 | /// <summary> | 84 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 98b8fcc..9776a82 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2298,10 +2298,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2298 | if (part == null) | 2298 | if (part == null) |
2299 | return; | 2299 | return; |
2300 | 2300 | ||
2301 | IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); | ||
2302 | |||
2301 | if (running) | 2303 | if (running) |
2304 | { | ||
2305 | foreach (IScriptModule engine in engines) | ||
2306 | { | ||
2307 | engine.SetRunEnable(itemID, true); | ||
2308 | } | ||
2302 | EventManager.TriggerStartScript(part.LocalId, itemID); | 2309 | EventManager.TriggerStartScript(part.LocalId, itemID); |
2310 | } | ||
2303 | else | 2311 | else |
2312 | { | ||
2313 | foreach (IScriptModule engine in engines) | ||
2314 | { | ||
2315 | engine.SetRunEnable(itemID, false); | ||
2316 | } | ||
2304 | EventManager.TriggerStopScript(part.LocalId, itemID); | 2317 | EventManager.TriggerStopScript(part.LocalId, itemID); |
2318 | } | ||
2305 | } | 2319 | } |
2306 | 2320 | ||
2307 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 2321 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 757ac9f..8591b09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -522,6 +522,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
522 | public IAttachmentsModule AttachmentsModule { get; set; } | 522 | public IAttachmentsModule AttachmentsModule { get; set; } |
523 | public IEntityTransferModule EntityTransferModule { get; private set; } | 523 | public IEntityTransferModule EntityTransferModule { get; private set; } |
524 | public IAgentAssetTransactions AgentTransactionsModule { get; private set; } | 524 | public IAgentAssetTransactions AgentTransactionsModule { get; private set; } |
525 | public IUserManagement UserManagementModule { get; private set; } | ||
525 | 526 | ||
526 | public IAvatarFactoryModule AvatarFactory | 527 | public IAvatarFactoryModule AvatarFactory |
527 | { | 528 | { |
@@ -1291,6 +1292,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1291 | EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); | 1292 | EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); |
1292 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); | 1293 | m_groupsModule = RequestModuleInterface<IGroupsModule>(); |
1293 | AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); | 1294 | AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); |
1295 | UserManagementModule = RequestModuleInterface<IUserManagement>(); | ||
1294 | } | 1296 | } |
1295 | 1297 | ||
1296 | #endregion | 1298 | #endregion |
@@ -2094,9 +2096,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2094 | sceneObject.SetGroup(groupID, null); | 2096 | sceneObject.SetGroup(groupID, null); |
2095 | } | 2097 | } |
2096 | 2098 | ||
2097 | IUserManagement uman = RequestModuleInterface<IUserManagement>(); | 2099 | if (UserManagementModule != null) |
2098 | if (uman != null) | 2100 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); |
2099 | sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID); | ||
2100 | 2101 | ||
2101 | sceneObject.ScheduleGroupForFullUpdate(); | 2102 | sceneObject.ScheduleGroupForFullUpdate(); |
2102 | 2103 | ||
@@ -2855,14 +2856,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2855 | /// <param name="aCircuit"></param> | 2856 | /// <param name="aCircuit"></param> |
2856 | private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) | 2857 | private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) |
2857 | { | 2858 | { |
2858 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | 2859 | if (UserManagementModule != null) |
2859 | if (uMan != null) | ||
2860 | { | 2860 | { |
2861 | string first = aCircuit.firstname, last = aCircuit.lastname; | 2861 | string first = aCircuit.firstname, last = aCircuit.lastname; |
2862 | 2862 | ||
2863 | if (sp.PresenceType == PresenceType.Npc) | 2863 | if (sp.PresenceType == PresenceType.Npc) |
2864 | { | 2864 | { |
2865 | uMan.AddUser(aCircuit.AgentID, first, last); | 2865 | UserManagementModule.AddUser(aCircuit.AgentID, first, last); |
2866 | } | 2866 | } |
2867 | else | 2867 | else |
2868 | { | 2868 | { |
@@ -2881,7 +2881,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2881 | } | 2881 | } |
2882 | } | 2882 | } |
2883 | 2883 | ||
2884 | uMan.AddUser(aCircuit.AgentID, first, last, homeURL); | 2884 | UserManagementModule.AddUser(aCircuit.AgentID, first, last, homeURL); |
2885 | } | 2885 | } |
2886 | } | 2886 | } |
2887 | } | 2887 | } |
@@ -3445,17 +3445,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3445 | 3445 | ||
3446 | if (!isChildAgent) | 3446 | if (!isChildAgent) |
3447 | { | 3447 | { |
3448 | if (AttachmentsModule != null && avatar.PresenceType != PresenceType.Npc) | 3448 | if (AttachmentsModule != null) |
3449 | { | 3449 | { |
3450 | IUserManagement uMan = RequestModuleInterface<IUserManagement>(); | ||
3451 | // Don't save attachments for HG visitors, it | 3450 | // Don't save attachments for HG visitors, it |
3452 | // messes up their inventory. When a HG visitor logs | 3451 | // messes up their inventory. When a HG visitor logs |
3453 | // out on a foreign grid, their attachments will be | 3452 | // out on a foreign grid, their attachments will be |
3454 | // reloaded in the state they were in when they left | 3453 | // reloaded in the state they were in when they left |
3455 | // the home grid. This is best anyway as the visited | 3454 | // the home grid. This is best anyway as the visited |
3456 | // grid may use an incompatible script engine. | 3455 | // grid may use an incompatible script engine. |
3457 | if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) | 3456 | bool saveChanged |
3458 | AttachmentsModule.SaveChangedAttachments(avatar, false); | 3457 | = avatar.PresenceType != PresenceType.Npc |
3458 | && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID)); | ||
3459 | |||
3460 | AttachmentsModule.DeRezAttachments(avatar, saveChanged, false); | ||
3459 | } | 3461 | } |
3460 | 3462 | ||
3461 | ForEachClient( | 3463 | ForEachClient( |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 88afee7..11d703a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3640,6 +3640,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3640 | m_scene.PhysicsScene.AddPhysicsActorTaint(actor); | 3640 | m_scene.PhysicsScene.AddPhysicsActorTaint(actor); |
3641 | } | 3641 | } |
3642 | 3642 | ||
3643 | if (IsAttachment) | ||
3644 | { | ||
3645 | m_rootPart.AttachedPos = pos; | ||
3646 | } | ||
3647 | |||
3643 | AbsolutePosition = pos; | 3648 | AbsolutePosition = pos; |
3644 | 3649 | ||
3645 | HasGroupChanged = true; | 3650 | HasGroupChanged = true; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1fc9790..f3e8377 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3606,9 +3606,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3606 | 3606 | ||
3607 | public void Close() | 3607 | public void Close() |
3608 | { | 3608 | { |
3609 | if (!IsChildAgent && m_scene.AttachmentsModule != null) | ||
3610 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); | ||
3611 | |||
3612 | // Clear known regions | 3609 | // Clear known regions |
3613 | KnownRegions = new Dictionary<ulong, string>(); | 3610 | KnownRegions = new Dictionary<ulong, string>(); |
3614 | 3611 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 453e077..81add43 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -187,8 +187,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
187 | 187 | ||
188 | TestScene scene = new SceneHelpers().SetupScene(); | 188 | TestScene scene = new SceneHelpers().SetupScene(); |
189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 189 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
190 | |||
191 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | ||
192 | |||
190 | scene.DeleteSceneObject(part.ParentGroup, false); | 193 | scene.DeleteSceneObject(part.ParentGroup, false); |
191 | 194 | ||
195 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | ||
196 | |||
192 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 197 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
193 | Assert.That(retrievedPart, Is.Null); | 198 | Assert.That(retrievedPart, Is.Null); |
194 | } | 199 | } |
@@ -219,8 +224,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
219 | 224 | ||
220 | Assert.That(retrievedPart, Is.Not.Null); | 225 | Assert.That(retrievedPart, Is.Not.Null); |
221 | 226 | ||
227 | Assert.That(part.ParentGroup.IsDeleted, Is.False); | ||
228 | |||
222 | sogd.InventoryDeQueueAndDelete(); | 229 | sogd.InventoryDeQueueAndDelete(); |
223 | 230 | ||
231 | Assert.That(part.ParentGroup.IsDeleted, Is.True); | ||
232 | |||
224 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); | 233 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); |
225 | Assert.That(retrievedPart2, Is.Null); | 234 | Assert.That(retrievedPart2, Is.Null); |
226 | } | 235 | } |