diff options
Diffstat (limited to '')
15 files changed, 147 insertions, 50 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index a4d9ac5..6d933e6 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -130,5 +130,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
130 | public virtual void LandRenegerated() | 130 | public virtual void LandRenegerated() |
131 | { | 131 | { |
132 | } | 132 | } |
133 | } | 133 | |
134 | public abstract void SetText(string text, Vector3 color, double alpha); | ||
135 | } | ||
134 | } \ No newline at end of file | 136 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs index 2f51ab3..0efa570 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs +++ b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs | |||
@@ -715,5 +715,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
715 | { | 715 | { |
716 | OnPrimCountTainted(); | 716 | OnPrimCountTainted(); |
717 | } | 717 | } |
718 | |||
719 | public override void SetText(string text, Vector3 color, double alpha) | ||
720 | { | ||
721 | throw new Exception("The method or operation is not implemented."); | ||
722 | } | ||
718 | } | 723 | } |
719 | } \ No newline at end of file | 724 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs index f32c952..6f06b5a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs | |||
@@ -311,5 +311,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
311 | client.OutPacket(proper); | 311 | client.OutPacket(proper); |
312 | } | 312 | } |
313 | 313 | ||
314 | public override void SetText(string text, Axiom.Math.Vector3 color, double alpha) | ||
315 | { | ||
316 | throw new System.Exception("The method or operation is not implemented."); | ||
317 | } | ||
314 | } | 318 | } |
315 | } | 319 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index ec62509..421a981 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -949,5 +949,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
949 | } | 949 | } |
950 | } | 950 | } |
951 | } | 951 | } |
952 | |||
953 | public override void SetText(string text, Vector3 color, double alpha) | ||
954 | { | ||
955 | Text = text; | ||
956 | } | ||
952 | } | 957 | } |
953 | } | 958 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 54bb5e6..8da7923 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -576,6 +576,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
576 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | 576 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) |
577 | { | 577 | { |
578 | } | 578 | } |
579 | |||
580 | public void SetText(string text, Vector3 color, double alpha) | ||
581 | { | ||
582 | Text = text; | ||
583 | } | ||
579 | } | 584 | } |
580 | } | 585 | } |
581 | 586 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5dbf643..7dcb760 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -690,6 +690,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
690 | 690 | ||
691 | } | 691 | } |
692 | } | 692 | } |
693 | |||
694 | public override void SetText(string text, Vector3 color, double alpha) | ||
695 | { | ||
696 | throw new Exception("The method or operation is not implemented."); | ||
697 | } | ||
693 | } | 698 | } |
694 | 699 | ||
695 | } | 700 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index 1c14264..5d5f698 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -10,5 +10,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
10 | string Name { get; } | 10 | string Name { get; } |
11 | LLUUID UUID { get; } | 11 | LLUUID UUID { get; } |
12 | LLVector3 AbsolutePosition { get; } | 12 | LLVector3 AbsolutePosition { get; } |
13 | void SetText(string text, Axiom.Math.Vector3 color, double alpha); | ||
13 | } | 14 | } |
14 | } | 15 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index a55c87e..03587de 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -22,5 +22,10 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
22 | { | 22 | { |
23 | get { return m_pos; } | 23 | get { return m_pos; } |
24 | } | 24 | } |
25 | |||
26 | public void SetText(string text, Axiom.Math.Vector3 color, double alpha) | ||
27 | { | ||
28 | Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); | ||
29 | } | ||
25 | } | 30 | } |
26 | } | 31 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs index 49367f6..232b2a6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | |||
@@ -45,13 +45,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
45 | static public void SendToDebug(string Message) | 45 | static public void SendToDebug(string Message) |
46 | { | 46 | { |
47 | //if (Debug == true) | 47 | //if (Debug == true) |
48 | mySE.m_logger.Verbose("ScriptEngine", "Debug: " + Message); | 48 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); |
49 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 49 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
50 | } | 50 | } |
51 | static public void SendToLog(string Message) | 51 | static public void SendToLog(string Message) |
52 | { | 52 | { |
53 | //if (Debug == true) | 53 | //if (Debug == true) |
54 | mySE.m_logger.Verbose("ScriptEngine", "LOG: " + Message); | 54 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); |
55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index eea2094..d15701c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -229,7 +229,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
229 | // Add namespace, class name and inheritance | 229 | // Add namespace, class name and inheritance |
230 | Return = "namespace SecondLife {\r\n"; | 230 | Return = "namespace SecondLife {\r\n"; |
231 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; | 231 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; |
232 | Return += "public Script( OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( host ) { }\r\n"; | 232 | Return += @" |
233 | public Script( | ||
234 | OpenSim.Region.ScriptEngine.DotNetEngine.ScriptManager manager, | ||
235 | OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host, | ||
236 | OpenSim.Region.Environment.Scenes.Scripting.IScriptHost root ) : base( manager, host, root ) { }"+"\r\n"; | ||
233 | Return += Script; | 237 | Return += Script; |
234 | Return += "} }\r\n"; | 238 | Return += "} }\r\n"; |
235 | 239 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 565bfb7..aa199d5 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -12,20 +12,27 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
12 | public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface | 12 | public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface |
13 | { | 13 | { |
14 | public string State = "default"; | 14 | public string State = "default"; |
15 | internal OpenSim.Region.Environment.Scenes.Scene World; | ||
16 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 15 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); |
17 | 16 | ||
18 | IScriptHost m_host; | 17 | protected ScriptManager m_manager; |
19 | 18 | protected IScriptHost m_host; | |
20 | public LSL_BaseClass( IScriptHost host ) | 19 | protected IScriptHost m_root; |
20 | |||
21 | public LSL_BaseClass(ScriptManager manager, IScriptHost host, IScriptHost root) | ||
21 | { | 22 | { |
23 | m_manager = manager; | ||
22 | m_host = host; | 24 | m_host = host; |
25 | m_root = root; | ||
23 | } | 26 | } |
24 | 27 | ||
25 | public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) | 28 | public Scene World |
26 | { | 29 | { |
27 | World = _World; | 30 | get { return m_manager.World; } |
28 | MainLog.Instance.Notice( "ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@"+m_host.AbsolutePosition +"]"); | 31 | } |
32 | |||
33 | public void Start(string FullScriptID) | ||
34 | { | ||
35 | MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | ||
29 | 36 | ||
30 | return; | 37 | return; |
31 | } | 38 | } |
@@ -54,12 +61,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
54 | public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } | 61 | public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } |
55 | public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } | 62 | public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } |
56 | public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } | 63 | public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } |
64 | |||
57 | public void llWhisper(int channelID, string text) | 65 | public void llWhisper(int channelID, string text) |
58 | { | 66 | { |
59 | //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); | 67 | //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); |
60 | Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); | 68 | Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); |
61 | //type for whisper is 0 | 69 | //type for whisper is 0 |
62 | //World.SimChat(enc.GetBytes(text), 0, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); | 70 | World.SimChat(Helpers.StringToField(text), |
71 | 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
72 | |||
63 | 73 | ||
64 | } | 74 | } |
65 | //public void llSay(int channelID, string text) | 75 | //public void llSay(int channelID, string text) |
@@ -69,22 +79,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
69 | //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); | 79 | //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); |
70 | Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); | 80 | Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); |
71 | //type for say is 1 | 81 | //type for say is 1 |
72 | |||
73 | LLVector3 fromPos = m_host.AbsolutePosition; // Position of parent | ||
74 | string fromName = m_host.Name; // Name of script parent | ||
75 | LLUUID fromUUID = m_host.UUID; // UUID of parent | ||
76 | 82 | ||
77 | World.SimChat( Helpers.StringToField( text ), 1, fromPos, fromName, fromUUID ); | 83 | World.SimChat(Helpers.StringToField(text), |
84 | 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
78 | } | 85 | } |
79 | 86 | ||
80 | public void llShout(int channelID, string text) | 87 | public void llShout(int channelID, string text) |
81 | { | 88 | { |
82 | Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); | 89 | Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); |
83 | //type for shout is 2 | 90 | //type for shout is 2 |
84 | //World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); | 91 | World.SimChat(Helpers.StringToField(text), |
92 | 2, m_host.AbsolutePosition, m_host.Name, m_host.UUID); | ||
85 | 93 | ||
86 | } | 94 | } |
87 | 95 | ||
88 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } | 96 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } |
89 | public void llListenControl(int number, int active) { return; } | 97 | public void llListenControl(int number, int active) { return; } |
90 | public void llListenRemove(int number) { return; } | 98 | public void llListenRemove(int number) { return; } |
@@ -120,8 +128,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
120 | public string llGetTexture(int face) { return ""; } | 128 | public string llGetTexture(int face) { return ""; } |
121 | public void llSetPos(Axiom.Math.Vector3 pos) { return; } | 129 | public void llSetPos(Axiom.Math.Vector3 pos) { return; } |
122 | 130 | ||
123 | 131 | public Axiom.Math.Vector3 llGetPos() | |
124 | public Axiom.Math.Vector3 llGetPos() { return new Axiom.Math.Vector3(); } | 132 | { |
133 | throw new NotImplementedException("llGetPos"); | ||
134 | // return m_host.AbsolutePosition; | ||
135 | } | ||
136 | |||
125 | public Axiom.Math.Vector3 llGetLocalPos() { return new Axiom.Math.Vector3(); } | 137 | public Axiom.Math.Vector3 llGetLocalPos() { return new Axiom.Math.Vector3(); } |
126 | public void llSetRot(Axiom.Math.Quaternion rot) { } | 138 | public void llSetRot(Axiom.Math.Quaternion rot) { } |
127 | public Axiom.Math.Quaternion llGetRot() { return new Axiom.Math.Quaternion(); } | 139 | public Axiom.Math.Quaternion llGetRot() { return new Axiom.Math.Quaternion(); } |
@@ -214,7 +226,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
214 | public double llGetEnergy() { return 1.0f; } | 226 | public double llGetEnergy() { return 1.0f; } |
215 | public void llGiveInventory(string destination, string inventory) { } | 227 | public void llGiveInventory(string destination, string inventory) { } |
216 | public void llRemoveInventory(string item) { } | 228 | public void llRemoveInventory(string item) { } |
217 | public void llSetText(string text, Axiom.Math.Vector3 color, double alpha) { } | 229 | |
230 | public void llSetText(string text, Axiom.Math.Vector3 color, double alpha) | ||
231 | { | ||
232 | m_host.SetText(text, color, alpha ); | ||
233 | } | ||
234 | |||
218 | public double llWater(Axiom.Math.Vector3 offset) { return 0; } | 235 | public double llWater(Axiom.Math.Vector3 offset) { return 0; } |
219 | public void llPassTouches(int pass) { } | 236 | public void llPassTouches(int pass) { } |
220 | public string llRequestAgentData(string id, int data) { return ""; } | 237 | public string llRequestAgentData(string id, int data) { return ""; } |
@@ -298,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
298 | public Axiom.Math.Vector3 llGroundContour(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); } | 315 | public Axiom.Math.Vector3 llGroundContour(Axiom.Math.Vector3 offset) { return new Axiom.Math.Vector3(); } |
299 | public int llGetAttached() { return 0; } | 316 | public int llGetAttached() { return 0; } |
300 | public int llGetFreeMemory() { return 0; } | 317 | public int llGetFreeMemory() { return 0; } |
301 | public string llGetRegionName() { return World.RegionInfo.RegionName; } | 318 | public string llGetRegionName() { return m_manager.RegionName; } |
302 | public double llGetRegionTimeDilation() { return 1.0f; } | 319 | public double llGetRegionTimeDilation() { return 1.0f; } |
303 | public double llGetRegionFPS() { return 10.0f; } | 320 | public double llGetRegionFPS() { return 10.0f; } |
304 | public void llParticleSystem(List<Object> rules) { } | 321 | public void llParticleSystem(List<Object> rules) { } |
@@ -316,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
316 | public void llSetTouchText(string text) | 333 | public void llSetTouchText(string text) |
317 | { | 334 | { |
318 | } | 335 | } |
336 | |||
319 | public void llSetSitText(string text) | 337 | public void llSetSitText(string text) |
320 | { | 338 | { |
321 | } | 339 | } |
@@ -347,8 +365,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
347 | public double llLog(double val) { return (double)Math.Log(val); } | 365 | public double llLog(double val) { return (double)Math.Log(val); } |
348 | public List<string> llGetAnimationList(string id) { return new List<string>(); } | 366 | public List<string> llGetAnimationList(string id) { return new List<string>(); } |
349 | public void llSetParcelMusicURL(string url) { } | 367 | public void llSetParcelMusicURL(string url) { } |
350 | public Axiom.Math.Vector3 llGetRootPosition() { return new Axiom.Math.Vector3(); } | 368 | |
351 | public Axiom.Math.Quaternion llGetRootRotation() { return new Axiom.Math.Quaternion(); } | 369 | public Axiom.Math.Vector3 llGetRootPosition() |
370 | { | ||
371 | throw new NotImplementedException("llGetRootPosition"); | ||
372 | //return m_root.AbsolutePosition; | ||
373 | } | ||
374 | |||
375 | public Axiom.Math.Quaternion llGetRootRotation() | ||
376 | { | ||
377 | return new Axiom.Math.Quaternion(); | ||
378 | } | ||
379 | |||
352 | public string llGetObjectDesc() { return ""; } | 380 | public string llGetObjectDesc() { return ""; } |
353 | public void llSetObjectDesc(string desc) { } | 381 | public void llSetObjectDesc(string desc) { } |
354 | public string llGetCreator() { return ""; } | 382 | public string llGetCreator() { return ""; } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index ec6a2cd..47e5abe 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
48 | // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager | 48 | // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager |
49 | 49 | ||
50 | // Hook up a test event to our test form | 50 | // Hook up a test event to our test form |
51 | myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Hooking up dummy-event: touch_start"); | 51 | myScriptEngine.Log.Verbose("ScriptEngine", "EventManager Hooking up dummy-event: touch_start"); |
52 | // TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER | 52 | // TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER |
53 | myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); | 53 | myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); |
54 | //myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start); | 54 | //myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start); |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index 368ab11..a5eff7d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
74 | } | 74 | } |
75 | catch (Exception e) | 75 | catch (Exception e) |
76 | { | 76 | { |
77 | myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString()); | 77 | myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Exception killing worker thread: " + e.ToString()); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | // Todo: Clean up our queues | 80 | // Todo: Clean up our queues |
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
105 | } | 105 | } |
106 | catch (ThreadAbortException tae) | 106 | catch (ThreadAbortException tae) |
107 | { | 107 | { |
108 | myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message); | 108 | myScriptEngine.Log.Verbose("ScriptEngine", "EventQueueManager Worker thread killed: " + tae.Message); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index f7947f7..7b35b5d 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -29,6 +29,7 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Framework.Console; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
34 | { | 35 | { |
@@ -42,7 +43,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
42 | internal EventManager myEventManager; // Handles and queues incoming events from OpenSim | 43 | internal EventManager myEventManager; // Handles and queues incoming events from OpenSim |
43 | internal EventQueueManager myEventQueueManager; // Executes events | 44 | internal EventQueueManager myEventQueueManager; // Executes events |
44 | internal ScriptManager myScriptManager; // Load, unload and execute scripts | 45 | internal ScriptManager myScriptManager; // Load, unload and execute scripts |
45 | internal OpenSim.Framework.Console.LogBase m_logger; | 46 | |
47 | private OpenSim.Framework.Console.LogBase m_log; | ||
46 | 48 | ||
47 | public ScriptEngine() | 49 | public ScriptEngine() |
48 | { | 50 | { |
@@ -50,10 +52,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
50 | Common.mySE = this; | 52 | Common.mySE = this; |
51 | } | 53 | } |
52 | 54 | ||
55 | public LogBase Log | ||
56 | { | ||
57 | get { return m_log; } | ||
58 | } | ||
59 | |||
53 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) | 60 | public void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger) |
54 | { | 61 | { |
55 | World = Sceneworld; | 62 | World = Sceneworld; |
56 | m_logger = logger; | 63 | m_log = logger; |
57 | 64 | ||
58 | //m_logger.Status("ScriptEngine", "InitializeEngine"); | 65 | //m_logger.Status("ScriptEngine", "InitializeEngine"); |
59 | 66 | ||
@@ -75,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
75 | [Obsolete("!!!FOR DEBUGGING ONLY!!!")] | 82 | [Obsolete("!!!FOR DEBUGGING ONLY!!!")] |
76 | public void StartScript(string ScriptID, string ObjectID) | 83 | public void StartScript(string ScriptID, string ObjectID) |
77 | { | 84 | { |
78 | m_logger.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); | 85 | Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); |
79 | myScriptManager.StartScript(ScriptID, ObjectID); | 86 | myScriptManager.StartScript(ScriptID, ObjectID); |
80 | } | 87 | } |
81 | } | 88 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 8b5e3e3..5606287 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | 35 | using OpenSim.Region.Environment.Scenes.Scripting; |
35 | 36 | ||
36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
@@ -40,19 +41,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
40 | /// Compiles them if necessary | 41 | /// Compiles them if necessary |
41 | /// Execute functions for EventQueueManager | 42 | /// Execute functions for EventQueueManager |
42 | /// </summary> | 43 | /// </summary> |
43 | class ScriptManager | 44 | public class ScriptManager |
44 | { | 45 | { |
45 | 46 | ||
46 | private ScriptEngine myScriptEngine; | 47 | private ScriptEngine m_scriptEngine; |
47 | public ScriptManager(ScriptEngine _ScriptEngine) | 48 | public ScriptManager(ScriptEngine scriptEngine) |
48 | { | 49 | { |
49 | myScriptEngine = _ScriptEngine; | 50 | m_scriptEngine = scriptEngine; |
50 | myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Start"); | 51 | m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager Start"); |
51 | } | 52 | } |
52 | 53 | ||
53 | 54 | ||
54 | // Object<string, Script<string, script>> | 55 | // Object<string, Script<string, script>> |
55 | 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>>(); | 56 | 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>>(); |
57 | public Scene World | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | return m_scriptEngine.World; | ||
62 | } | ||
63 | } | ||
56 | 64 | ||
57 | 65 | ||
58 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID) | 66 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID) |
@@ -88,7 +96,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
88 | { | 96 | { |
89 | // Create object if it doesn't exist | 97 | // Create object if it doesn't exist |
90 | if (Scripts.ContainsKey(ObjectID) == false) | 98 | if (Scripts.ContainsKey(ObjectID) == false) |
99 | { | ||
91 | Scripts.Add(ObjectID, new Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>()); | 100 | Scripts.Add(ObjectID, new Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>()); |
101 | } | ||
92 | 102 | ||
93 | // Delete script if it exists | 103 | // Delete script if it exists |
94 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj; | 104 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj; |
@@ -108,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
108 | /// <param name="ObjectID"></param> | 118 | /// <param name="ObjectID"></param> |
109 | public void StartScript(string ScriptID, string ObjectID) | 119 | public void StartScript(string ScriptID, string ObjectID) |
110 | { | 120 | { |
111 | myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); | 121 | m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); |
112 | 122 | ||
113 | // We will initialize and start the script. | 123 | // We will initialize and start the script. |
114 | // It will be up to the script itself to hook up the correct events. | 124 | // It will be up to the script itself to hook up the correct events. |
@@ -130,7 +140,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
130 | case ".txt": | 140 | case ".txt": |
131 | case ".lsl": | 141 | case ".lsl": |
132 | case ".cs": | 142 | case ".cs": |
133 | myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Script is CS/LSL, compiling to .Net Assembly"); | 143 | m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager Script is CS/LSL, compiling to .Net Assembly"); |
134 | // Create a new instance of the compiler (currently we don't want reuse) | 144 | // Create a new instance of the compiler (currently we don't want reuse) |
135 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); | 145 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Compiler(); |
136 | // Compile | 146 | // Compile |
@@ -142,7 +152,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
142 | 152 | ||
143 | 153 | ||
144 | 154 | ||
145 | myScriptEngine.m_logger.Verbose("ScriptEngine", "Compilation done"); | 155 | m_scriptEngine.Log.Verbose("ScriptEngine", "Compilation done"); |
146 | // * Insert yield into code | 156 | // * Insert yield into code |
147 | FileName = ProcessYield(FileName); | 157 | FileName = ProcessYield(FileName); |
148 | 158 | ||
@@ -152,7 +162,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
152 | // * Load and start script, for now with dummy host | 162 | // * Load and start script, for now with dummy host |
153 | 163 | ||
154 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); | 164 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); |
155 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, new NullScriptHost() ); | 165 | IScriptHost host = new NullScriptHost(); |
166 | IScriptHost root = host; | ||
167 | |||
168 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, host, root ); | ||
156 | string FullScriptID = ScriptID + "." + ObjectID; | 169 | string FullScriptID = ScriptID + "." + ObjectID; |
157 | // Add it to our temporary active script keeper | 170 | // Add it to our temporary active script keeper |
158 | //Scripts.Add(FullScriptID, Script); | 171 | //Scripts.Add(FullScriptID, Script); |
@@ -164,12 +177,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
164 | // Start the script - giving it BuiltIns | 177 | // Start the script - giving it BuiltIns |
165 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); | 178 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); |
166 | 179 | ||
167 | Script.Start(myScriptEngine.World, ScriptID); | 180 | Script.Start( ScriptID ); |
168 | 181 | ||
169 | } | 182 | } |
170 | catch (Exception e) | 183 | catch (Exception e) |
171 | { | 184 | { |
172 | myScriptEngine.m_logger.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString()); | 185 | m_scriptEngine.Log.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString()); |
173 | } | 186 | } |
174 | 187 | ||
175 | 188 | ||
@@ -192,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
192 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | 205 | /// <param name="FreeAppDomain">AppDomain to load script into</param> |
193 | /// <param name="FileName">FileName of script assembly (.dll)</param> | 206 | /// <param name="FileName">FileName of script assembly (.dll)</param> |
194 | /// <returns></returns> | 207 | /// <returns></returns> |
195 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host) | 208 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host, IScriptHost root) |
196 | { | 209 | { |
197 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); | 210 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); |
198 | // Load .Net Assembly (.dll) | 211 | // Load .Net Assembly (.dll) |
@@ -231,7 +244,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
231 | //{ | 244 | //{ |
232 | //} | 245 | //} |
233 | 246 | ||
234 | object[] args = new object[] { host }; | 247 | // Create constructor arguments |
248 | object[] args = new object[] | ||
249 | { | ||
250 | this, | ||
251 | host, | ||
252 | root | ||
253 | }; | ||
235 | 254 | ||
236 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); | 255 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); |
237 | 256 | ||
@@ -240,13 +259,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
240 | 259 | ||
241 | internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) | 260 | internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) |
242 | { | 261 | { |
243 | myScriptEngine.m_logger.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); | 262 | m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); |
244 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = myScriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); | 263 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); |
245 | 264 | ||
246 | Type type = Script.GetType(); | 265 | Type type = Script.GetType(); |
247 | 266 | ||
248 | 267 | ||
249 | myScriptEngine.m_logger.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); | 268 | m_scriptEngine.Log.Verbose("ScriptEngine", "Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); |
250 | 269 | ||
251 | try | 270 | try |
252 | { | 271 | { |
@@ -254,7 +273,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
254 | } | 273 | } |
255 | catch (Exception e) | 274 | catch (Exception e) |
256 | { | 275 | { |
257 | myScriptEngine.m_logger.Error("ScriptEngine", "Exception attempting to executing script function: " + e.ToString()); | 276 | m_scriptEngine.Log.Error("ScriptEngine", "Exception attempting to executing script function: " + e.ToString()); |
258 | } | 277 | } |
259 | 278 | ||
260 | 279 | ||
@@ -265,5 +284,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
265 | 284 | ||
266 | } | 285 | } |
267 | 286 | ||
287 | public string RegionName | ||
288 | { | ||
289 | get | ||
290 | { | ||
291 | return World.RegionInfo.RegionName; | ||
292 | } | ||
293 | } | ||
268 | } | 294 | } |
269 | } | 295 | } |