aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorSean Dague2008-03-28 12:47:03 +0000
committerSean Dague2008-03-28 12:47:03 +0000
commit2eda6a12962e0af23e060d4338e32896ddedf366 (patch)
tree0d6b055f5be5f589cfaa9d5f9f7ae031072e8feb /OpenSim/Region/ScriptEngine
parent* Correct asset type of Lost and Found folder - this might stop it appearing ... (diff)
downloadopensim-SC_OLD-2eda6a12962e0af23e060d4338e32896ddedf366.zip
opensim-SC_OLD-2eda6a12962e0af23e060d4338e32896ddedf366.tar.gz
opensim-SC_OLD-2eda6a12962e0af23e060d4338e32896ddedf366.tar.bz2
opensim-SC_OLD-2eda6a12962e0af23e060d4338e32896ddedf366.tar.xz
From: Michael Osias <mosias@us.ibm.com>
This patch implements llMessageLinked. I had to make a change to llGetLinkNumber to return m_host.LinkNum + 1 for link sets of more than 1 prim, or 0 for a single object, since according to: http://rpgstats.com/wiki/index.php?title=LlMessageLinked linksets with 2 or more prims start the link numbering at 1, but a single prims link number is 0.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs179
1 files changed, 176 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 73d901d..ad4c21a 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.ScriptEngine.Common
57 private uint m_localID; 57 private uint m_localID;
58 private LLUUID m_itemID; 58 private LLUUID m_itemID;
59 private bool throwErrorOnNotImplemented = true; 59 private bool throwErrorOnNotImplemented = true;
60 60
61 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) 61 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
62 { 62 {
63 m_ScriptEngine = ScriptEngine; 63 m_ScriptEngine = ScriptEngine;
@@ -1633,7 +1633,15 @@ namespace OpenSim.Region.ScriptEngine.Common
1633 public int llGetLinkNumber() 1633 public int llGetLinkNumber()
1634 { 1634 {
1635 m_host.AddScriptLPS(1); 1635 m_host.AddScriptLPS(1);
1636 return m_host.LinkNum; 1636
1637 if (m_host.ParentGroup.Children.Count > 0)
1638 {
1639 return m_host.LinkNum + 1;
1640 }
1641 else
1642 {
1643 return 0;
1644 }
1637 } 1645 }
1638 1646
1639 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) 1647 public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face)
@@ -1945,9 +1953,174 @@ namespace OpenSim.Region.ScriptEngine.Common
1945 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID); 1953 m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
1946 } 1954 }
1947 1955
1948 public void llMessageLinked(int linknum, int num, string str, string id) 1956 public void llMessageLinked(int linknum, int num, string msg, string id)
1949 { 1957 {
1958
1950 m_host.AddScriptLPS(1); 1959 m_host.AddScriptLPS(1);
1960
1961 uint partLocalID;
1962 LLUUID partItemID;
1963
1964 switch ((int)linknum)
1965 {
1966
1967 case (int)BuiltIn_Commands_BaseClass.LINK_ROOT:
1968
1969 SceneObjectPart part = m_host.ParentGroup.RootPart;
1970
1971 foreach (TaskInventoryItem item in part.TaskInventory.Values)
1972 {
1973 if (item.Type == 10)
1974 {
1975 partLocalID = part.LocalId;
1976 partItemID = item.ItemID;
1977
1978 object[] resobj = new object[]
1979 {
1980 m_host.LinkNum, num, msg, id
1981 };
1982
1983 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
1984 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
1985 );
1986
1987 }
1988 }
1989
1990 break;
1991
1992 case (int)BuiltIn_Commands_BaseClass.LINK_SET:
1993
1994 Console.WriteLine("LINK_SET");
1995
1996 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
1997 {
1998
1999 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
2000 {
2001 if (item.Type == 10)
2002 {
2003 partLocalID = partInst.LocalId;
2004 partItemID = item.ItemID;
2005 Object[] resobj = new object[]
2006 {
2007 m_host.LinkNum, num, msg, id
2008 };
2009
2010 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2011 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
2012 );
2013 }
2014 }
2015 }
2016
2017 break;
2018
2019 case (int)BuiltIn_Commands_BaseClass.LINK_ALL_OTHERS:
2020
2021 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2022 {
2023
2024 if (partInst.LocalId != m_host.LocalId)
2025 {
2026
2027 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
2028 {
2029 if (item.Type == 10)
2030 {
2031 partLocalID = partInst.LocalId;
2032 partItemID = item.ItemID;
2033 Object[] resobj = new object[]
2034 {
2035 m_host.LinkNum, num, msg, id
2036 };
2037
2038 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2039 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
2040 );
2041 }
2042 }
2043
2044 }
2045 }
2046
2047 break;
2048
2049 case (int)BuiltIn_Commands_BaseClass.LINK_ALL_CHILDREN:
2050
2051 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2052 {
2053
2054 if (partInst.LocalId != m_host.ParentGroup.RootPart.LocalId)
2055 {
2056
2057 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
2058 {
2059 if (item.Type == 10)
2060 {
2061 partLocalID = partInst.LocalId;
2062 partItemID = item.ItemID;
2063 Object[] resobj = new object[]
2064 {
2065 m_host.LinkNum, num, msg, id
2066 };
2067
2068 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2069 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
2070 );
2071 }
2072 }
2073
2074 }
2075 }
2076
2077 break;
2078
2079 case (int)BuiltIn_Commands_BaseClass.LINK_THIS:
2080
2081 Object[] respObjThis = new object[]
2082 {
2083 m_host.LinkNum, num, msg, id
2084 };
2085
2086 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2087 m_localID, m_itemID, "link_message", EventQueueManager.llDetectNull, respObjThis
2088 );
2089
2090 break;
2091
2092 default:
2093
2094 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
2095 {
2096
2097 if ((partInst.LinkNum + 1) == linknum)
2098 {
2099
2100 foreach (TaskInventoryItem item in partInst.TaskInventory.Values)
2101 {
2102 if (item.Type == 10)
2103 {
2104 partLocalID = partInst.LocalId;
2105 partItemID = item.ItemID;
2106 Object[] resObjDef = new object[]
2107 {
2108 m_host.LinkNum, num, msg, id
2109 };
2110
2111 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2112 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resObjDef
2113 );
2114 }
2115 }
2116
2117 }
2118 }
2119
2120 break;
2121
2122 }
2123
1951 } 2124 }
1952 2125
1953 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local) 2126 public void llPushObject(string target, LSL_Types.Vector3 impulse, LSL_Types.Vector3 ang_impulse, int local)