From df73446beeb53de5b504111d219c72291de05585 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 24 Aug 2007 11:42:44 +0000 Subject: Scripts are now copied into a prim (ie new copy placed in the prim) rather than moved into there. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 14 +++++------ .../Region/Environment/Scenes/SceneObjectGroup.cs | 27 ++++++++++++++++++++++ .../Region/Environment/Scenes/SceneObjectPart.cs | 2 +- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 4458a4d..4b30a80 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -233,6 +233,7 @@ namespace OpenSim.Region.Environment.Scenes public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) { CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId); + LLUUID copyID = LLUUID.Random(); if (userInfo != null) { if (userInfo.RootFolder != null) @@ -251,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes { string script = Util.FieldToString(rezAsset.Data); //Console.WriteLine("rez script "+script); - this.EventManager.TriggerRezScript(localID, itemID, script); + this.EventManager.TriggerRezScript(localID, copyID, script); rezzed = true; } else @@ -262,7 +263,7 @@ namespace OpenSim.Region.Environment.Scenes { string script = Util.FieldToString(rezAsset.Data); // Console.WriteLine("rez script " + script); - this.EventManager.TriggerRezScript(localID, itemID, script); + this.EventManager.TriggerRezScript(localID, copyID, script); rezzed = true; } } @@ -277,13 +278,10 @@ namespace OpenSim.Region.Environment.Scenes hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID); if (hasPrim != false) { - bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item); + + bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID); ((SceneObjectGroup)ent).GetProperites(remoteClient); - if (added) - { - userInfo.DeleteItem(remoteClient.AgentId, item); - remoteClient.SendRemoveInventoryItem(itemID); - } + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 6945acb..ba6f6ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -655,6 +655,33 @@ namespace OpenSim.Region.Environment.Scenes } + public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) + { + if (copyItemID != LLUUID.Zero) + { + SceneObjectPart part = this.GetChildPart(localID); + if (part != null) + { + SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem(); + taskItem.item_id = copyItemID; + taskItem.asset_id = item.assetID; + taskItem.name = item.inventoryName; + taskItem.desc = item.inventoryDescription; + taskItem.owner_id = new LLUUID(item.avatarID.ToString()); + taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); + taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType]; + taskItem.inv_type = SceneObjectPart.TaskInventoryItem.Types[item.invType]; + part.AddInventoryItem(taskItem); + return true; + } + } + else + { + return AddInventoryItem(remoteClient, localID, item); + } + return false; + } + public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) { SceneObjectPart part = this.GetChildPart(localID); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index d7479bd..d681f99 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes set { m_name = value; } } - protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128; + protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 268435456 + 128 + (uint)LLObject.ObjectFlags.Physics; public uint ObjectFlags { get { return (uint)m_flags; } -- cgit v1.1