Add a hust UUID to the script invocations
parent
98a6c78943
commit
7e0936e4b6
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
Type[] LookupTypeSignature(string fname);
|
Type[] LookupTypeSignature(string fname);
|
||||||
Type LookupReturnType(string fname);
|
Type LookupReturnType(string fname);
|
||||||
|
|
||||||
object InvokeOperation(UUID scriptId, string fname, params object[] parms);
|
object InvokeOperation(UUID hostId, UUID scriptId, string fname, params object[] parms);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send a link_message event to an in-world script
|
/// Send a link_message event to an in-world script
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
||||||
|
|
||||||
public void RegisterScriptInvocation(object target, string meth)
|
public void RegisterScriptInvocation(object target, string meth)
|
||||||
{
|
{
|
||||||
MethodInfo mi = target.GetType()..GetMethod(meth,
|
MethodInfo mi = target.GetType().GetMethod(meth,
|
||||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||||
Type delegateType;
|
Type delegateType;
|
||||||
|
|
||||||
|
@ -153,13 +153,13 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
||||||
lock (m_scriptInvocation)
|
lock (m_scriptInvocation)
|
||||||
{
|
{
|
||||||
ParameterInfo[] parameters = fcall.Method.GetParameters ();
|
ParameterInfo[] parameters = fcall.Method.GetParameters ();
|
||||||
if (parameters.Length == 0) // Must have one UUID param
|
if (parameters.Length < 2) // Must have two UUID params
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Hide the first parameter
|
// Hide the first two parameters
|
||||||
Type[] parmTypes = new Type[parameters.Length - 1];
|
Type[] parmTypes = new Type[parameters.Length - 2];
|
||||||
for (int i = 1 ; i < parameters.Length ; i++)
|
for (int i = 2 ; i < parameters.Length ; i++)
|
||||||
parmTypes[i - 1] = parameters[i].ParameterType;
|
parmTypes[i - 2] = parameters[i].ParameterType;
|
||||||
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
|
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,9 +239,10 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object InvokeOperation(UUID scriptid, string fname, params object[] parms)
|
public object InvokeOperation(UUID hostid, UUID scriptid, string fname, params object[] parms)
|
||||||
{
|
{
|
||||||
List<object> olist = new List<object>();
|
List<object> olist = new List<object>();
|
||||||
|
olist.Add(hostid);
|
||||||
olist.Add(scriptid);
|
olist.Add(scriptid);
|
||||||
foreach (object o in parms)
|
foreach (object o in parms)
|
||||||
olist.Add(o);
|
olist.Add(o);
|
||||||
|
|
|
@ -122,6 +122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
/// <param name="fname">The name of the function to invoke</param>
|
/// <param name="fname">The name of the function to invoke</param>
|
||||||
/// <param name="parms">List of parameters</param>
|
/// <param name="parms">List of parameters</param>
|
||||||
/// <returns>string result of the invocation</returns>
|
/// <returns>string result of the invocation</returns>
|
||||||
|
public void modInvokeN(string fname, params object[] parms)
|
||||||
|
{
|
||||||
|
Type returntype = m_comms.LookupReturnType(fname);
|
||||||
|
if (returntype != typeof(string))
|
||||||
|
MODError(String.Format("return type mismatch for {0}",fname));
|
||||||
|
|
||||||
|
modInvoke(fname,parms);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_String modInvokeS(string fname, params object[] parms)
|
public LSL_String modInvokeS(string fname, params object[] parms)
|
||||||
{
|
{
|
||||||
Type returntype = m_comms.LookupReturnType(fname);
|
Type returntype = m_comms.LookupReturnType(fname);
|
||||||
|
@ -243,7 +252,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// non-null but don't trust it completely
|
// non-null but don't trust it completely
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
object result = m_comms.InvokeOperation(m_itemID,fname,convertedParms);
|
object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
public interface IMOD_Api
|
public interface IMOD_Api
|
||||||
{
|
{
|
||||||
// Invocation functions
|
// Invocation functions
|
||||||
|
void modInvokeN(string fname, params object[] parms);
|
||||||
LSL_String modInvokeS(string fname, params object[] parms);
|
LSL_String modInvokeS(string fname, params object[] parms);
|
||||||
LSL_Integer modInvokeI(string fname, params object[] parms);
|
LSL_Integer modInvokeI(string fname, params object[] parms);
|
||||||
LSL_Float modInvokeF(string fname, params object[] parms);
|
LSL_Float modInvokeF(string fname, params object[] parms);
|
||||||
|
|
|
@ -62,6 +62,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_MOD_Functions = (IMOD_Api)api;
|
m_MOD_Functions = (IMOD_Api)api;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void modInvokeN(string fname, params object[] parms)
|
||||||
|
{
|
||||||
|
m_MOD_Functions.modInvokeN(fname, parms);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_String modInvokeS(string fname, params object[] parms)
|
public LSL_String modInvokeS(string fname, params object[] parms)
|
||||||
{
|
{
|
||||||
return m_MOD_Functions.modInvokeS(fname, parms);
|
return m_MOD_Functions.modInvokeS(fname, parms);
|
||||||
|
|
Loading…
Reference in New Issue