diff options
Diffstat (limited to 'OpenSim')
3 files changed, 192 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs index a791310..6dd5d81 100644 --- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs | |||
@@ -42,6 +42,5 @@ namespace OpenSim.Region.Environment.Interfaces | |||
42 | void DeleteListener(LLUUID itemID); | 42 | void DeleteListener(LLUUID itemID); |
43 | uint PeekNextMessageLocalID(); | 43 | uint PeekNextMessageLocalID(); |
44 | LLUUID PeekNextMessageItemID(); | 44 | LLUUID PeekNextMessageItemID(); |
45 | |||
46 | } | 45 | } |
47 | } | 46 | } |
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs index e1d2fbc..79e475c 100644 --- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.Environment.Modules | |||
75 | private ListenerManager m_listenerManager; | 75 | private ListenerManager m_listenerManager; |
76 | private Queue m_pendingQ; | 76 | private Queue m_pendingQ; |
77 | private Queue m_pending; | 77 | private Queue m_pending; |
78 | |||
78 | public WorldCommModule() | 79 | public WorldCommModule() |
79 | { | 80 | { |
80 | } | 81 | } |
@@ -112,6 +113,11 @@ namespace OpenSim.Region.Environment.Modules | |||
112 | client.OnChatFromViewer += DeliverClientMessage; | 113 | client.OnChatFromViewer += DeliverClientMessage; |
113 | } | 114 | } |
114 | 115 | ||
116 | /******************************************************************** | ||
117 | * | ||
118 | * Listener Stuff | ||
119 | * | ||
120 | * *****************************************************************/ | ||
115 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) | 121 | private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) |
116 | { | 122 | { |
117 | DeliverMessage(e.Sender.AgentId.ToString(), | 123 | DeliverMessage(e.Sender.AgentId.ToString(), |
@@ -179,7 +185,7 @@ namespace OpenSim.Region.Environment.Modules | |||
179 | 185 | ||
180 | m_scene.Entities.TryGetValue(li.GetHostID(), out sPart); | 186 | m_scene.Entities.TryGetValue(li.GetHostID(), out sPart); |
181 | 187 | ||
182 | if(sPart != null) | 188 | if (sPart != null) |
183 | { | 189 | { |
184 | // Dont process if this message is from itself! | 190 | // Dont process if this message is from itself! |
185 | if (li.GetHostID().ToString().Equals(sourceItemID) || | 191 | if (li.GetHostID().ToString().Equals(sourceItemID) || |
@@ -291,7 +297,7 @@ namespace OpenSim.Region.Environment.Modules | |||
291 | 297 | ||
292 | lock (m_pending.SyncRoot) | 298 | lock (m_pending.SyncRoot) |
293 | { | 299 | { |
294 | li = (ListenerInfo) m_pending.Dequeue(); | 300 | li = (ListenerInfo)m_pending.Dequeue(); |
295 | } | 301 | } |
296 | 302 | ||
297 | return li; | 303 | return li; |
@@ -306,12 +312,13 @@ namespace OpenSim.Region.Environment.Modules | |||
306 | { | 312 | { |
307 | return ((ListenerInfo)m_pending.Peek()).GetItemID(); | 313 | return ((ListenerInfo)m_pending.Peek()).GetItemID(); |
308 | } | 314 | } |
309 | |||
310 | } | 315 | } |
311 | 316 | ||
312 | // hostID: the ID of the ScenePart | 317 | /********************************************************** |
313 | // itemID: the ID of the script host engine | 318 | * |
314 | // localID: local ID of host engine | 319 | * Even more listener stuff |
320 | * | ||
321 | * ********************************************************/ | ||
315 | public class ListenerManager | 322 | public class ListenerManager |
316 | { | 323 | { |
317 | //private Dictionary<int, ListenerInfo> m_listeners; | 324 | //private Dictionary<int, ListenerInfo> m_listeners; |
@@ -434,9 +441,9 @@ namespace OpenSim.Region.Environment.Modules | |||
434 | { | 441 | { |
435 | ListenerInfo li = (ListenerInfo)en.Value; | 442 | ListenerInfo li = (ListenerInfo)en.Value; |
436 | 443 | ||
437 | if (li.GetHostID().Equals(listenerKey)) | 444 | if (li.IsActive()) |
438 | { | 445 | { |
439 | if (li.IsActive()) | 446 | if (li.GetHostID().Equals(listenerKey)) |
440 | { | 447 | { |
441 | if (channel == li.GetChannel()) | 448 | if (channel == li.GetChannel()) |
442 | { | 449 | { |
@@ -575,4 +582,5 @@ namespace OpenSim.Region.Environment.Modules | |||
575 | return m_id; | 582 | return m_id; |
576 | } | 583 | } |
577 | } | 584 | } |
585 | |||
578 | } | 586 | } |
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) |