diff options
Diffstat (limited to 'OpenSim/Region')
15 files changed, 109 insertions, 79 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs index 2027ca6..e95cbd7 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
32 | using OpenSim.Region.ScriptEngine.Shared; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.Interfaces | 34 | namespace OpenSim.Region.ScriptEngine.Interfaces |
34 | { | 35 | { |
@@ -38,11 +39,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
38 | /// Initialize the API | 39 | /// Initialize the API |
39 | /// </summary> | 40 | /// </summary> |
40 | /// <remarks> | 41 | /// <remarks> |
41 | /// Each API has an identifier, which is used to load the | 42 | /// Each API has an identifier, which is used to load the proper runtime assembly at load time. |
42 | /// proper runtime assembly at load time. | 43 | /// <param name='scriptInstance'>/param> |
43 | /// <param name='engine'>/param> | 44 | void Initialize(IScriptInstance scriptInstance); |
44 | /// <param name='part'></param> | ||
45 | /// <param name='item'></param> | ||
46 | void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); | ||
47 | } | 45 | } |
48 | } \ No newline at end of file | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 2f5b526..9de2d72 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.ScriptEngine.Shared; | 35 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 36 | using OpenSim.Region.ScriptEngine.Interfaces; |
36 | 37 | ||
@@ -105,6 +106,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
105 | /// </summary> | 106 | /// </summary> |
106 | long MeasurementPeriodExecutionTime { get; } | 107 | long MeasurementPeriodExecutionTime { get; } |
107 | 108 | ||
109 | /// <summary> | ||
110 | /// Scene part in which this script instance is contained. | ||
111 | /// </summary> | ||
112 | SceneObjectPart Part { get; } | ||
113 | |||
108 | IScriptEngine Engine { get; } | 114 | IScriptEngine Engine { get; } |
109 | UUID AppDomain { get; set; } | 115 | UUID AppDomain { get; set; } |
110 | string PrimName { get; } | 116 | string PrimName { get; } |
@@ -124,6 +130,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
124 | 130 | ||
125 | uint LocalID { get; } | 131 | uint LocalID { get; } |
126 | UUID AssetID { get; } | 132 | UUID AssetID { get; } |
133 | |||
134 | /// <summary> | ||
135 | /// Inventory item containing the script used. | ||
136 | /// </summary> | ||
137 | TaskInventoryItem ScriptTask { get; } | ||
138 | |||
127 | Queue EventQueue { get; } | 139 | Queue EventQueue { get; } |
128 | 140 | ||
129 | /// <summary> | 141 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ea4e609..44072c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -110,11 +110,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
110 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 110 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
111 | protected ISoundModule m_SoundModule = null; | 111 | protected ISoundModule m_SoundModule = null; |
112 | 112 | ||
113 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 113 | public void Initialize(IScriptInstance scriptInstance) |
114 | { | 114 | { |
115 | m_ScriptEngine = ScriptEngine; | 115 | m_ScriptEngine = scriptInstance.Engine; |
116 | m_host = host; | 116 | m_host = scriptInstance.Part; |
117 | m_item = item; | 117 | m_item = scriptInstance.ScriptTask; |
118 | 118 | ||
119 | LoadLimits(); // read script limits from config. | 119 | LoadLimits(); // read script limits from config. |
120 | 120 | ||
@@ -123,10 +123,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
123 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 123 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
124 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); | 124 | m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>(); |
125 | 125 | ||
126 | AsyncCommands = new AsyncCommandManager(ScriptEngine); | 126 | AsyncCommands = new AsyncCommandManager(m_ScriptEngine); |
127 | } | 127 | } |
128 | 128 | ||
129 | /* load configuration items that affect script, object and run-time behavior. */ | 129 | /// <summary> |
130 | /// Load configuration items that affect script, object and run-time behavior. */ | ||
131 | /// </summary> | ||
130 | private void LoadLimits() | 132 | private void LoadLimits() |
131 | { | 133 | { |
132 | m_ScriptDelayFactor = | 134 | m_ScriptDelayFactor = |
@@ -141,12 +143,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); | 143 | m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); |
142 | if (m_notecardLineReadCharsMax > 65535) | 144 | if (m_notecardLineReadCharsMax > 65535) |
143 | m_notecardLineReadCharsMax = 65535; | 145 | m_notecardLineReadCharsMax = 65535; |
146 | |||
144 | // load limits for particular subsystems. | 147 | // load limits for particular subsystems. |
145 | IConfig SMTPConfig; | 148 | IConfig SMTPConfig; |
146 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { | 149 | if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { |
147 | // there's an smtp config, so load in the snooze time. | 150 | // there's an smtp config, so load in the snooze time. |
148 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); | 151 | EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); |
149 | } | 152 | } |
153 | |||
150 | // Rezzing an object with a velocity can create recoil. This feature seems to have been | 154 | // Rezzing an object with a velocity can create recoil. This feature seems to have been |
151 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales | 155 | // removed from recent versions of SL. The code computes recoil (vel*mass) and scales |
152 | // it by this factor. May be zero to turn off recoil all together. | 156 | // it by this factor. May be zero to turn off recoil all together. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index ceb4660..071c60e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -61,10 +61,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_LSFunctionsEnabled = false; | 61 | internal bool m_LSFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
63 | 63 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 64 | public void Initialize(IScriptInstance scriptInstance) |
65 | { | 65 | { |
66 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = scriptInstance.Engine; |
67 | m_host = host; | 67 | m_host = scriptInstance.Part; |
68 | 68 | ||
69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 69 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
70 | m_LSFunctionsEnabled = true; | 70 | m_LSFunctionsEnabled = true; |
@@ -92,10 +92,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
92 | get { return m_ScriptEngine.World; } | 92 | get { return m_ScriptEngine.World; } |
93 | } | 93 | } |
94 | 94 | ||
95 | // | 95 | /// <summary> |
96 | //Dumps an error message on the debug console. | 96 | /// Dumps an error message on the debug console. |
97 | // | 97 | /// </summary> |
98 | |||
99 | internal void LSShoutError(string message) | 98 | internal void LSShoutError(string message) |
100 | { | 99 | { |
101 | if (message.Length > 1023) | 100 | if (message.Length > 1023) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 8f34833..cbc69aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -61,11 +61,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
61 | internal bool m_MODFunctionsEnabled = false; | 61 | internal bool m_MODFunctionsEnabled = false; |
62 | internal IScriptModuleComms m_comms = null; | 62 | internal IScriptModuleComms m_comms = null; |
63 | 63 | ||
64 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 64 | public void Initialize(IScriptInstance scriptInstance) |
65 | { | 65 | { |
66 | m_ScriptEngine = ScriptEngine; | 66 | m_ScriptEngine = scriptInstance.Engine; |
67 | m_host = host; | 67 | m_host = scriptInstance.Part; |
68 | m_item = item; | 68 | m_item = scriptInstance.ScriptTask; |
69 | 69 | ||
70 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) | 70 | if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) |
71 | m_MODFunctionsEnabled = true; | 71 | m_MODFunctionsEnabled = true; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 958a448..33ae5f0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -142,11 +142,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
142 | 142 | ||
143 | protected IUrlModule m_UrlModule = null; | 143 | protected IUrlModule m_UrlModule = null; |
144 | 144 | ||
145 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 145 | public void Initialize(IScriptInstance scriptInstance) |
146 | { | 146 | { |
147 | m_ScriptEngine = ScriptEngine; | 147 | m_ScriptEngine = scriptInstance.Engine; |
148 | m_host = host; | 148 | m_host = scriptInstance.Part; |
149 | m_item = item; | 149 | m_item = scriptInstance.ScriptTask; |
150 | 150 | ||
151 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | 151 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); |
152 | 152 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index f172216..a2ff51b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -157,9 +157,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
157 | 157 | ||
158 | public UUID AppDomain { get; set; } | 158 | public UUID AppDomain { get; set; } |
159 | 159 | ||
160 | /// <summary> | ||
161 | /// Scene part in which this script instance is contained. | ||
162 | /// </summary> | ||
163 | public SceneObjectPart Part { get; private set; } | 160 | public SceneObjectPart Part { get; private set; } |
164 | 161 | ||
165 | public string PrimName { get; private set; } | 162 | public string PrimName { get; private set; } |
@@ -209,43 +206,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
209 | EventQueue.Clear(); | 206 | EventQueue.Clear(); |
210 | } | 207 | } |
211 | 208 | ||
212 | public ScriptInstance(IScriptEngine engine, SceneObjectPart part, | 209 | public ScriptInstance( |
213 | UUID itemID, UUID assetID, string assembly, | 210 | IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item, |
214 | AppDomain dom, string primName, string scriptName, | 211 | int startParam, bool postOnRez, |
215 | int startParam, bool postOnRez, StateSource stateSource, | 212 | int maxScriptQueue) |
216 | int maxScriptQueue) | ||
217 | { | 213 | { |
218 | State = "default"; | 214 | State = "default"; |
219 | EventQueue = new Queue(32); | 215 | EventQueue = new Queue(32); |
220 | 216 | ||
221 | Engine = engine; | 217 | Engine = engine; |
222 | Part = part; | 218 | Part = part; |
223 | ItemID = itemID; | 219 | ScriptTask = item; |
224 | AssetID = assetID; | 220 | |
225 | PrimName = primName; | 221 | // This is currently only here to allow regression tests to get away without specifying any inventory |
226 | ScriptName = scriptName; | 222 | // item when they are testing script logic that doesn't require an item. |
227 | m_Assembly = assembly; | 223 | if (ScriptTask != null) |
224 | { | ||
225 | ScriptName = ScriptTask.Name; | ||
226 | ItemID = ScriptTask.ItemID; | ||
227 | AssetID = ScriptTask.AssetID; | ||
228 | } | ||
229 | |||
230 | PrimName = part.ParentGroup.Name; | ||
228 | StartParam = startParam; | 231 | StartParam = startParam; |
229 | m_MaxScriptQueue = maxScriptQueue; | 232 | m_MaxScriptQueue = maxScriptQueue; |
230 | m_stateSource = stateSource; | ||
231 | m_postOnRez = postOnRez; | 233 | m_postOnRez = postOnRez; |
232 | m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; | 234 | m_AttachedAvatar = Part.ParentGroup.AttachedAvatar; |
233 | m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; | 235 | m_RegionID = Part.ParentGroup.Scene.RegionInfo.RegionID; |
236 | } | ||
234 | 237 | ||
235 | lock (Part.TaskInventory) | 238 | /// <summary> |
236 | { | 239 | /// Load the script from an assembly into an AppDomain. |
237 | if (Part.TaskInventory.ContainsKey(ItemID)) | 240 | /// </summary> |
238 | { | 241 | /// <param name='dom'></param> |
239 | ScriptTask = Part.TaskInventory[ItemID]; | 242 | /// <param name='assembly'></param> |
240 | } | 243 | /// <param name='stateSource'></param> |
241 | } | 244 | public void Load(AppDomain dom, string assembly, StateSource stateSource) |
245 | { | ||
246 | m_Assembly = assembly; | ||
247 | m_stateSource = stateSource; | ||
242 | 248 | ||
243 | ApiManager am = new ApiManager(); | 249 | ApiManager am = new ApiManager(); |
244 | 250 | ||
245 | foreach (string api in am.GetApis()) | 251 | foreach (string api in am.GetApis()) |
246 | { | 252 | { |
247 | m_Apis[api] = am.CreateApi(api); | 253 | m_Apis[api] = am.CreateApi(api); |
248 | m_Apis[api].Initialize(engine, part, ScriptTask); | 254 | m_Apis[api].Initialize(this); |
249 | } | 255 | } |
250 | 256 | ||
251 | try | 257 | try |
@@ -279,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
279 | 285 | ||
280 | // // m_log.Debug("[Script] Script instance created"); | 286 | // // m_log.Debug("[Script] Script instance created"); |
281 | 287 | ||
282 | part.SetScriptEvents(ItemID, | 288 | Part.SetScriptEvents(ItemID, |
283 | (int)m_Script.GetStateEventFlags(State)); | 289 | (int)m_Script.GetStateEventFlags(State)); |
284 | } | 290 | } |
285 | catch (Exception e) | 291 | catch (Exception e) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index cb7291a..36c7582 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); | 94 | TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); |
94 | 95 | ||
95 | LSL_Api api = new LSL_Api(); | 96 | LSL_Api api = new LSL_Api(); |
96 | api.Initialize(m_engine, so1.RootPart, null); | 97 | api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue)); |
97 | 98 | ||
98 | // Create a second object | 99 | // Create a second object |
99 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); | 100 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); |
@@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
126 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); | 127 | SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); |
127 | m_scene.AddSceneObject(so1); | 128 | m_scene.AddSceneObject(so1); |
128 | LSL_Api api = new LSL_Api(); | 129 | LSL_Api api = new LSL_Api(); |
129 | api.Initialize(m_engine, so1.RootPart, null); | 130 | api.Initialize(new ScriptInstance(m_engine, so1.RootPart, null, 0, false, int.MaxValue)); |
130 | 131 | ||
131 | // Create an object embedded inside the first | 132 | // Create an object embedded inside the first |
132 | UUID itemId = TestHelpers.ParseTail(0x20); | 133 | UUID itemId = TestHelpers.ParseTail(0x20); |
@@ -136,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
136 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); | 137 | SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); |
137 | m_scene.AddSceneObject(so2); | 138 | m_scene.AddSceneObject(so2); |
138 | LSL_Api api2 = new LSL_Api(); | 139 | LSL_Api api2 = new LSL_Api(); |
139 | api2.Initialize(m_engine, so2.RootPart, null); | 140 | api2.Initialize(new ScriptInstance(m_engine, so2.RootPart, null, 0, false, int.MaxValue)); |
140 | 141 | ||
141 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** | 142 | // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** |
142 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); | 143 | api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index d9b17d7..5121344 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
45 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
46 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
@@ -104,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
104 | m_scene.AddSceneObject(grp2); | 105 | m_scene.AddSceneObject(grp2); |
105 | 106 | ||
106 | LSL_Api apiGrp1 = new LSL_Api(); | 107 | LSL_Api apiGrp1 = new LSL_Api(); |
107 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 108 | apiGrp1.Initialize(new ScriptInstance(m_engine, grp1.RootPart, grp1Item, 0, false, int.MaxValue)); |
108 | 109 | ||
109 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); | 110 | apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); |
110 | 111 | ||
@@ -131,7 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
131 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 132 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
132 | 133 | ||
133 | LSL_Api apiGrp1 = new LSL_Api(); | 134 | LSL_Api apiGrp1 = new LSL_Api(); |
134 | apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); | 135 | apiGrp1.Initialize(new ScriptInstance(m_engine, grp1.RootPart, grp1Item, 0, false, int.MaxValue)); |
135 | 136 | ||
136 | apiGrp1.llBreakLink(2); | 137 | apiGrp1.llBreakLink(2); |
137 | 138 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs index 98017d8..28e5831 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenSim.Region.ScriptEngine.Shared.Api; | 36 | using OpenSim.Region.ScriptEngine.Shared.Api; |
37 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 38 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
@@ -67,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | engine.AddRegion(scene); | 68 | engine.AddRegion(scene); |
68 | 69 | ||
69 | m_lslApi = new LSL_Api(); | 70 | m_lslApi = new LSL_Api(); |
70 | m_lslApi.Initialize(engine, part, null); | 71 | m_lslApi.Initialize(new ScriptInstance(engine, part, null, 0, false, int.MaxValue)); |
71 | } | 72 | } |
72 | 73 | ||
73 | [Test] | 74 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index c41d1e7..48c2465 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |
36 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
36 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 37 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using System; | 39 | using System; |
@@ -66,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
66 | engine.AddRegion(scene); | 67 | engine.AddRegion(scene); |
67 | 68 | ||
68 | m_lslApi = new LSL_Api(); | 69 | m_lslApi = new LSL_Api(); |
69 | m_lslApi.Initialize(engine, part, null); | 70 | m_lslApi.Initialize(new ScriptInstance(engine, part, null, 0, false, int.MaxValue)); |
70 | } | 71 | } |
71 | 72 | ||
72 | [Test] | 73 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 1381d2b..5164d4e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | m_scene.AddSceneObject(so); | 94 | m_scene.AddSceneObject(so); |
94 | 95 | ||
95 | OSSL_Api osslApi = new OSSL_Api(); | 96 | OSSL_Api osslApi = new OSSL_Api(); |
96 | osslApi.Initialize(m_engine, part, null); | 97 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
97 | 98 | ||
98 | string notecardName = "appearanceNc"; | 99 | string notecardName = "appearanceNc"; |
99 | 100 | ||
@@ -134,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
134 | m_scene.AddSceneObject(so); | 135 | m_scene.AddSceneObject(so); |
135 | 136 | ||
136 | OSSL_Api osslApi = new OSSL_Api(); | 137 | OSSL_Api osslApi = new OSSL_Api(); |
137 | osslApi.Initialize(m_engine, part, null); | 138 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
138 | 139 | ||
139 | string notecardName = "appearanceNc"; | 140 | string notecardName = "appearanceNc"; |
140 | 141 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index 5ed1f3d..e7b3319 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.CoreModules.Framework.InventoryAccess; | |||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
@@ -98,9 +99,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
98 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 99 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
99 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 100 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
100 | 101 | ||
101 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 102 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); |
103 | new LSL_Api().Initialize(si); | ||
102 | OSSL_Api osslApi = new OSSL_Api(); | 104 | OSSL_Api osslApi = new OSSL_Api(); |
103 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 105 | osslApi.Initialize(si); |
104 | 106 | ||
105 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); | 107 | // SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); |
106 | 108 | ||
@@ -144,9 +146,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
144 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 146 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
145 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 147 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
146 | 148 | ||
147 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 149 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); |
150 | new LSL_Api().Initialize(si); | ||
148 | OSSL_Api osslApi = new OSSL_Api(); | 151 | OSSL_Api osslApi = new OSSL_Api(); |
149 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 152 | osslApi.Initialize(si); |
150 | 153 | ||
151 | // Create an object embedded inside the first | 154 | // Create an object embedded inside the first |
152 | TaskInventoryHelpers.AddNotecard( | 155 | TaskInventoryHelpers.AddNotecard( |
@@ -192,12 +195,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | 195 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); |
193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | 196 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); |
194 | 197 | ||
195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 198 | ScriptInstance si = new ScriptInstance(m_engine, inWorldObj.RootPart, scriptItem, 0, false, int.MaxValue); |
199 | new LSL_Api().Initialize(si); | ||
196 | OSSL_Api osslApi = new OSSL_Api(); | 200 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | 201 | osslApi.Initialize(si); |
198 | 202 | ||
199 | // Create an object embedded inside the first | 203 | // Create an object embedded inside the first |
200 | TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | 204 | TaskInventoryHelpers.AddSceneObject( |
205 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | ||
201 | 206 | ||
202 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); | 207 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); |
203 | 208 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index d6c82f1..584f44f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Region.OptionalModules.World.NPC; | |||
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.ScriptEngine.Shared; | 43 | using OpenSim.Region.ScriptEngine.Shared; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api; | 44 | using OpenSim.Region.ScriptEngine.Shared.Api; |
45 | using OpenSim.Region.ScriptEngine.Shared.Instance; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 46 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
46 | using OpenSim.Services.Interfaces; | 47 | using OpenSim.Services.Interfaces; |
47 | using OpenSim.Tests.Common; | 48 | using OpenSim.Tests.Common; |
@@ -99,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | m_scene.AddSceneObject(so); | 100 | m_scene.AddSceneObject(so); |
100 | 101 | ||
101 | OSSL_Api osslApi = new OSSL_Api(); | 102 | OSSL_Api osslApi = new OSSL_Api(); |
102 | osslApi.Initialize(m_engine, part, null); | 103 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
103 | 104 | ||
104 | string notecardName = "appearanceNc"; | 105 | string notecardName = "appearanceNc"; |
105 | osslApi.osOwnerSaveAppearance(notecardName); | 106 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -125,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
125 | m_scene.AddSceneObject(so); | 126 | m_scene.AddSceneObject(so); |
126 | 127 | ||
127 | OSSL_Api osslApi = new OSSL_Api(); | 128 | OSSL_Api osslApi = new OSSL_Api(); |
128 | osslApi.Initialize(m_engine, so.RootPart, null); | 129 | osslApi.Initialize(new ScriptInstance(m_engine, so.RootPart, null, 0, false, int.MaxValue)); |
129 | 130 | ||
130 | bool gotExpectedException = false; | 131 | bool gotExpectedException = false; |
131 | try | 132 | try |
@@ -160,7 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
160 | m_scene.AddSceneObject(so); | 161 | m_scene.AddSceneObject(so); |
161 | 162 | ||
162 | OSSL_Api osslApi = new OSSL_Api(); | 163 | OSSL_Api osslApi = new OSSL_Api(); |
163 | osslApi.Initialize(m_engine, part, null); | 164 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
164 | 165 | ||
165 | string notecardName = "appearanceNc"; | 166 | string notecardName = "appearanceNc"; |
166 | osslApi.osOwnerSaveAppearance(notecardName); | 167 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -194,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
194 | m_scene.AddSceneObject(so); | 195 | m_scene.AddSceneObject(so); |
195 | 196 | ||
196 | OSSL_Api osslApi = new OSSL_Api(); | 197 | OSSL_Api osslApi = new OSSL_Api(); |
197 | osslApi.Initialize(m_engine, part, null); | 198 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
198 | 199 | ||
199 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 200 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
200 | 201 | ||
@@ -232,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
232 | m_scene.AddSceneObject(so); | 233 | m_scene.AddSceneObject(so); |
233 | 234 | ||
234 | OSSL_Api osslApi = new OSSL_Api(); | 235 | OSSL_Api osslApi = new OSSL_Api(); |
235 | osslApi.Initialize(m_engine, part, null); | 236 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
236 | 237 | ||
237 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); | 238 | osslApi.osOwnerSaveAppearance(firstAppearanceNcName); |
238 | 239 | ||
@@ -284,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
284 | m_scene.AddSceneObject(otherSo); | 285 | m_scene.AddSceneObject(otherSo); |
285 | 286 | ||
286 | OSSL_Api osslApi = new OSSL_Api(); | 287 | OSSL_Api osslApi = new OSSL_Api(); |
287 | osslApi.Initialize(m_engine, part, null); | 288 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
288 | 289 | ||
289 | OSSL_Api otherOsslApi = new OSSL_Api(); | 290 | OSSL_Api otherOsslApi = new OSSL_Api(); |
290 | otherOsslApi.Initialize(m_engine, otherPart, null); | 291 | otherOsslApi.Initialize(new ScriptInstance(m_engine, otherPart, null, 0, false, int.MaxValue)); |
291 | 292 | ||
292 | string notecardName = "appearanceNc"; | 293 | string notecardName = "appearanceNc"; |
293 | osslApi.osOwnerSaveAppearance(notecardName); | 294 | osslApi.osOwnerSaveAppearance(notecardName); |
@@ -331,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
331 | m_scene.AddSceneObject(so); | 332 | m_scene.AddSceneObject(so); |
332 | 333 | ||
333 | OSSL_Api osslApi = new OSSL_Api(); | 334 | OSSL_Api osslApi = new OSSL_Api(); |
334 | osslApi.Initialize(m_engine, part, null); | 335 | osslApi.Initialize(new ScriptInstance(m_engine, part, null, 0, false, int.MaxValue)); |
335 | 336 | ||
336 | string notecardName = "appearanceNc"; | 337 | string notecardName = "appearanceNc"; |
337 | osslApi.osOwnerSaveAppearance(notecardName); | 338 | osslApi.osOwnerSaveAppearance(notecardName); |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8c3bb5b..186ae04 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1284,11 +1284,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1284 | m_DomainScripts[appDomain].Add(itemID); | 1284 | m_DomainScripts[appDomain].Add(itemID); |
1285 | 1285 | ||
1286 | instance = new ScriptInstance(this, part, | 1286 | instance = new ScriptInstance(this, part, |
1287 | itemID, assetID, assembly, | 1287 | item, |
1288 | m_AppDomains[appDomain], | 1288 | startParam, postOnRez, |
1289 | part.ParentGroup.RootPart.Name, | 1289 | m_MaxScriptQueue); |
1290 | item.Name, startParam, postOnRez, | 1290 | |
1291 | stateSource, m_MaxScriptQueue); | 1291 | instance.Load(m_AppDomains[appDomain], assembly, stateSource); |
1292 | 1292 | ||
1293 | // if (DebugLevel >= 1) | 1293 | // if (DebugLevel >= 1) |
1294 | // m_log.DebugFormat( | 1294 | // m_log.DebugFormat( |