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.
afrisby
Justin Clarke Casey 2008-01-07 22:11:26 +00:00
parent 97c1b84463
commit 348b79d801
3 changed files with 36 additions and 6 deletions

View File

@ -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
/// <summary>
/// Add an inventory item to an avatar's inventory.

View File

@ -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;
}
}

View File

@ -174,6 +174,13 @@ namespace OpenSim.Region.Environment.Scenes
m_inventorySerial++;
}
/// <summary>
/// Remove an item from this prim's inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="localID"></param>
/// <param name="itemID"></param>
/// <returns>Numeric asset type of the item removed.</returns>
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;
}