From bcf74416a1677584c069e4e0b9acf9015d8c5b6c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 19 Jul 2008 04:05:34 +0000 Subject: Fix prim link numbers (Mantis #1781) Implements additional unlink modes (unlink root prim from link set, some multi-set operations). Linking (single and mutiple) fully implemented. Consistent numbering of links while in world. Link/delink with predictable link numbering. Correct link numbers in LSL. Not all multi-set ops implemented. Link numbers still change when taken and re-rezzed. --- .../Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 18 +++++++++--------- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 +++++++++--------- OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | 12 +++--------- 3 files changed, 21 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index cbd4db2..682d566 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2600,7 +2600,7 @@ namespace OpenSim.Region.ScriptEngine.Common if (m_host.ParentGroup.Children.Count > 1) { - return m_host.LinkNum + 1; + return m_host.LinkNum; } else { @@ -2979,7 +2979,7 @@ namespace OpenSim.Region.ScriptEngine.Common object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -3004,7 +3004,7 @@ namespace OpenSim.Region.ScriptEngine.Common partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -3032,7 +3032,7 @@ namespace OpenSim.Region.ScriptEngine.Common partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -3062,7 +3062,7 @@ namespace OpenSim.Region.ScriptEngine.Common partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -3086,7 +3086,7 @@ namespace OpenSim.Region.ScriptEngine.Common object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -3103,7 +3103,7 @@ namespace OpenSim.Region.ScriptEngine.Common foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) { - if ((partInst.LinkNum + 1) == linknum) + if ((partInst.LinkNum) == linknum) { foreach (TaskInventoryItem item in partInst.TaskInventory.Values) @@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ScriptEngine.Common partItemID = item.ItemID; Object[] resObjDef = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( @@ -5246,7 +5246,7 @@ namespace OpenSim.Region.ScriptEngine.Common { foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) { - if ((partInst.LinkNum + 1) == linknumber) + if ((partInst.LinkNum) == linknumber) { part = partInst; break; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index decd2d0..c3255b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2487,7 +2487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.Children.Count > 1) { - return m_host.LinkNum + 1; + return m_host.LinkNum; } else { @@ -2923,7 +2923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -2947,7 +2947,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -2975,7 +2975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -3005,7 +3005,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api partItemID = item.ItemID; Object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -3029,7 +3029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] resobj = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -3045,7 +3045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) { - if ((partInst.LinkNum + 1) == linknum) + if ((partInst.LinkNum) == linknum) { foreach (TaskInventoryItem item in partInst.TaskInventory.Values) @@ -3056,7 +3056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api partItemID = item.ItemID; Object[] resObjDef = new object[] { - new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) + new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) }; m_ScriptEngine.PostScriptEvent(partItemID, @@ -5046,7 +5046,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) { - if ((partInst.LinkNum + 1) == linknumber) + if ((partInst.LinkNum) == linknumber) { part = partInst; break; diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 3fd4942..db11e6b 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -93,9 +93,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (part == null) return; - det[0].LinkNum = 0; - if (part.ParentGroup.Children.Count > 0) - det[0].LinkNum = part.LinkNum + 1; + det[0].LinkNum = part.LinkNum; myScriptEngine.PostObjectEvent(localID, new EventParams( "touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, @@ -119,9 +117,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (part == null) return; - det[0].LinkNum = 0; - if (part.ParentGroup.Children.Count > 0) - det[0].LinkNum = part.LinkNum + 1; + det[0].LinkNum = part.LinkNum; myScriptEngine.PostObjectEvent(localID, new EventParams( "touch", new Object[] { new LSL_Types.LSLInteger(1) }, @@ -141,9 +137,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (part == null) return; - det[0].LinkNum = 0; - if (part.ParentGroup.Children.Count > 0) - det[0].LinkNum = part.LinkNum + 1; + det[0].LinkNum = part.LinkNum; myScriptEngine.PostObjectEvent(localID, new EventParams( "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, -- cgit v1.1