aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2008-07-19 04:05:34 +0000
committerMelanie Thielker2008-07-19 04:05:34 +0000
commitbcf74416a1677584c069e4e0b9acf9015d8c5b6c (patch)
tree8c0b967fafbc21e93974760c0b32a0dd2119b930 /OpenSim/Region
parentIntroduce a separate connection string for estates, which defaults to the one gi (diff)
downloadopensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.zip
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.gz
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.bz2
opensim-SC_OLD-bcf74416a1677584c069e4e0b9acf9015d8c5b6c.tar.xz
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.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs81
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs46
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs12
7 files changed, 148 insertions, 47 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index ab0adf2..3996fb3 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -558,10 +558,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
558 args.regionFlags = GetRegionFlags(); 558 args.regionFlags = GetRegionFlags();
559 args.regionName = m_scene.RegionInfo.RegionName; 559 args.regionName = m_scene.RegionInfo.RegionName;
560 args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; 560 args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID;
561 args.terrainBase0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; 561 args.terrainBase0 = LLUUID.Zero;
562 args.terrainBase1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; 562 args.terrainBase1 = LLUUID.Zero;
563 args.terrainBase2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; 563 args.terrainBase2 = LLUUID.Zero;
564 args.terrainBase3 = m_scene.RegionInfo.RegionSettings.TerrainTexture4; 564 args.terrainBase3 = LLUUID.Zero;
565 args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1; 565 args.terrainDetail0 = m_scene.RegionInfo.RegionSettings.TerrainTexture1;
566 args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2; 566 args.terrainDetail1 = m_scene.RegionInfo.RegionSettings.TerrainTexture2;
567 args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3; 567 args.terrainDetail2 = m_scene.RegionInfo.RegionSettings.TerrainTexture3;
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 7e8259f..57d3e5c 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1372,7 +1372,16 @@ namespace OpenSim.Region.Environment.Scenes
1372 1372
1373 // We need to explicitly resend the newly link prim's object properties since no other actions 1373 // We need to explicitly resend the newly link prim's object properties since no other actions
1374 // occur on link to invoke this elsewhere (such as object selection) 1374 // occur on link to invoke this elsewhere (such as object selection)
1375 parenPrim.GetProperties(client); 1375 parenPrim.TriggerScriptChangedEvent(Changed.LINK);
1376 if(client != null)
1377 parenPrim.GetProperties(client);
1378 else
1379 {
1380 foreach (ScenePresence p in ScenePresences.Values)
1381 {
1382 parenPrim.GetProperties(p.ControllingClient);
1383 }
1384 }
1376 } 1385 }
1377 1386
1378 /// <summary> 1387 /// <summary>
@@ -1381,6 +1390,11 @@ namespace OpenSim.Region.Environment.Scenes
1381 /// <param name="prims"></param> 1390 /// <param name="prims"></param>
1382 protected internal void DelinkObjects(List<uint> primIds) 1391 protected internal void DelinkObjects(List<uint> primIds)
1383 { 1392 {
1393 DelinkObjects(primIds, true);
1394 }
1395
1396 protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
1397 {
1384 SceneObjectGroup parenPrim = null; 1398 SceneObjectGroup parenPrim = null;
1385 1399
1386 // Need a list of the SceneObjectGroup local ids 1400 // Need a list of the SceneObjectGroup local ids
@@ -1407,7 +1421,6 @@ namespace OpenSim.Region.Environment.Scenes
1407 1421
1408 if (sceneObjects.ContainsKey(primIds[i])) 1422 if (sceneObjects.ContainsKey(primIds[i]))
1409 { 1423 {
1410
1411 parenPrim = sceneObjects[primIds[i]]; 1424 parenPrim = sceneObjects[primIds[i]];
1412 primIds.RemoveAt(i); 1425 primIds.RemoveAt(i);
1413 break; 1426 break;
@@ -1418,11 +1431,64 @@ namespace OpenSim.Region.Environment.Scenes
1418 { 1431 {
1419 foreach (uint childPrimId in primIds) 1432 foreach (uint childPrimId in primIds)
1420 { 1433 {
1421 parenPrim.DelinkFromGroup(childPrimId); 1434 parenPrim.DelinkFromGroup(childPrimId, sendEvents);
1435 }
1436
1437 if(parenPrim.Children.Count == 1)
1438 {
1439 // The link set has been completely torn down
1440 // This is the case if you select a link set and delink
1441 //
1442 parenPrim.RootPart.LinkNum = 1;
1443 if(sendEvents)
1444 parenPrim.TriggerScriptChangedEvent(Changed.LINK);
1445 }
1446 else
1447 {
1448 // The link set has prims remaining. This path is taken
1449 // when a subset of a link set's prims are selected
1450 // and the root prim is part of that selection
1451 //
1452 List<SceneObjectPart> parts = new List<SceneObjectPart>(parenPrim.Children.Values);
1453
1454 List<uint> unlink_ids = new List<uint>();
1455 foreach (SceneObjectPart unlink_part in parts)
1456 unlink_ids.Add(unlink_part.LocalId);
1457
1458 // Tear down the remaining link set
1459 //
1460 if(unlink_ids.Count == 2)
1461 {
1462 DelinkObjects(unlink_ids, true);
1463 return;
1464 }
1465
1466 DelinkObjects(unlink_ids, false);
1467
1468 // Send event to root prim, then we're done with it
1469 parenPrim.TriggerScriptChangedEvent(Changed.LINK);
1470
1471 unlink_ids.Remove(parenPrim.RootPart.LocalId);
1472
1473 foreach (uint localId in unlink_ids)
1474 {
1475 SceneObjectPart nr = GetSceneObjectPart(localId);
1476 nr.UpdateFlag = 0;
1477 }
1478
1479 uint newRoot = unlink_ids[0];
1480 unlink_ids.Remove(newRoot);
1481
1482 LinkObjects(null, newRoot, unlink_ids);
1422 } 1483 }
1423 } 1484 }
1424 else 1485 else
1425 { 1486 {
1487 // The selected prims were all child prims. Edit linked parts
1488 // without the root prim selected will get us here
1489 //
1490 List<SceneObjectGroup> parents = new List<SceneObjectGroup>();
1491
1426 // If the first scan failed, we need to do a /deep/ scan of the linkages. This is /really/ slow 1492 // If the first scan failed, we need to do a /deep/ scan of the linkages. This is /really/ slow
1427 // We know that this is not the root prim now essentially, so we don't have to worry about remapping 1493 // We know that this is not the root prim now essentially, so we don't have to worry about remapping
1428 // which one is the root prim 1494 // which one is the root prim
@@ -1436,6 +1502,8 @@ namespace OpenSim.Region.Environment.Scenes
1436 { 1502 {
1437 grp.DelinkFromGroup(primIds[i]); 1503 grp.DelinkFromGroup(primIds[i]);
1438 delinkedSomething = true; 1504 delinkedSomething = true;
1505 if(!parents.Contains(grp))
1506 parents.Add(grp);
1439 } 1507 }
1440 1508
1441 } 1509 }
@@ -1446,6 +1514,13 @@ namespace OpenSim.Region.Environment.Scenes
1446 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", 1514 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!",
1447 primIds); 1515 primIds);
1448 } 1516 }
1517 else
1518 {
1519 foreach (SceneObjectGroup g in parents)
1520 {
1521 g.TriggerScriptChangedEvent(Changed.LINK);
1522 }
1523 }
1449 } 1524 }
1450 } 1525 }
1451 1526
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 86e0caa..82e395d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -427,7 +427,10 @@ namespace OpenSim.Region.Environment.Scenes
427 if (reader.Name == "SceneObjectPart") 427 if (reader.Name == "SceneObjectPart")
428 { 428 {
429 SceneObjectPart Part = SceneObjectPart.FromXml(reader); 429 SceneObjectPart Part = SceneObjectPart.FromXml(reader);
430 if(m_rootPart.LinkNum == 0)
431 m_rootPart.LinkNum++;
430 AddPart(Part); 432 AddPart(Part);
433 Part.LinkNum = m_parts.Count;
431 Part.StoreUndoState(); 434 Part.StoreUndoState();
432 } 435 }
433 else 436 else
@@ -462,7 +465,7 @@ namespace OpenSim.Region.Environment.Scenes
462 LLVector3 rootOffset = new LLVector3(0, 0, 0); 465 LLVector3 rootOffset = new LLVector3(0, 0, 0);
463 SceneObjectPart newPart = 466 SceneObjectPart newPart =
464 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset); 467 new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rot, rootOffset);
465 newPart.LinkNum = m_parts.Count; 468 newPart.LinkNum = 0;
466 m_parts.Add(newPart.UUID, newPart); 469 m_parts.Add(newPart.UUID, newPart);
467 SetPartAsRoot(newPart); 470 SetPartAsRoot(newPart);
468 471
@@ -817,7 +820,6 @@ namespace OpenSim.Region.Environment.Scenes
817 lock (m_parts) 820 lock (m_parts)
818 { 821 {
819 part.SetParent(this); 822 part.SetParent(this);
820 part.LinkNum = m_parts.Count;
821 823
822 try 824 try
823 { 825 {
@@ -828,6 +830,11 @@ namespace OpenSim.Region.Environment.Scenes
828 { 830 {
829 m_log.Error("Failed to add scened object part", e); 831 m_log.Error("Failed to add scened object part", e);
830 } 832 }
833
834 part.LinkNum = m_parts.Count;
835
836 if(part.LinkNum == 2 && RootPart != null)
837 RootPart.LinkNum = 1;
831 } 838 }
832 } 839 }
833 840
@@ -1738,14 +1745,16 @@ namespace OpenSim.Region.Environment.Scenes
1738 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 1745 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1739 1746
1740 linkPart.ParentID = m_rootPart.LocalId; 1747 linkPart.ParentID = m_rootPart.LocalId;
1741 1748 if(m_rootPart.LinkNum == 0)
1742 linkPart.LinkNum = m_parts.Count; 1749 m_rootPart.LinkNum = 1;
1743 1750
1744 lock (m_parts) 1751 lock (m_parts)
1745 { 1752 {
1746 m_parts.Add(linkPart.UUID, linkPart); 1753 m_parts.Add(linkPart.UUID, linkPart);
1747 } 1754 }
1748 1755
1756 linkPart.LinkNum = m_parts.Count;
1757
1749 linkPart.SetParent(this); 1758 linkPart.SetParent(this);
1750 1759
1751 //if (linkPart.PhysActor != null) 1760 //if (linkPart.PhysActor != null)
@@ -1784,6 +1793,11 @@ namespace OpenSim.Region.Environment.Scenes
1784 /// <param name="partID"></param> 1793 /// <param name="partID"></param>
1785 public void DelinkFromGroup(uint partID) 1794 public void DelinkFromGroup(uint partID)
1786 { 1795 {
1796 DelinkFromGroup(partID, true);
1797 }
1798
1799 public void DelinkFromGroup(uint partID, bool sendEvents)
1800 {
1787 SceneObjectPart linkPart = GetChildPart(partID); 1801 SceneObjectPart linkPart = GetChildPart(partID);
1788 1802
1789 if (null != linkPart) 1803 if (null != linkPart)
@@ -1801,7 +1815,17 @@ namespace OpenSim.Region.Environment.Scenes
1801 m_parts.Remove(linkPart.UUID); 1815 m_parts.Remove(linkPart.UUID);
1802 } 1816 }
1803 1817
1818 if(m_parts.Count == 1 && RootPart != null) //Single prim is left
1819 RootPart.LinkNum = 0;
1820 else
1821 {
1822 foreach (SceneObjectPart p in m_parts.Values)
1823 if(p.LinkNum > linkPart.LinkNum)
1824 p.LinkNum--;
1825 }
1826
1804 linkPart.ParentID = 0; 1827 linkPart.ParentID = 0;
1828 linkPart.LinkNum = 0;
1805 1829
1806 if (linkPart.PhysActor != null) 1830 if (linkPart.PhysActor != null)
1807 { 1831 {
@@ -1834,6 +1858,9 @@ namespace OpenSim.Region.Environment.Scenes
1834 1858
1835 m_scene.AddNewSceneObject(objectGroup, true); 1859 m_scene.AddNewSceneObject(objectGroup, true);
1836 1860
1861 if(sendEvents)
1862 linkPart.TriggerScriptChangedEvent(Changed.LINK);
1863
1837 HasGroupChanged = true; 1864 HasGroupChanged = true;
1838 ScheduleGroupForFullUpdate(); 1865 ScheduleGroupForFullUpdate();
1839 } 1866 }
@@ -1858,13 +1885,14 @@ namespace OpenSim.Region.Environment.Scenes
1858 { 1885 {
1859 part.SetParent(this); 1886 part.SetParent(this);
1860 part.ParentID = m_rootPart.LocalId; 1887 part.ParentID = m_rootPart.LocalId;
1861 part.LinkNum = m_parts.Count;
1862 1888
1863 lock (m_parts) 1889 lock (m_parts)
1864 { 1890 {
1865 m_parts.Add(part.UUID, part); 1891 m_parts.Add(part.UUID, part);
1866 } 1892 }
1867 1893
1894 part.LinkNum = m_parts.Count;
1895
1868 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1896 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
1869 axiomOldPos = oldGroupRotation * axiomOldPos; 1897 axiomOldPos = oldGroupRotation * axiomOldPos;
1870 axiomOldPos += oldGroupPosition; 1898 axiomOldPos += oldGroupPosition;
@@ -2670,5 +2698,13 @@ namespace OpenSim.Region.Environment.Scenes
2670 2698
2671 ScheduleGroupForFullUpdate(); 2699 ScheduleGroupForFullUpdate();
2672 } 2700 }
2701
2702 public void TriggerScriptChangedEvent(Changed val)
2703 {
2704 foreach (SceneObjectPart part in Children.Values)
2705 {
2706 part.TriggerScriptChangedEvent(val);
2707 }
2708 }
2673 } 2709 }
2674} 2710}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 63ec23c..edccbe5 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -674,12 +674,7 @@ namespace OpenSim.Region.Environment.Scenes
674 public int LinkNum 674 public int LinkNum
675 { 675 {
676 get { return m_linkNum; } 676 get { return m_linkNum; }
677 set 677 set { m_linkNum = value; }
678 {
679 m_linkNum = value;
680 TriggerScriptChangedEvent(Changed.LINK);
681
682 }
683 } 678 }
684 679
685 public byte ClickAction 680 public byte ClickAction
@@ -2250,7 +2245,8 @@ namespace OpenSim.Region.Environment.Scenes
2250 public void SetAvatarOnSitTarget(LLUUID avatarID) 2245 public void SetAvatarOnSitTarget(LLUUID avatarID)
2251 { 2246 {
2252 m_sitTargetAvatar = avatarID; 2247 m_sitTargetAvatar = avatarID;
2253 TriggerScriptChangedEvent(Changed.LINK); 2248 if(ParentGroup != null)
2249 ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2254 } 2250 }
2255 2251
2256 public void SetAxisRotation(int axis, int rotate) 2252 public void SetAxisRotation(int axis, int rotate)
@@ -3294,4 +3290,4 @@ namespace OpenSim.Region.Environment.Scenes
3294 3290
3295 #endregion Public Methods 3291 #endregion Public Methods
3296 } 3292 }
3297} \ No newline at end of file 3293}
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
2600 2600
2601 if (m_host.ParentGroup.Children.Count > 1) 2601 if (m_host.ParentGroup.Children.Count > 1)
2602 { 2602 {
2603 return m_host.LinkNum + 1; 2603 return m_host.LinkNum;
2604 } 2604 }
2605 else 2605 else
2606 { 2606 {
@@ -2979,7 +2979,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2979 2979
2980 object[] resobj = new object[] 2980 object[] resobj = new object[]
2981 { 2981 {
2982 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2982 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2983 }; 2983 };
2984 2984
2985 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2985 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3004,7 +3004,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3004 partItemID = item.ItemID; 3004 partItemID = item.ItemID;
3005 Object[] resobj = new object[] 3005 Object[] resobj = new object[]
3006 { 3006 {
3007 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3007 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3008 }; 3008 };
3009 3009
3010 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3010 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3032,7 +3032,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3032 partItemID = item.ItemID; 3032 partItemID = item.ItemID;
3033 Object[] resobj = new object[] 3033 Object[] resobj = new object[]
3034 { 3034 {
3035 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3035 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3036 }; 3036 };
3037 3037
3038 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3038 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3062,7 +3062,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3062 partItemID = item.ItemID; 3062 partItemID = item.ItemID;
3063 Object[] resobj = new object[] 3063 Object[] resobj = new object[]
3064 { 3064 {
3065 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3065 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3066 }; 3066 };
3067 3067
3068 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3068 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3086,7 +3086,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3086 3086
3087 object[] resobj = new object[] 3087 object[] resobj = new object[]
3088 { 3088 {
3089 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3089 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3090 }; 3090 };
3091 3091
3092 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3092 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3103,7 +3103,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3103 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 3103 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
3104 { 3104 {
3105 3105
3106 if ((partInst.LinkNum + 1) == linknum) 3106 if ((partInst.LinkNum) == linknum)
3107 { 3107 {
3108 3108
3109 foreach (TaskInventoryItem item in partInst.TaskInventory.Values) 3109 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
@@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3114 partItemID = item.ItemID; 3114 partItemID = item.ItemID;
3115 Object[] resObjDef = new object[] 3115 Object[] resObjDef = new object[]
3116 { 3116 {
3117 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3117 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3118 }; 3118 };
3119 3119
3120 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3120 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -5246,7 +5246,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5246 { 5246 {
5247 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 5247 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
5248 { 5248 {
5249 if ((partInst.LinkNum + 1) == linknumber) 5249 if ((partInst.LinkNum) == linknumber)
5250 { 5250 {
5251 part = partInst; 5251 part = partInst;
5252 break; 5252 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
2487 2487
2488 if (m_host.ParentGroup.Children.Count > 1) 2488 if (m_host.ParentGroup.Children.Count > 1)
2489 { 2489 {
2490 return m_host.LinkNum + 1; 2490 return m_host.LinkNum;
2491 } 2491 }
2492 else 2492 else
2493 { 2493 {
@@ -2923,7 +2923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2923 2923
2924 object[] resobj = new object[] 2924 object[] resobj = new object[]
2925 { 2925 {
2926 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2926 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2927 }; 2927 };
2928 2928
2929 m_ScriptEngine.PostScriptEvent(partItemID, 2929 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -2947,7 +2947,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2947 partItemID = item.ItemID; 2947 partItemID = item.ItemID;
2948 Object[] resobj = new object[] 2948 Object[] resobj = new object[]
2949 { 2949 {
2950 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2950 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2951 }; 2951 };
2952 2952
2953 m_ScriptEngine.PostScriptEvent(partItemID, 2953 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -2975,7 +2975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2975 partItemID = item.ItemID; 2975 partItemID = item.ItemID;
2976 Object[] resobj = new object[] 2976 Object[] resobj = new object[]
2977 { 2977 {
2978 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2978 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2979 }; 2979 };
2980 2980
2981 m_ScriptEngine.PostScriptEvent(partItemID, 2981 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -3005,7 +3005,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3005 partItemID = item.ItemID; 3005 partItemID = item.ItemID;
3006 Object[] resobj = new object[] 3006 Object[] resobj = new object[]
3007 { 3007 {
3008 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3008 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3009 }; 3009 };
3010 3010
3011 m_ScriptEngine.PostScriptEvent(partItemID, 3011 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -3029,7 +3029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3029 3029
3030 object[] resobj = new object[] 3030 object[] resobj = new object[]
3031 { 3031 {
3032 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3032 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3033 }; 3033 };
3034 3034
3035 m_ScriptEngine.PostScriptEvent(partItemID, 3035 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -3045,7 +3045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3045 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 3045 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
3046 { 3046 {
3047 3047
3048 if ((partInst.LinkNum + 1) == linknum) 3048 if ((partInst.LinkNum) == linknum)
3049 { 3049 {
3050 3050
3051 foreach (TaskInventoryItem item in partInst.TaskInventory.Values) 3051 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
@@ -3056,7 +3056,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3056 partItemID = item.ItemID; 3056 partItemID = item.ItemID;
3057 Object[] resObjDef = new object[] 3057 Object[] resObjDef = new object[]
3058 { 3058 {
3059 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 3059 new LSL_Types.LSLInteger(m_host.LinkNum), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
3060 }; 3060 };
3061 3061
3062 m_ScriptEngine.PostScriptEvent(partItemID, 3062 m_ScriptEngine.PostScriptEvent(partItemID,
@@ -5046,7 +5046,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5046 { 5046 {
5047 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 5047 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
5048 { 5048 {
5049 if ((partInst.LinkNum + 1) == linknumber) 5049 if ((partInst.LinkNum) == linknumber)
5050 { 5050 {
5051 part = partInst; 5051 part = partInst;
5052 break; 5052 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
93 if (part == null) 93 if (part == null)
94 return; 94 return;
95 95
96 det[0].LinkNum = 0; 96 det[0].LinkNum = part.LinkNum;
97 if (part.ParentGroup.Children.Count > 0)
98 det[0].LinkNum = part.LinkNum + 1;
99 97
100 myScriptEngine.PostObjectEvent(localID, new EventParams( 98 myScriptEngine.PostObjectEvent(localID, new EventParams(
101 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, 99 "touch_start", new Object[] { new LSL_Types.LSLInteger(1) },
@@ -119,9 +117,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
119 if (part == null) 117 if (part == null)
120 return; 118 return;
121 119
122 det[0].LinkNum = 0; 120 det[0].LinkNum = part.LinkNum;
123 if (part.ParentGroup.Children.Count > 0)
124 det[0].LinkNum = part.LinkNum + 1;
125 121
126 myScriptEngine.PostObjectEvent(localID, new EventParams( 122 myScriptEngine.PostObjectEvent(localID, new EventParams(
127 "touch", new Object[] { new LSL_Types.LSLInteger(1) }, 123 "touch", new Object[] { new LSL_Types.LSLInteger(1) },
@@ -141,9 +137,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
141 if (part == null) 137 if (part == null)
142 return; 138 return;
143 139
144 det[0].LinkNum = 0; 140 det[0].LinkNum = part.LinkNum;
145 if (part.ParentGroup.Children.Count > 0)
146 det[0].LinkNum = part.LinkNum + 1;
147 141
148 myScriptEngine.PostObjectEvent(localID, new EventParams( 142 myScriptEngine.PostObjectEvent(localID, new EventParams(
149 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, 143 "touch_end", new Object[] { new LSL_Types.LSLInteger(1) },