From 348b79d801a44086413fcf4a781ffa8c4f4b36b6 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 7 Jan 2008 22:11:26 +0000 Subject: Trigger persistence of the scripts in a prim's inventory when that inventory is changed/updated/deleted (before the trigger only happened if the prim was moved). This is still development code - experimental prim inventory persistence cannot yet be enabled by users. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 3 --- .../Scenes/SceneObjectGroup.Inventory.cs | 30 ++++++++++++++++++++-- .../Scenes/SceneObjectPart.Inventory.cs | 9 ++++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2e8f5f7..ed04e44 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -49,9 +49,6 @@ namespace OpenSim.Region.Environment.Scenes group.StartScripts(); } } - - //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete - // or at least some of they can be moved somewhere else /// /// Add an inventory item to an avatar's inventory. diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 1d382fa..fb09932 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -124,6 +124,14 @@ namespace OpenSim.Region.Environment.Scenes taskItem.type = TaskInventoryItem.Types[item.assetType]; taskItem.inv_type = TaskInventoryItem.Types[item.invType]; part.AddInventoryItem(taskItem); + + // It might seem somewhat crude to update the whole group for a single prim inventory change, + // but it's possible that other prim inventory changes will take place before the region + // persistence thread visits this object. In the future, changes can be signalled at a more + // granular level, or we could let the datastore worry about whether prims have really + // changed since they were last persisted. + HasChanged = true; + return true; } return false; @@ -146,6 +154,14 @@ namespace OpenSim.Region.Environment.Scenes taskItem.type = TaskInventoryItem.Types[item.assetType]; taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; part.AddInventoryItem(taskItem); + + // It might seem somewhat crude to update the whole group for a single prim inventory change, + // but it's possible that other prim inventory changes will take place before the region + // persistence thread visits this object. In the future, changes can be signalled at a more + // granular level, or we could let the datastore worry about whether prims have really + // changed since they were last persisted. + HasChanged = true; + return true; } } @@ -160,9 +176,19 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectPart part = GetChildPart(localID); if (part != null) - { - return part.RemoveInventoryItem(remoteClient, localID, itemID); + { + int type = part.RemoveInventoryItem(remoteClient, localID, itemID); + + // It might seem somewhat crude to update the whole group for a single prim inventory change, + // but it's possible that other prim inventory changes will take place before the region + // persistence thread visits this object. In the future, changes can be signalled at a more + // granular level, or we could let the datastore worry about whether prims have really + // changed since they were last persisted. + HasChanged = true; + + return type; } + return -1; } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index c282780..9e2c256 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -174,6 +174,13 @@ namespace OpenSim.Region.Environment.Scenes m_inventorySerial++; } + /// + /// Remove an item from this prim's inventory + /// + /// + /// + /// + /// Numeric asset type of the item removed. public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) { if (localID == LocalID) @@ -183,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes string type = m_taskInventory[itemID].inv_type; m_taskInventory.Remove(itemID); m_inventorySerial++; - if (type == "lsl_text") + if (type == "lsltext") { return 10; } -- cgit v1.1