aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine
diff options
context:
space:
mode:
authorTedd Hansen2007-08-17 21:24:38 +0000
committerTedd Hansen2007-08-17 21:24:38 +0000
commitfcf7db72728174a628e62ae9d98a3c0090217728 (patch)
tree2eb9138fd0c0cfb46aa44c74cb8cda75fce40f92 /OpenSim/Region/ScriptEngine/DotNetEngine
parentRemoved RAIL test from startup for now... (diff)
downloadopensim-SC_OLD-fcf7db72728174a628e62ae9d98a3c0090217728.zip
opensim-SC_OLD-fcf7db72728174a628e62ae9d98a3c0090217728.tar.gz
opensim-SC_OLD-fcf7db72728174a628e62ae9d98a3c0090217728.tar.bz2
opensim-SC_OLD-fcf7db72728174a628e62ae9d98a3c0090217728.tar.xz
Pimped up Default.lsl. Now featuring a touch counter.
Changed "ObjectID" in ScriptEngine to IScriptHost reference. Events will now be queued based on IScriptHost reference instead of string ID of object. Removed "root" object reference in script.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs24
6 files changed, 23 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index d15701c..7370c6e 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -232,8 +232,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
232 Return += @" 232 Return += @"
233 public Script( 233 public Script(
234 OpenSim.Region.ScriptEngine.DotNetEngine.ScriptManager manager, 234 OpenSim.Region.ScriptEngine.DotNetEngine.ScriptManager manager,
235 OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host, 235 OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( manager, host ) { }"+"\r\n";
236 OpenSim.Region.Environment.Scenes.Scripting.IScriptHost root ) : base( manager, host, root ) { }"+"\r\n";
237 Return += Script; 236 Return += Script;
238 Return += "} }\r\n"; 237 Return += "} }\r\n";
239 238
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index 7c605c2..486332f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -16,13 +16,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
16 16
17 protected ScriptManager m_manager; 17 protected ScriptManager m_manager;
18 protected IScriptHost m_host; 18 protected IScriptHost m_host;
19 protected IScriptHost m_root;
20 19
21 public LSL_BaseClass(ScriptManager manager, IScriptHost host, IScriptHost root) 20 public LSL_BaseClass(ScriptManager manager, IScriptHost host)
22 { 21 {
23 m_manager = manager; 22 m_manager = manager;
24 m_host = host; 23 m_host = host;
25 m_root = root;
26 } 24 }
27 25
28 public Scene World 26 public Scene World
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 47e5abe..8549fa3 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Interfaces; 33using OpenSim.Framework.Interfaces;
34using OpenSim.Region.Environment.Scenes.Scripting;
34 35
35namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
36{ 37{
@@ -40,6 +41,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
40 class EventManager 41 class EventManager
41 { 42 {
42 private ScriptEngine myScriptEngine; 43 private ScriptEngine myScriptEngine;
44 public IScriptHost TEMP_OBJECT_ID;
43 public EventManager(ScriptEngine _ScriptEngine) 45 public EventManager(ScriptEngine _ScriptEngine)
44 { 46 {
45 myScriptEngine = _ScriptEngine; 47 myScriptEngine = _ScriptEngine;
@@ -58,7 +60,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
58 { 60 {
59 // Add to queue for all scripts in ObjectID object 61 // Add to queue for all scripts in ObjectID object
60 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); 62 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
61 myScriptEngine.myEventQueueManager.AddToObjectQueue("TEST", "touch_start", new object[] { (int)0 }); 63 myScriptEngine.myEventQueueManager.AddToObjectQueue(TEMP_OBJECT_ID, "touch_start", new object[] { (int)0 });
62 } 64 }
63 65
64 66
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index a5eff7d..a63aad9 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using System.Threading; 32using System.Threading;
33using System.Reflection; 33using System.Reflection;
34using OpenSim.Region.Environment.Scenes.Scripting;
34 35
35namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
36{ 37{
@@ -45,7 +46,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
45 private Queue<QueueItemStruct> EventQueue = new Queue<QueueItemStruct>(); 46 private Queue<QueueItemStruct> EventQueue = new Queue<QueueItemStruct>();
46 private struct QueueItemStruct 47 private struct QueueItemStruct
47 { 48 {
48 public string ObjectID; 49 public IScriptHost ObjectID;
49 public string ScriptID; 50 public string ScriptID;
50 public string FunctionName; 51 public string FunctionName;
51 public object[] param; 52 public object[] param;
@@ -109,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
109 } 110 }
110 } 111 }
111 112
112 public void AddToObjectQueue(string ObjectID, string FunctionName, object[] param) 113 public void AddToObjectQueue(IScriptHost ObjectID, string FunctionName, object[] param)
113 { 114 {
114 // Determine all scripts in Object and add to their queue 115 // Determine all scripts in Object and add to their queue
115 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding ObjectID: " + ObjectID + ", FunctionName: " + FunctionName); 116 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventQueueManager Adding ObjectID: " + ObjectID + ", FunctionName: " + FunctionName);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index 7b35b5d..d21855b 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -30,6 +30,8 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33//using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Scenes.Scripting;
33 35
34namespace OpenSim.Region.ScriptEngine.DotNetEngine 36namespace OpenSim.Region.ScriptEngine.DotNetEngine
35{ 37{
@@ -80,8 +82,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
80 82
81 // !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app) 83 // !!!FOR DEBUGGING ONLY!!! (for executing script directly from test app)
82 [Obsolete("!!!FOR DEBUGGING ONLY!!!")] 84 [Obsolete("!!!FOR DEBUGGING ONLY!!!")]
83 public void StartScript(string ScriptID, string ObjectID) 85 public void StartScript(string ScriptID, IScriptHost ObjectID)
84 { 86 {
87 this.myEventManager.TEMP_OBJECT_ID = ObjectID;
85 Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); 88 Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID);
86 myScriptManager.StartScript(ScriptID, ObjectID); 89 myScriptManager.StartScript(ScriptID, ObjectID);
87 } 90 }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 8fdac25..f17711c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
53 53
54 54
55 // Object<string, Script<string, script>> 55 // Object<string, Script<string, script>>
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>>(); 56 internal Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<IScriptHost, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>();
57 public Scene World 57 public Scene World
58 { 58 {
59 get 59 get
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
63 } 63 }
64 64
65 65
66 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(IScriptHost ObjectID)
67 { 67 {
68 if (Scripts.ContainsKey(ObjectID) == false) 68 if (Scripts.ContainsKey(ObjectID) == false)
69 return null; 69 return null;
@@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
75 75
76 } 76 }
77 77
78 internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass GetScript(string ObjectID, string ScriptID) 78 internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass GetScript(IScriptHost ObjectID, string ScriptID)
79 { 79 {
80 if (Scripts.ContainsKey(ObjectID) == false) 80 if (Scripts.ContainsKey(ObjectID) == false)
81 return null; 81 return null;
@@ -92,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
92 return Script; 92 return Script;
93 93
94 } 94 }
95 internal void SetScript(string ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script) 95 internal void SetScript(IScriptHost ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script)
96 { 96 {
97 // Create object if it doesn't exist 97 // Create object if it doesn't exist
98 if (Scripts.ContainsKey(ObjectID) == false) 98 if (Scripts.ContainsKey(ObjectID) == false)
@@ -116,8 +116,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
116 /// </summary> 116 /// </summary>
117 /// <param name="ScriptID"></param> 117 /// <param name="ScriptID"></param>
118 /// <param name="ObjectID"></param> 118 /// <param name="ObjectID"></param>
119 public void StartScript(string ScriptID, string ObjectID) 119 public void StartScript(string ScriptID, IScriptHost ObjectID)
120 { 120 {
121 //IScriptHost root = host.GetRoot();
121 m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID); 122 m_scriptEngine.Log.Verbose("ScriptEngine", "ScriptManager StartScript: ScriptID: " + ScriptID + ", ObjectID: " + ObjectID);
122 123
123 // We will initialize and start the script. 124 // We will initialize and start the script.
@@ -162,11 +163,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
162 // * Load and start script, for now with dummy host 163 // * Load and start script, for now with dummy host
163 164
164 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); 165 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
165 IScriptHost host = new NullScriptHost();
166 IScriptHost root = host;
167 166
168 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, host, root ); 167 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID);
169 string FullScriptID = ScriptID + "." + ObjectID; 168 //string FullScriptID = ScriptID + "." + ObjectID;
170 // Add it to our temporary active script keeper 169 // Add it to our temporary active script keeper
171 //Scripts.Add(FullScriptID, Script); 170 //Scripts.Add(FullScriptID, Script);
172 SetScript(ObjectID, ScriptID, Script); 171 SetScript(ObjectID, ScriptID, Script);
@@ -206,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
206 /// <param name="FreeAppDomain">AppDomain to load script into</param> 205 /// <param name="FreeAppDomain">AppDomain to load script into</param>
207 /// <param name="FileName">FileName of script assembly (.dll)</param> 206 /// <param name="FileName">FileName of script assembly (.dll)</param>
208 /// <returns></returns> 207 /// <returns></returns>
209 private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host, IScriptHost root) 208 private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host)
210 { 209 {
211 //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); 210 //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName);
212 // Load .Net Assembly (.dll) 211 // Load .Net Assembly (.dll)
@@ -249,8 +248,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
249 object[] args = new object[] 248 object[] args = new object[]
250 { 249 {
251 this, 250 this,
252 host, 251 host
253 root
254 }; 252 };
255 253
256 return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); 254 return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args );
@@ -258,7 +256,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
258 256
259 } 257 }
260 258
261 internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) 259 internal void ExecuteFunction(IScriptHost ObjectID, string ScriptID, string FunctionName, object[] args)
262 { 260 {
263 m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); 261 m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName);
264 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); 262 OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID);