diff options
Diffstat (limited to '')
10 files changed, 29 insertions, 24 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index e58fb2a..7249c5d 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim | |||
181 | OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine("DotNetEngine"); | 181 | OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine("DotNetEngine"); |
182 | scene.AddScriptEngine(ScriptEngine, m_log); | 182 | scene.AddScriptEngine(ScriptEngine, m_log); |
183 | // TODO: TEMP load default script | 183 | // TODO: TEMP load default script |
184 | ScriptEngine.StartScript(Path.Combine("ScriptEngines", "Default.lsl"), "TEST"); | 184 | ScriptEngine.StartScript(Path.Combine("ScriptEngines", "Default.lsl"), new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()); |
185 | 185 | ||
186 | 186 | ||
187 | m_localScenes.Add(scene); | 187 | m_localScenes.Add(scene); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8da7923..1cfe9c8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -18,6 +18,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
18 | { | 18 | { |
19 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 19 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
20 | 20 | ||
21 | |||
21 | public LLUUID CreatorID; | 22 | public LLUUID CreatorID; |
22 | public LLUUID OwnerID; | 23 | public LLUUID OwnerID; |
23 | public LLUUID GroupID; | 24 | public LLUUID GroupID; |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 03587de..62c84a6 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -7,6 +7,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
7 | { | 7 | { |
8 | public class NullScriptHost : IScriptHost | 8 | public class NullScriptHost : IScriptHost |
9 | { | 9 | { |
10 | |||
10 | LLVector3 m_pos = new LLVector3( 128, 128, 30 ); | 11 | LLVector3 m_pos = new LLVector3( 128, 128, 30 ); |
11 | public string Name | 12 | public string Name |
12 | { | 13 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs index 510f257..33021ee 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs | |||
@@ -29,6 +29,8 @@ | |||
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.Region.Environment.Scenes.Scripting; | ||
33 | |||
32 | //TODO: WHERE TO PLACE THIS? | 34 | //TODO: WHERE TO PLACE THIS? |
33 | namespace OpenSim.Region.Environment.Scenes.Scripting | 35 | namespace OpenSim.Region.Environment.Scenes.Scripting |
34 | { | 36 | { |
@@ -36,6 +38,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
36 | { | 38 | { |
37 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); | 39 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); |
38 | void Shutdown(); | 40 | void Shutdown(); |
39 | void StartScript(string ScriptID, string ObjectID); | 41 | void StartScript(string ScriptID, IScriptHost ObjectID); |
40 | } | 42 | } |
41 | } | 43 | } |
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; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 36 | namespace 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; | |||
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.Scripting; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 36 | namespace 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; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | //using OpenSim.Region.Environment.Scenes; | ||
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
33 | 35 | ||
34 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 36 | namespace 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); |