* minor: method documentation
parent
f46fc508d1
commit
7f3bfa277b
|
@ -36,28 +36,40 @@ using Amib.Threading;
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Interfaces
|
namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface for a script API module to communicate with
|
||||||
|
/// the engine it's running under
|
||||||
|
/// </summary>
|
||||||
public interface IScriptEngine
|
public interface IScriptEngine
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// An interface for a script API module to communicate with
|
|
||||||
// the engine it's running under
|
|
||||||
//
|
|
||||||
|
|
||||||
Scene World { get; }
|
Scene World { get; }
|
||||||
IConfig Config { get; }
|
IConfig Config { get; }
|
||||||
Object AsyncCommands { get; }
|
Object AsyncCommands { get; }
|
||||||
ILog Log { get; }
|
ILog Log { get; }
|
||||||
string ScriptEngineName { get; }
|
string ScriptEngineName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post an event to a single script
|
||||||
|
/// </summary>
|
||||||
bool PostScriptEvent(UUID itemID, EventParams parms);
|
bool PostScriptEvent(UUID itemID, EventParams parms);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post event to an entire prim
|
||||||
|
/// </summary>
|
||||||
bool PostObjectEvent(uint localID, EventParams parms);
|
bool PostObjectEvent(uint localID, EventParams parms);
|
||||||
|
|
||||||
void ApiResetScript(UUID itemID);
|
void ApiResetScript(UUID itemID);
|
||||||
void ResetScript(UUID itemID);
|
void ResetScript(UUID itemID);
|
||||||
void SetScriptState(UUID itemID, bool state);
|
void SetScriptState(UUID itemID, bool state);
|
||||||
bool GetScriptState(UUID itemID);
|
bool GetScriptState(UUID itemID);
|
||||||
void SetState(UUID itemID, string newState);
|
void SetState(UUID itemID, string newState);
|
||||||
int GetStartParameter(UUID itemID);
|
int GetStartParameter(UUID itemID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queue an event for execution
|
||||||
|
/// </summary>
|
||||||
IScriptWorkItem QueueEventHandler(object parms);
|
IScriptWorkItem QueueEventHandler(object parms);
|
||||||
|
|
||||||
IScriptApi GetApi(UUID itemID, string name);
|
IScriptApi GetApi(UUID itemID, string name);
|
||||||
|
|
||||||
DetectParams GetDetectParams(UUID item, int number);
|
DetectParams GetDetectParams(UUID item, int number);
|
||||||
|
|
|
@ -50,6 +50,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
bool Wait(TimeSpan t);
|
bool Wait(TimeSpan t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for interaction with a particular script instance
|
||||||
|
/// </summary>
|
||||||
public interface IScriptInstance
|
public interface IScriptInstance
|
||||||
{
|
{
|
||||||
bool Running { get; set; }
|
bool Running { get; set; }
|
||||||
|
@ -75,6 +78,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
void SetState(string state);
|
void SetState(string state);
|
||||||
|
|
||||||
void PostEvent(EventParams data);
|
void PostEvent(EventParams data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process the next event queued for this script
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
object EventProcessor();
|
object EventProcessor();
|
||||||
|
|
||||||
int EventTime();
|
int EventTime();
|
||||||
|
|
|
@ -149,6 +149,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main loop for the manager thread
|
||||||
|
/// </summary>
|
||||||
private static void CmdHandlerThreadLoop()
|
private static void CmdHandlerThreadLoop()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
|
public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
|
||||||
{
|
{
|
||||||
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
internal IScriptEngine m_ScriptEngine;
|
internal IScriptEngine m_ScriptEngine;
|
||||||
internal SceneObjectPart m_host;
|
internal SceneObjectPart m_host;
|
||||||
|
@ -7935,6 +7935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID tid = AsyncCommands.
|
UUID tid = AsyncCommands.
|
||||||
DataserverPlugin.RegisterRequest(m_localID,
|
DataserverPlugin.RegisterRequest(m_localID,
|
||||||
m_itemID, item.AssetID.ToString());
|
m_itemID, item.AssetID.ToString());
|
||||||
|
|
||||||
if (NotecardCache.IsCached(item.AssetID))
|
if (NotecardCache.IsCached(item.AssetID))
|
||||||
{
|
{
|
||||||
AsyncCommands.
|
AsyncCommands.
|
||||||
|
@ -7943,6 +7944,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// ScriptSleep(100);
|
// ScriptSleep(100);
|
||||||
return tid.ToString();
|
return tid.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
WithNotecard(item.AssetID, delegate (UUID id, AssetBase a)
|
WithNotecard(item.AssetID, delegate (UUID id, AssetBase a)
|
||||||
{
|
{
|
||||||
System.Text.ASCIIEncoding enc =
|
System.Text.ASCIIEncoding enc =
|
||||||
|
|
|
@ -161,6 +161,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Holds all the data required to execute a scripting event.
|
||||||
|
/// </summary>
|
||||||
public class EventParams
|
public class EventParams
|
||||||
{
|
{
|
||||||
public EventParams(string eventName, Object[] eventParams, DetectParams[] detectParams)
|
public EventParams(string eventName, Object[] eventParams, DetectParams[] detectParams)
|
||||||
|
|
|
@ -35,7 +35,7 @@ using System.Reflection;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
//using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Amib.Threading;
|
using Amib.Threading;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -52,6 +52,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
public class ScriptInstance : IScriptInstance
|
public class ScriptInstance : IScriptInstance
|
||||||
{
|
{
|
||||||
|
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IScriptEngine m_Engine;
|
private IScriptEngine m_Engine;
|
||||||
private IScriptWorkItem m_CurrentResult = null;
|
private IScriptWorkItem m_CurrentResult = null;
|
||||||
private Queue m_EventQueue = new Queue(32);
|
private Queue m_EventQueue = new Queue(32);
|
||||||
|
@ -455,6 +457,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Process the next event queued for this script
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public object EventProcessor()
|
public object EventProcessor()
|
||||||
{
|
{
|
||||||
EventParams data = null;
|
EventParams data = null;
|
||||||
|
@ -471,6 +477,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
|
||||||
|
|
||||||
m_DetectParams = data.DetectParams;
|
m_DetectParams = data.DetectParams;
|
||||||
|
|
||||||
if (data.EventName == "state") // Hardcoded state change
|
if (data.EventName == "state") // Hardcoded state change
|
||||||
|
@ -721,5 +729,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
return m_Apis[name];
|
return m_Apis[name];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,9 +661,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
parms));
|
parms));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// <summary>
|
||||||
// The main script engine worker
|
/// Process a previously posted script event.
|
||||||
//
|
/// </summary>
|
||||||
|
/// <param name="parms"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private object ProcessEventHandler(object parms)
|
private object ProcessEventHandler(object parms)
|
||||||
{
|
{
|
||||||
CultureInfo USCulture = new CultureInfo("en-US");
|
CultureInfo USCulture = new CultureInfo("en-US");
|
||||||
|
@ -671,12 +673,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
IScriptInstance instance = (ScriptInstance) parms;
|
IScriptInstance instance = (ScriptInstance) parms;
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[XENGINE]: Processing event for {0}", instance);
|
||||||
|
|
||||||
return instance.EventProcessor();
|
return instance.EventProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// <summary>
|
||||||
// Post event to an entire prim
|
/// Post event to an entire prim
|
||||||
//
|
/// </summary>
|
||||||
|
/// <param name="localID"></param>
|
||||||
|
/// <param name="p"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool PostObjectEvent(uint localID, EventParams p)
|
public bool PostObjectEvent(uint localID, EventParams p)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -699,9 +706,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/// <summary>
|
||||||
// Post an event to a single script
|
/// Post an event to a single script
|
||||||
//
|
/// </summary>
|
||||||
|
/// <param name="itemID"></param>
|
||||||
|
/// <param name="p"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool PostScriptEvent(UUID itemID, EventParams p)
|
public bool PostScriptEvent(UUID itemID, EventParams p)
|
||||||
{
|
{
|
||||||
if (m_Scripts.ContainsKey(itemID))
|
if (m_Scripts.ContainsKey(itemID))
|
||||||
|
|
Loading…
Reference in New Issue