mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Add per-instance date to DNE to avoid serializing stuff 10 times a second.
Clode cleanup and removal of commented stuff in ScriptManager.
This commit is contained in:
@@ -43,22 +43,22 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
}
|
||||
|
||||
|
||||
protected override scriptEvents DoGetStateEventFlags()
|
||||
protected override scriptEvents DoGetStateEventFlags(string state)
|
||||
{
|
||||
// Console.WriteLine("Get event flags for " + m_Script.State);
|
||||
// Console.WriteLine("Get event flags for " + state);
|
||||
|
||||
// Check to see if we've already computed the flags for this state
|
||||
scriptEvents eventFlags = scriptEvents.None;
|
||||
if (m_stateEvents.ContainsKey(m_Script.State))
|
||||
if (m_stateEvents.ContainsKey(state))
|
||||
{
|
||||
m_stateEvents.TryGetValue(m_Script.State, out eventFlags);
|
||||
m_stateEvents.TryGetValue(state, out eventFlags);
|
||||
return eventFlags;
|
||||
}
|
||||
|
||||
// Fill in the events for this state, cache the results in the map
|
||||
foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap)
|
||||
{
|
||||
string evname = m_Script.State + "_event_" + kvp.Key;
|
||||
string evname = state + "_event_" + kvp.Key;
|
||||
Type type = m_Script.GetType();
|
||||
try
|
||||
{
|
||||
@@ -75,16 +75,16 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
}
|
||||
|
||||
// Save the flags we just computed and return the result
|
||||
m_stateEvents.Add(m_Script.State, eventFlags);
|
||||
m_stateEvents.Add(state, eventFlags);
|
||||
return (eventFlags);
|
||||
}
|
||||
|
||||
protected override void DoExecuteEvent(string FunctionName, object[] args)
|
||||
protected override void DoExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
|
||||
// Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
|
||||
|
||||
string EventName = m_Script.State + "_event_" + FunctionName;
|
||||
string EventName = state + "_event_" + FunctionName;
|
||||
|
||||
//#if DEBUG
|
||||
// Console.WriteLine("ScriptEngine: Script event function name: " + EventName);
|
||||
|
||||
@@ -140,28 +140,23 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
/// </summary>
|
||||
/// <param name="FunctionName">Name of function to execute</param>
|
||||
/// <param name="args">Arguments to pass to function</param>
|
||||
public void ExecuteEvent(string FunctionName, object[] args)
|
||||
public void ExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
if (m_Running == false)
|
||||
{
|
||||
// Script is inactive, do not execute!
|
||||
return;
|
||||
}
|
||||
DoExecuteEvent(FunctionName, args);
|
||||
DoExecuteEvent(state, FunctionName, args);
|
||||
}
|
||||
|
||||
protected abstract void DoExecuteEvent(string FunctionName, object[] args);
|
||||
protected abstract void DoExecuteEvent(string state, string FunctionName, object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Compute the events handled by the current state of the script
|
||||
/// </summary>
|
||||
/// <returns>state mask</returns>
|
||||
public scriptEvents GetStateEventFlags()
|
||||
public scriptEvents GetStateEventFlags(string state)
|
||||
{
|
||||
return DoGetStateEventFlags();
|
||||
return DoGetStateEventFlags(state);
|
||||
}
|
||||
|
||||
protected abstract scriptEvents DoGetStateEventFlags();
|
||||
protected abstract scriptEvents DoGetStateEventFlags(string state);
|
||||
|
||||
/// <summary>
|
||||
/// Stop script from running. Event execution will be ignored.
|
||||
|
||||
@@ -32,10 +32,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public interface IScript
|
||||
{
|
||||
string State { get; set; }
|
||||
int StartParam { get; set; }
|
||||
ExecutorBase Exec { get; }
|
||||
string Source { get; set; }
|
||||
void InitApi(string api, IScriptApi LSL_Functions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,12 +74,6 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
|
||||
private string m_state = "default";
|
||||
|
||||
public String State
|
||||
{
|
||||
get { return m_state; }
|
||||
set { m_state = value; }
|
||||
}
|
||||
|
||||
public void state(string newState)
|
||||
{
|
||||
m_LSL_Functions.state(newState);
|
||||
@@ -98,22 +92,6 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
|
||||
public ILSL_Api m_LSL_Functions;
|
||||
public IOSSL_Api m_OSSL_Functions;
|
||||
private string _Source = String.Empty;
|
||||
public string Source
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Source;
|
||||
}
|
||||
set { _Source = value; }
|
||||
}
|
||||
|
||||
private int m_StartParam = 0;
|
||||
public int StartParam
|
||||
{
|
||||
get { return m_StartParam; }
|
||||
set { m_StartParam = value; }
|
||||
}
|
||||
|
||||
public ScriptBaseClass()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user