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