From 796ae57bea5e7004ac8d41bee2d496d645db81ce Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 9 Jan 2008 15:46:45 +0000 Subject: Prim inventory script saving phase 2. * It is now possible to edit and save scripts directly from prim inventories * On saving, the script will be restarted in the region * Doesn't appear that it's yet possible to drag inventory contents back to agent inventory. Not quite sure why this is yet - the perms all look very permissive. --- .../Scenes/SceneObjectGroup.Inventory.cs | 98 +++++++++++++++++++++- 1 file changed, 95 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index b72d743..4d25b5d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -60,6 +60,27 @@ namespace OpenSim.Region.Environment.Scenes } } +// /// Start a given script. +// /// +// /// +// /// A +// /// +// public void StartScript(LLUUID partID, LLUUID itemID) +// { +// SceneObjectPart part = GetChildPart(partID); +// if (part != null) +// { +// part.StartScript(itemID); +// } +// else +// { +// MainLog.Instance.Error( +// "PRIMINVENTORY", +// "Couldn't find part {0} in object group {1}, {2} to start script with ID {3}", +// localID, Name, UUID, itemID); +// } +// } + /// /// Start the scripts contained in all the prims in this group. /// @@ -71,6 +92,27 @@ namespace OpenSim.Region.Environment.Scenes } } + /// Start a given script. + /// + /// + /// A + /// + public void StopScript(uint partID, LLUUID itemID) + { + SceneObjectPart part = GetChildPart(partID); + if (part != null) + { + part.StopScript(itemID); + } + else + { + MainLog.Instance.Error( + "PRIMINVENTORY", + "Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}", + partID, Name, UUID, itemID); + } + } + /// /// /// @@ -156,13 +198,63 @@ namespace OpenSim.Region.Environment.Scenes return false; } + + /// + /// Returns an existing inventory item. Returns the original, so any changes will be live. + /// + /// + /// + /// null if the item does not exist + public TaskInventoryItem GetInventoryItem(uint primID, LLUUID itemID) + { + SceneObjectPart part = GetChildPart(primID); + if (part != null) + { + return part.GetInventoryItem(itemID); + } + else + { + MainLog.Instance.Error( + "PRIMINVENTORY", + "Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}", + primID, part.Name, part.UUID, itemID); + } + + return null; + } + + /// + /// Update an existing inventory item. + /// + /// The updated item. An item with the same id must already exist + /// in this prim's inventory + /// false if the item did not exist, true if the update occurred succesfully + public bool UpdateInventoryItem(TaskInventoryItem item) + { + SceneObjectPart part = GetChildPart(item.ParentPartID); + if (part != null) + { + part.UpdateInventoryItem(item); + + return true; + } + else + { + MainLog.Instance.Error( + "PRIMINVENTORY", + "Couldn't find prim ID {0} to update item {1}, {2}", + item.ParentPartID, item.name, item.item_id); + } + + return false; + } - public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) + public int RemoveInventoryItem(uint localID, LLUUID itemID) { SceneObjectPart part = GetChildPart(localID); if (part != null) { - int type = part.RemoveInventoryItem(remoteClient, localID, itemID); + int type = part.RemoveInventoryItem(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 @@ -177,4 +269,4 @@ namespace OpenSim.Region.Environment.Scenes return -1; } } -} \ No newline at end of file +} -- cgit v1.1