* Now sending manager, host and root host to Script in constructor.
* Changed how Script accesses World * Implemented llSay, llWhisper and llShout * Added SetText() to IScriptHost, implemented llText * Minor renamings to conform with code conventionsafrisby
parent
cb90510e16
commit
e53d680d41
|
@ -130,5 +130,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public virtual void LandRenegerated()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void SetText(string text, Vector3 color, double alpha);
|
||||
}
|
||||
}
|
|
@ -715,5 +715,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
OnPrimCountTainted();
|
||||
}
|
||||
|
||||
public override void SetText(string text, Vector3 color, double alpha)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -311,5 +311,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OutPacket(proper);
|
||||
}
|
||||
|
||||
public override void SetText(string text, Axiom.Math.Vector3 color, double alpha)
|
||||
{
|
||||
throw new System.Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -949,5 +949,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetText(string text, Vector3 color, double alpha)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -576,6 +576,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetText(string text, Vector3 color, double alpha)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -690,6 +690,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetText(string text, Vector3 color, double alpha)
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,5 +10,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
|||
string Name { get; }
|
||||
LLUUID UUID { get; }
|
||||
LLVector3 AbsolutePosition { get; }
|
||||
void SetText(string text, Axiom.Math.Vector3 color, double alpha);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,5 +22,10 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
|||
{
|
||||
get { return m_pos; }
|
||||
}
|
||||
|
||||
public void SetText(string text, Axiom.Math.Vector3 color, double alpha)
|
||||
{
|
||||
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
static public void SendToDebug(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.m_logger.Verbose("ScriptEngine", "Debug: " + Message);
|
||||
mySE.Log.Verbose("ScriptEngine", "Debug: " + Message);
|
||||
//SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
static public void SendToLog(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.m_logger.Verbose("ScriptEngine", "LOG: " + Message);
|
||||
mySE.Log.Verbose("ScriptEngine", "LOG: " + Message);
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
// Add namespace, class name and inheritance
|
||||
Return = "namespace SecondLife {\r\n";
|
||||
Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n";
|
||||
Return += "public Script( OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( host ) { }\r\n";
|
||||
Return += @"
|
||||
public Script(
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.ScriptManager manager,
|
||||
OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host,
|
||||
OpenSim.Region.Environment.Scenes.Scripting.IScriptHost root ) : base( manager, host, root ) { }"+"\r\n";
|
||||
Return += Script;
|
||||
Return += "} }\r\n";
|
||||
|
||||
|
|
|
@ -12,19 +12,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface
|
||||
{
|
||||
public string State = "default";
|
||||
internal OpenSim.Region.Environment.Scenes.Scene World;
|
||||
private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
|
||||
IScriptHost m_host;
|
||||
protected ScriptManager m_manager;
|
||||
protected IScriptHost m_host;
|
||||
protected IScriptHost m_root;
|
||||
|
||||
public LSL_BaseClass( IScriptHost host )
|
||||
public LSL_BaseClass(ScriptManager manager, IScriptHost host, IScriptHost root)
|
||||
{
|
||||
m_manager = manager;
|
||||
m_host = host;
|
||||
m_root = root;
|
||||
}
|
||||
|
||||
public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID)
|
||||
public Scene World
|
||||
{
|
||||
get { return m_manager.World; }
|
||||
}
|
||||
|
||||
public void Start(string FullScriptID)
|
||||
{
|
||||
World = _World;
|
||||
MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
|
||||
|
||||
return;
|
||||
|
@ -54,12 +61,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); }
|
||||
|
||||
public void llWhisper(int channelID, string text)
|
||||
{
|
||||
//Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");");
|
||||
Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
//type for whisper is 0
|
||||
//World.SimChat(enc.GetBytes(text), 0, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]);
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
|
||||
|
||||
}
|
||||
//public void llSay(int channelID, string text)
|
||||
|
@ -70,18 +80,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
//type for say is 1
|
||||
|
||||
LLVector3 fromPos = m_host.AbsolutePosition; // Position of parent
|
||||
string fromName = m_host.Name; // Name of script parent
|
||||
LLUUID fromUUID = m_host.UUID; // UUID of parent
|
||||
|
||||
World.SimChat( Helpers.StringToField( text ), 1, fromPos, fromName, fromUUID );
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
}
|
||||
|
||||
public void llShout(int channelID, string text)
|
||||
{
|
||||
Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
//type for shout is 2
|
||||
//World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]);
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
2, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
|
||||
}
|
||||
|
||||
|
@ -120,8 +128,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public string llGetTexture(int face) { return ""; }
|
||||
public void llSetPos(Axiom.Math.Vector3 pos) { return; }
|
||||
|
||||
public Axiom.Math.Vector3 llGetPos()
|
||||
{
|
||||
throw new NotImplementedException("llGetPos");
|
||||
// return m_host.AbsolutePosition;
|
||||
}
|
||||
|
||||
public Axiom.Math.Vector3 llGetPos() { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Vector3 llGetLocalPos() { return new Axiom.Math.Vector3(); }
|
||||
public void llSetRot(Axiom.Math.Quaternion rot) { }
|
||||
public Axiom.Math.Quaternion llGetRot() { return new Axiom.Math.Quaternion(); }
|
||||
|
@ -214,7 +226,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public double llGetEnergy() { return 1.0f; }
|
||||
public void llGiveInventory(string destination, string inventory) { }
|
||||
public void llRemoveInventory(string item) { }
|
||||
public void llSetText(string text, Axiom.Math.Vector3 color, double alpha) { }
|
||||
|
||||
public void llSetText(string text, Axiom.Math.Vector3 color, double alpha)
|
||||
{
|
||||
m_host.SetText(text, color, alpha );
|
||||
}
|
||||
|
||||
public double llWater(Axiom.Math.Vector3 offset) { return 0; }
|
||||
public void llPassTouches(int pass) { }
|
||||
public string llRequestAgentData(string id, int data) { return ""; }
|
||||
|
@ -298,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public Axiom.Math.Vector3 llGroundContour(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); }
|
||||
public int llGetAttached() { return 0; }
|
||||
public int llGetFreeMemory() { return 0; }
|
||||
public string llGetRegionName() { return World.RegionInfo.RegionName; }
|
||||
public string llGetRegionName() { return m_manager.RegionName; }
|
||||
public double llGetRegionTimeDilation() { return 1.0f; }
|
||||
public double llGetRegionFPS() { return 10.0f; }
|
||||
public void llParticleSystem(List<Object> rules) { }
|
||||
|
@ -316,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public void llSetTouchText(string text)
|
||||
{
|
||||
}
|
||||
|
||||
public void llSetSitText(string text)
|
||||
{
|
||||
}
|
||||
|
@ -347,8 +365,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public double llLog(double val) { return (double)Math.Log(val); }
|
||||
public List<string> llGetAnimationList(string id) { return new List<string>(); }
|
||||
public void llSetParcelMusicURL(string url) { }
|
||||
public Axiom.Math.Vector3 llGetRootPosition() { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Quaternion llGetRootRotation() { return new Axiom.Math.Quaternion(); }
|
||||
|
||||
public Axiom.Math.Vector3 llGetRootPosition()
|
||||
{
|
||||
throw new NotImplementedException("llGetRootPosition");
|
||||
//return m_root.AbsolutePosition;
|
||||
}
|
||||
|
||||
public Axiom.Math.Quaternion llGetRootRotation()
|
||||
{
|
||||
return new Axiom.Math.Quaternion();
|
||||
}
|
||||
|
||||
public string llGetObjectDesc() { return ""; }
|
||||
public void llSetObjectDesc(string desc) { }
|
||||
public string llGetCreator() { return ""; }
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager
|
||||
|
||||
// Hook up a test event to our test form
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Hooking up dummy-event: touch_start");
|
||||
myScriptEngine.Log.Verbose("ScriptEngine", "EventManager Hooking up dummy-event: touch_start");
|
||||
// TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER
|
||||
myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start);
|
||||
//myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start);
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString());
|
||||
myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString());
|
||||
}
|
||||
}
|
||||
// Todo: Clean up our queues
|
||||
|
@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
}
|
||||
catch (ThreadAbortException tae)
|
||||
{
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message);
|
||||
myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
|
@ -42,7 +43,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
internal EventManager myEventManager; // Handles and queues incoming events from OpenSim
|
||||
internal EventQueueManager myEventQueueManager; // Executes events
|
||||
internal ScriptManager myScriptManager; // Load, unload and execute scripts
|
||||
internal OpenSim.Framework.Console.LogBase m_logger;
|
||||
|
||||
private OpenSim.Framework.Console.LogBase m_log;
|
||||
|
||||
public ScriptEngine()
|
||||
{
|
||||
|
@ -50,10 +52,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
Common.mySE = this;
|
||||
}
|
||||
|
||||
public LogBase Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger)
|
||||
{
|
||||
World = Sceneworld;
|
||||
m_logger = logger;
|
||||
m_log = logger;
|
||||
|
||||
//m_logger.Status("ScriptEngine", "InitializeEngine");
|
||||
|
||||
|
@ -75,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
[Obsolete("!!!FOR DEBUGGING ONLY!!!")]
|
||||
public void StartScript(string ScriptID, string ObjectID)
|
||||
{
|
||||
m_logger.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
||||
Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
|
||||
myScriptManager.StartScript(ScriptID, ObjectID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment.Scenes.Scripting;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
@ -40,19 +41,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
/// Compiles them if necessary
|
||||
/// Execute functions for EventQueueManager
|
||||
/// </summary>
|
||||
class ScriptManager
|
||||
public class ScriptManager
|
||||
{
|
||||
|
||||
private ScriptEngine myScriptEngine;
|
||||
public ScriptManager(ScriptEngine _ScriptEngine)
|
||||
private ScriptEngine m_scriptEngine;
|
||||
public ScriptManager(ScriptEngine scriptEngine)
|
||||
{
|
||||
myScriptEngine = _ScriptEngine;
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Start");
|
||||
m_scriptEngine = scriptEngine;
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager Start");
|
||||
}
|
||||
|
||||
|
||||
// Object<string, Script<string, script>>
|
||||
internal Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>();
|
||||
public Scene World
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_scriptEngine.World;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID)
|
||||
|
@ -88,7 +96,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
{
|
||||
// Create object if it doesn't exist
|
||||
if (Scripts.ContainsKey(ObjectID) == false)
|
||||
{
|
||||
Scripts.Add(ObjectID, new Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>());
|
||||
}
|
||||
|
||||
// Delete script if it exists
|
||||
Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj;
|
||||
|
@ -108,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
/// <param name="ObjectID"></param>
|
||||
public void StartScript(string ScriptID, string ObjectID)
|
||||
{
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID);
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID);
|
||||
|
||||
// We will initialize and start the script.
|
||||
// It will be up to the script itself to hook up the correct events.
|
||||
|
@ -130,7 +140,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
case ".txt":
|
||||
case ".lsl":
|
||||
case ".cs":
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Script is CS/LSL, compiling to .Net Assembly");
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager Script is CS/LSL, compiling to .Net Assembly");
|
||||
// Create a new instance of the compiler (currently we don't want reuse)
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler();
|
||||
// Compile
|
||||
|
@ -142,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
|
||||
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "Compilation done");
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "Compilation done");
|
||||
// * Insert yield into code
|
||||
FileName = ProcessYield(FileName);
|
||||
|
||||
|
@ -152,7 +162,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// * Load and start script, for now with dummy host
|
||||
|
||||
//OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, new NullScriptHost() );
|
||||
IScriptHost host = new NullScriptHost();
|
||||
IScriptHost root = host;
|
||||
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, host, root );
|
||||
string FullScriptID = ScriptID + "." + ObjectID;
|
||||
// Add it to our temporary active script keeper
|
||||
//Scripts.Add(FullScriptID, Script);
|
||||
|
@ -164,12 +177,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// Start the script - giving it BuiltIns
|
||||
//myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface");
|
||||
|
||||
Script.Start(myScriptEngine.World, ScriptID);
|
||||
Script.Start( ScriptID );
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
myScriptEngine.m_logger.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
/// <param name="FreeAppDomain">AppDomain to load script into</param>
|
||||
/// <param name="FileName">FileName of script assembly (.dll)</param>
|
||||
/// <returns></returns>
|
||||
private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host)
|
||||
private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host, IScriptHost root)
|
||||
{
|
||||
//myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName);
|
||||
// Load .Net Assembly (.dll)
|
||||
|
@ -231,7 +244,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
//{
|
||||
//}
|
||||
|
||||
object[] args = new object[] { host };
|
||||
// Create constructor arguments
|
||||
object[] args = new object[]
|
||||
{
|
||||
this,
|
||||
host,
|
||||
root
|
||||
};
|
||||
|
||||
return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args );
|
||||
|
||||
|
@ -240,13 +259,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args)
|
||||
{
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName);
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = myScriptEngine.myScriptManager.GetScript(ObjectID, ScriptID);
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName);
|
||||
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID);
|
||||
|
||||
Type type = Script.GetType();
|
||||
|
||||
|
||||
myScriptEngine.m_logger.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\"");
|
||||
m_scriptEngine.Log.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\"");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -254,7 +273,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
myScriptEngine.m_logger.Error("ScriptEngine", "Exception attempting to executing script function: " + e.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Exception attempting to executing script function: " + e.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -265,5 +284,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
}
|
||||
|
||||
public string RegionName
|
||||
{
|
||||
get
|
||||
{
|
||||
return World.RegionInfo.RegionName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue