diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 9045672..2fe6948 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -29,8 +29,10 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | ||
32 | using System.Runtime.Remoting.Lifetime; | 33 | using System.Runtime.Remoting.Lifetime; |
33 | using System.Threading; | 34 | using System.Threading; |
35 | using log4net; | ||
34 | using OpenMetaverse; | 36 | using OpenMetaverse; |
35 | using Nini.Config; | 37 | using Nini.Config; |
36 | using OpenSim; | 38 | using OpenSim; |
@@ -56,6 +58,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
56 | [Serializable] | 58 | [Serializable] |
57 | public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi | 59 | public class MOD_Api : MarshalByRefObject, IMOD_Api, IScriptApi |
58 | { | 60 | { |
61 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
62 | |||
59 | internal IScriptEngine m_ScriptEngine; | 63 | internal IScriptEngine m_ScriptEngine; |
60 | internal SceneObjectPart m_host; | 64 | internal SceneObjectPart m_host; |
61 | internal TaskInventoryItem m_item; | 65 | internal TaskInventoryItem m_item; |
@@ -109,8 +113,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
109 | if (message.Length > 1023) | 113 | if (message.Length > 1023) |
110 | message = message.Substring(0, 1023); | 114 | message = message.Substring(0, 1023); |
111 | 115 | ||
112 | World.SimChat(Utils.StringToBytes(message), | 116 | World.SimChat( |
113 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); | 117 | Utils.StringToBytes(message), |
118 | ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, | ||
119 | m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); | ||
114 | 120 | ||
115 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 121 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); |
116 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); | 122 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); |
@@ -124,6 +130,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
124 | /// <returns>string result of the invocation</returns> | 130 | /// <returns>string result of the invocation</returns> |
125 | public void modInvokeN(string fname, params object[] parms) | 131 | public void modInvokeN(string fname, params object[] parms) |
126 | { | 132 | { |
133 | // m_log.DebugFormat( | ||
134 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
135 | // fname, | ||
136 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
137 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
138 | |||
127 | Type returntype = m_comms.LookupReturnType(fname); | 139 | Type returntype = m_comms.LookupReturnType(fname); |
128 | if (returntype != typeof(string)) | 140 | if (returntype != typeof(string)) |
129 | MODError(String.Format("return type mismatch for {0}",fname)); | 141 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -133,6 +145,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
133 | 145 | ||
134 | public LSL_String modInvokeS(string fname, params object[] parms) | 146 | public LSL_String modInvokeS(string fname, params object[] parms) |
135 | { | 147 | { |
148 | // m_log.DebugFormat( | ||
149 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
150 | // fname, | ||
151 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
152 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
153 | |||
136 | Type returntype = m_comms.LookupReturnType(fname); | 154 | Type returntype = m_comms.LookupReturnType(fname); |
137 | if (returntype != typeof(string)) | 155 | if (returntype != typeof(string)) |
138 | MODError(String.Format("return type mismatch for {0}",fname)); | 156 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -143,6 +161,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
143 | 161 | ||
144 | public LSL_Integer modInvokeI(string fname, params object[] parms) | 162 | public LSL_Integer modInvokeI(string fname, params object[] parms) |
145 | { | 163 | { |
164 | // m_log.DebugFormat( | ||
165 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
166 | // fname, | ||
167 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
168 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
169 | |||
146 | Type returntype = m_comms.LookupReturnType(fname); | 170 | Type returntype = m_comms.LookupReturnType(fname); |
147 | if (returntype != typeof(int)) | 171 | if (returntype != typeof(int)) |
148 | MODError(String.Format("return type mismatch for {0}",fname)); | 172 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -153,6 +177,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
153 | 177 | ||
154 | public LSL_Float modInvokeF(string fname, params object[] parms) | 178 | public LSL_Float modInvokeF(string fname, params object[] parms) |
155 | { | 179 | { |
180 | // m_log.DebugFormat( | ||
181 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
182 | // fname, | ||
183 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
184 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
185 | |||
156 | Type returntype = m_comms.LookupReturnType(fname); | 186 | Type returntype = m_comms.LookupReturnType(fname); |
157 | if (returntype != typeof(float)) | 187 | if (returntype != typeof(float)) |
158 | MODError(String.Format("return type mismatch for {0}",fname)); | 188 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -163,6 +193,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
163 | 193 | ||
164 | public LSL_Key modInvokeK(string fname, params object[] parms) | 194 | public LSL_Key modInvokeK(string fname, params object[] parms) |
165 | { | 195 | { |
196 | // m_log.DebugFormat( | ||
197 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
198 | // fname, | ||
199 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
200 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
201 | |||
166 | Type returntype = m_comms.LookupReturnType(fname); | 202 | Type returntype = m_comms.LookupReturnType(fname); |
167 | if (returntype != typeof(UUID)) | 203 | if (returntype != typeof(UUID)) |
168 | MODError(String.Format("return type mismatch for {0}",fname)); | 204 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -173,6 +209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
173 | 209 | ||
174 | public LSL_Vector modInvokeV(string fname, params object[] parms) | 210 | public LSL_Vector modInvokeV(string fname, params object[] parms) |
175 | { | 211 | { |
212 | // m_log.DebugFormat( | ||
213 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
214 | // fname, | ||
215 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
216 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
217 | |||
176 | Type returntype = m_comms.LookupReturnType(fname); | 218 | Type returntype = m_comms.LookupReturnType(fname); |
177 | if (returntype != typeof(OpenMetaverse.Vector3)) | 219 | if (returntype != typeof(OpenMetaverse.Vector3)) |
178 | MODError(String.Format("return type mismatch for {0}",fname)); | 220 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -183,6 +225,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
183 | 225 | ||
184 | public LSL_Rotation modInvokeR(string fname, params object[] parms) | 226 | public LSL_Rotation modInvokeR(string fname, params object[] parms) |
185 | { | 227 | { |
228 | // m_log.DebugFormat( | ||
229 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
230 | // fname, | ||
231 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
232 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
233 | |||
186 | Type returntype = m_comms.LookupReturnType(fname); | 234 | Type returntype = m_comms.LookupReturnType(fname); |
187 | if (returntype != typeof(OpenMetaverse.Quaternion)) | 235 | if (returntype != typeof(OpenMetaverse.Quaternion)) |
188 | MODError(String.Format("return type mismatch for {0}",fname)); | 236 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -193,6 +241,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
193 | 241 | ||
194 | public LSL_List modInvokeL(string fname, params object[] parms) | 242 | public LSL_List modInvokeL(string fname, params object[] parms) |
195 | { | 243 | { |
244 | // m_log.DebugFormat( | ||
245 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
246 | // fname, | ||
247 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
248 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
249 | |||
196 | Type returntype = m_comms.LookupReturnType(fname); | 250 | Type returntype = m_comms.LookupReturnType(fname); |
197 | if (returntype != typeof(object[])) | 251 | if (returntype != typeof(object[])) |
198 | MODError(String.Format("return type mismatch for {0}",fname)); | 252 | MODError(String.Format("return type mismatch for {0}",fname)); |
@@ -250,6 +304,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
250 | return ""; | 304 | return ""; |
251 | } | 305 | } |
252 | 306 | ||
307 | // m_log.DebugFormat( | ||
308 | // "[MOD API]: Invoking dynamic function {0}, args '{1}' with {2} return type", | ||
309 | // fname, | ||
310 | // string.Join(",", Array.ConvertAll<object, string>(parms, o => o.ToString())), | ||
311 | // ((MethodInfo)MethodBase.GetCurrentMethod()).ReturnType); | ||
312 | |||
253 | Type[] signature = m_comms.LookupTypeSignature(fname); | 313 | Type[] signature = m_comms.LookupTypeSignature(fname); |
254 | if (signature.Length != parms.Length) | 314 | if (signature.Length != parms.Length) |
255 | MODError(String.Format("wrong number of parameters to function {0}",fname)); | 315 | MODError(String.Format("wrong number of parameters to function {0}",fname)); |