diff options
author | Melanie Thielker | 2008-09-21 21:47:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-21 21:47:00 +0000 |
commit | 94aaf67dfaafbcbd4d871f674c465a34c1c1f332 (patch) | |
tree | 33476e5660a95bdf7d29d14beae67a6294af28a7 /OpenSim/Region/Environment | |
parent | * minor: warnings removal (diff) | |
download | opensim-SC_OLD-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.zip opensim-SC_OLD-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.gz opensim-SC_OLD-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.bz2 opensim-SC_OLD-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.xz |
Change the scirpt engine loading mechanism. Script engines are now
ordinary region modules and are able to coexist in one instance.
See http://opensimulator.org/wiki/ScriptEngines for details. There were
changes to OpenSim.ini.example, please note DefaultScriptEngine.
Also see the User docs and FAQ on the Wiki. Default is DotNetEngine.
Diffstat (limited to 'OpenSim/Region/Environment')
8 files changed, 34 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 776ea78..f53b16e 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -174,7 +174,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
174 | 174 | ||
175 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 175 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
176 | { | 176 | { |
177 | sceneObject.CreateScriptInstances(0, true); | 177 | sceneObject.CreateScriptInstances(0, true, ""); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index d1cc082..334d895 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | 180 | ||
181 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 181 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
182 | { | 182 | { |
183 | sceneObject.CreateScriptInstances(0, true); | 183 | sceneObject.CreateScriptInstances(0, true, ""); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 58f5efe..42cbdfc 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
95 | 95 | ||
96 | public event OnPermissionErrorDelegate OnPermissionError; | 96 | public event OnPermissionErrorDelegate OnPermissionError; |
97 | 97 | ||
98 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez); | 98 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine); |
99 | 99 | ||
100 | public event NewRezScript OnRezScript; | 100 | public event NewRezScript OnRezScript; |
101 | 101 | ||
@@ -519,12 +519,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez) | 522 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) |
523 | { | 523 | { |
524 | handlerRezScript = OnRezScript; | 524 | handlerRezScript = OnRezScript; |
525 | if (handlerRezScript != null) | 525 | if (handlerRezScript != null) |
526 | { | 526 | { |
527 | handlerRezScript(localID, itemID, script, startParam, postOnRez); | 527 | handlerRezScript(localID, itemID, script, startParam, |
528 | postOnRez, engine); | ||
528 | } | 529 | } |
529 | } | 530 | } |
530 | 531 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 20442aa..50122f5 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -1604,7 +1604,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1604 | copy.UpdateGroupRotation(rot); | 1604 | copy.UpdateGroupRotation(rot); |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | copy.CreateScriptInstances(0, false); | 1607 | copy.CreateScriptInstances(0, false, ""); |
1608 | copy.HasGroupChanged = true; | 1608 | copy.HasGroupChanged = true; |
1609 | copy.ScheduleGroupForFullUpdate(); | 1609 | copy.ScheduleGroupForFullUpdate(); |
1610 | return copy; | 1610 | return copy; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index f575ecd..c670076 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
69 | { | 69 | { |
70 | if (group is SceneObjectGroup) | 70 | if (group is SceneObjectGroup) |
71 | { | 71 | { |
72 | ((SceneObjectGroup) group).CreateScriptInstances(0, false); | 72 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |
@@ -269,7 +269,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
269 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 269 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
270 | if (isScriptRunning) | 270 | if (isScriptRunning) |
271 | { | 271 | { |
272 | part.CreateScriptInstance(item.ItemID, 0, false); | 272 | // Needs to determine which engine was running it and use that |
273 | // | ||
274 | part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); | ||
273 | } | 275 | } |
274 | } | 276 | } |
275 | 277 | ||
@@ -1289,7 +1291,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T | |||
1289 | 1291 | ||
1290 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1292 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1291 | // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez | 1293 | // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez |
1292 | part.CreateScriptInstance(copyID, 0, false); | 1294 | part.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine); |
1293 | 1295 | ||
1294 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1296 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1295 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1297 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
@@ -1353,7 +1355,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T | |||
1353 | part.AddInventoryItem(taskItem); | 1355 | part.AddInventoryItem(taskItem); |
1354 | part.GetProperties(remoteClient); | 1356 | part.GetProperties(remoteClient); |
1355 | 1357 | ||
1356 | part.CreateScriptInstance(taskItem, 0, false); | 1358 | part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine); |
1357 | } | 1359 | } |
1358 | } | 1360 | } |
1359 | 1361 | ||
@@ -1449,7 +1451,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T | |||
1449 | 1451 | ||
1450 | if (running > 0) | 1452 | if (running > 0) |
1451 | { | 1453 | { |
1452 | destPart.CreateScriptInstance(destTaskItem, 0, false); | 1454 | destPart.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine); |
1453 | } | 1455 | } |
1454 | 1456 | ||
1455 | ScenePresence avatar; | 1457 | ScenePresence avatar; |
@@ -2037,7 +2039,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T | |||
2037 | } | 2039 | } |
2038 | 2040 | ||
2039 | // TODO: make this true to fire on_rez when scripts have state while in inventory | 2041 | // TODO: make this true to fire on_rez when scripts have state while in inventory |
2040 | group.CreateScriptInstances(0, false); | 2042 | group.CreateScriptInstances(0, false, DefaultScriptEngine); |
2041 | 2043 | ||
2042 | if (!attachment) | 2044 | if (!attachment) |
2043 | rootPart.ScheduleFullUpdate(); | 2045 | rootPart.ScheduleFullUpdate(); |
@@ -2141,7 +2143,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T | |||
2141 | group.UpdateGroupRotation(rot); | 2143 | group.UpdateGroupRotation(rot); |
2142 | //group.ApplyPhysics(m_physicalPrim); | 2144 | //group.ApplyPhysics(m_physicalPrim); |
2143 | group.Velocity = vel; | 2145 | group.Velocity = vel; |
2144 | group.CreateScriptInstances(param, true); | 2146 | group.CreateScriptInstances(param, true, DefaultScriptEngine); |
2145 | rootPart.ScheduleFullUpdate(); | 2147 | rootPart.ScheduleFullUpdate(); |
2146 | 2148 | ||
2147 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 2149 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7363fa9..5e1ad71 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -166,6 +166,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
166 | 166 | ||
167 | private bool m_physics_enabled = true; | 167 | private bool m_physics_enabled = true; |
168 | private bool m_scripts_enabled = true; | 168 | private bool m_scripts_enabled = true; |
169 | private string m_defaultScriptEngine; | ||
169 | 170 | ||
170 | #endregion | 171 | #endregion |
171 | 172 | ||
@@ -199,6 +200,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
199 | get { return m_timePhase; } | 200 | get { return m_timePhase; } |
200 | } | 201 | } |
201 | 202 | ||
203 | public string DefaultScriptEngine | ||
204 | { | ||
205 | get { return m_defaultScriptEngine; } | ||
206 | } | ||
207 | |||
202 | // Local reference to the objects in the scene (which are held in innerScene) | 208 | // Local reference to the objects in the scene (which are held in innerScene) |
203 | // public Dictionary<UUID, SceneObjectGroup> Objects | 209 | // public Dictionary<UUID, SceneObjectGroup> Objects |
204 | // { | 210 | // { |
@@ -314,6 +320,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
314 | IConfig startupConfig = m_config.Configs["Startup"]; | 320 | IConfig startupConfig = m_config.Configs["Startup"]; |
315 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f); | 321 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f); |
316 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f); | 322 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f); |
323 | |||
324 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); | ||
317 | } | 325 | } |
318 | catch (Exception) | 326 | catch (Exception) |
319 | { | 327 | { |
@@ -574,7 +582,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
574 | { | 582 | { |
575 | if (ent is SceneObjectGroup) | 583 | if (ent is SceneObjectGroup) |
576 | { | 584 | { |
577 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false); | 585 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, ""); |
578 | } | 586 | } |
579 | } | 587 | } |
580 | } | 588 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index c6452f9..5ce8985 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -55,14 +55,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Start the scripts contained in all the prims in this group. | 56 | /// Start the scripts contained in all the prims in this group. |
57 | /// </summary> | 57 | /// </summary> |
58 | public void CreateScriptInstances(int startParam, bool postOnRez) | 58 | public void CreateScriptInstances(int startParam, bool postOnRez, |
59 | string engine) | ||
59 | { | 60 | { |
60 | // Don't start scripts if they're turned off in the region! | 61 | // Don't start scripts if they're turned off in the region! |
61 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) | 62 | if (!m_scene.RegionInfo.RegionSettings.DisableScripts) |
62 | { | 63 | { |
63 | foreach (SceneObjectPart part in m_parts.Values) | 64 | foreach (SceneObjectPart part in m_parts.Values) |
64 | { | 65 | { |
65 | part.CreateScriptInstances(startParam, postOnRez); | 66 | part.CreateScriptInstances(startParam, postOnRez, engine); |
66 | } | 67 | } |
67 | } | 68 | } |
68 | } | 69 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 08f8cee..061d961 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
125 | /// <summary> | 125 | /// <summary> |
126 | /// Start all the scripts contained in this prim's inventory | 126 | /// Start all the scripts contained in this prim's inventory |
127 | /// </summary> | 127 | /// </summary> |
128 | public void CreateScriptInstances(int startParam, bool postOnRez) | 128 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine) |
129 | { | 129 | { |
130 | lock (m_taskInventory) | 130 | lock (m_taskInventory) |
131 | { | 131 | { |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
133 | { | 133 | { |
134 | if ((int)InventoryType.LSL == item.InvType) | 134 | if ((int)InventoryType.LSL == item.InvType) |
135 | { | 135 | { |
136 | CreateScriptInstance(item, startParam, postOnRez); | 136 | CreateScriptInstance(item, startParam, postOnRez, engine); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
162 | /// </summary> | 162 | /// </summary> |
163 | /// <param name="item"></param> | 163 | /// <param name="item"></param> |
164 | /// <returns></returns> | 164 | /// <returns></returns> |
165 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez) | 165 | public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine) |
166 | { | 166 | { |
167 | // m_log.InfoFormat( | 167 | // m_log.InfoFormat( |
168 | // "[PRIM INVENTORY]: " + | 168 | // "[PRIM INVENTORY]: " + |
@@ -193,7 +193,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
193 | m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; | 193 | m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; |
194 | string script = Utils.BytesToString(asset.Data); | 194 | string script = Utils.BytesToString(asset.Data); |
195 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, | 195 | m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, |
196 | startParam, postOnRez); | 196 | startParam, postOnRez, engine); |
197 | m_parentGroup.AddActiveScriptCount(1); | 197 | m_parentGroup.AddActiveScriptCount(1); |
198 | ScheduleFullUpdate(); | 198 | ScheduleFullUpdate(); |
199 | } | 199 | } |
@@ -207,13 +207,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
207 | /// <param name="itemId"> | 207 | /// <param name="itemId"> |
208 | /// A <see cref="UUID"/> | 208 | /// A <see cref="UUID"/> |
209 | /// </param> | 209 | /// </param> |
210 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez) | 210 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine) |
211 | { | 211 | { |
212 | lock (m_taskInventory) | 212 | lock (m_taskInventory) |
213 | { | 213 | { |
214 | if (m_taskInventory.ContainsKey(itemId)) | 214 | if (m_taskInventory.ContainsKey(itemId)) |
215 | { | 215 | { |
216 | CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez); | 216 | CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez, engine); |
217 | } | 217 | } |
218 | else | 218 | else |
219 | { | 219 | { |