From 176efe3f0680aa7e1c46d9eb0fc1ead762512ac3 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 26 Jun 2008 23:37:21 +0000 Subject: Mantis#1610. Thank you, Melanie for a patch that: Implements the beginning of llInventoryDrop. Doesn't cover the actual dropping yet, just the permissions for it. --- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 3 +-- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 6 ++++++ OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 7 ++++++- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index eac74c2..b67de7e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1009,8 +1009,7 @@ namespace OpenSim.Region.Environment.Scenes return; } - // todo: also check llAllowInventoryDrop when implemented - if(part.OwnerID != destPart.OwnerID) + if(part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.AllowInventoryDrop) == 0) { // object cannot copy items to an object owned by a different owner // unless llAllowInventoryDrop has been called diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 85351f4..1f5f00f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -97,6 +97,7 @@ namespace OpenSim.Region.Environment.Scenes // TODO: This needs to be persisted in next XML version update! [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; + [XmlIgnore] public bool AllowedDrop = false; [XmlIgnore] private Dictionary m_scriptEvents = new Dictionary(); [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; @@ -2786,6 +2787,11 @@ namespace OpenSim.Region.Environment.Scenes objectflagupdate |= (uint) LLObject.ObjectFlags.Money; } + if (AllowedDrop) + { + objectflagupdate |= (uint) LLObject.ObjectFlags.AllowInventoryDrop; + } + if ( ((m_aggregateScriptEvents & scriptEvents.collision) != 0) || ((m_aggregateScriptEvents & scriptEvents.collision_end) != 0) || diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 366b20c..b5a3ad9 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3185,7 +3185,12 @@ namespace OpenSim.Region.ScriptEngine.Common public void llAllowInventoryDrop(int add) { m_host.AddScriptLPS(1); - NotImplemented("llAllowInventoryDrop"); + + if(add != 0) + m_host.ParentGroup.RootPart.AllowedDrop = true; + else + m_host.ParentGroup.RootPart.AllowedDrop = false; + } public LSL_Types.Vector3 llGetSunDirection() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1d4a72e..477c6a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3114,7 +3114,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llAllowInventoryDrop(int add) { m_host.AddScriptLPS(1); - NotImplemented("llAllowInventoryDrop"); + + if(add != 0) + m_host.ParentGroup.RootPart.AllowedDrop = true; + else + m_host.ParentGroup.RootPart.AllowedDrop = false; } public LSL_Types.Vector3 llGetSunDirection() -- cgit v1.1