From 94aaf67dfaafbcbd4d871f674c465a34c1c1f332 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 21 Sep 2008 21:47:00 +0000 Subject: 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. --- OpenSim/Region/Environment/Scenes/EventManager.cs | 7 ++++--- OpenSim/Region/Environment/Scenes/InnerScene.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 16 +++++++++------- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++++++- .../Environment/Scenes/SceneObjectGroup.Inventory.cs | 5 +++-- .../Environment/Scenes/SceneObjectPart.Inventory.cs | 12 ++++++------ 6 files changed, 32 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') 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 public event OnPermissionErrorDelegate OnPermissionError; - public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez); + public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine); public event NewRezScript OnRezScript; @@ -519,12 +519,13 @@ namespace OpenSim.Region.Environment.Scenes } } - public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez) + public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) { handlerRezScript = OnRezScript; if (handlerRezScript != null) { - handlerRezScript(localID, itemID, script, startParam, postOnRez); + handlerRezScript(localID, itemID, script, startParam, + postOnRez, engine); } } 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 copy.UpdateGroupRotation(rot); } - copy.CreateScriptInstances(0, false); + copy.CreateScriptInstances(0, false, ""); copy.HasGroupChanged = true; copy.ScheduleGroupForFullUpdate(); 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 { if (group is SceneObjectGroup) { - ((SceneObjectGroup) group).CreateScriptInstances(0, false); + ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine); } } } @@ -269,7 +269,9 @@ namespace OpenSim.Region.Environment.Scenes // Trigger rerunning of script (use TriggerRezScript event, see RezScript) if (isScriptRunning) { - part.CreateScriptInstance(item.ItemID, 0, false); + // Needs to determine which engine was running it and use that + // + part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); } } @@ -1289,7 +1291,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez - part.CreateScriptInstance(copyID, 0, false); + part.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine); // m_log.InfoFormat("[PRIMINVENTORY]: " + // "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 part.AddInventoryItem(taskItem); part.GetProperties(remoteClient); - part.CreateScriptInstance(taskItem, 0, false); + part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine); } } @@ -1449,7 +1451,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T if (running > 0) { - destPart.CreateScriptInstance(destTaskItem, 0, false); + destPart.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine); } ScenePresence avatar; @@ -2037,7 +2039,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T } // TODO: make this true to fire on_rez when scripts have state while in inventory - group.CreateScriptInstances(0, false); + group.CreateScriptInstances(0, false, DefaultScriptEngine); if (!attachment) rootPart.ScheduleFullUpdate(); @@ -2141,7 +2143,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T group.UpdateGroupRotation(rot); //group.ApplyPhysics(m_physicalPrim); group.Velocity = vel; - group.CreateScriptInstances(param, true); + group.CreateScriptInstances(param, true, DefaultScriptEngine); rootPart.ScheduleFullUpdate(); 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 private bool m_physics_enabled = true; private bool m_scripts_enabled = true; + private string m_defaultScriptEngine; #endregion @@ -199,6 +200,11 @@ namespace OpenSim.Region.Environment.Scenes get { return m_timePhase; } } + public string DefaultScriptEngine + { + get { return m_defaultScriptEngine; } + } + // Local reference to the objects in the scene (which are held in innerScene) // public Dictionary Objects // { @@ -314,6 +320,8 @@ namespace OpenSim.Region.Environment.Scenes IConfig startupConfig = m_config.Configs["Startup"]; m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f); m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f); + + m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); } catch (Exception) { @@ -574,7 +582,7 @@ namespace OpenSim.Region.Environment.Scenes { if (ent is SceneObjectGroup) { - ((SceneObjectGroup)ent).CreateScriptInstances(0, false); + ((SceneObjectGroup)ent).CreateScriptInstances(0, false, ""); } } } 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 /// /// Start the scripts contained in all the prims in this group. /// - public void CreateScriptInstances(int startParam, bool postOnRez) + public void CreateScriptInstances(int startParam, bool postOnRez, + string engine) { // Don't start scripts if they're turned off in the region! if (!m_scene.RegionInfo.RegionSettings.DisableScripts) { foreach (SceneObjectPart part in m_parts.Values) { - part.CreateScriptInstances(startParam, postOnRez); + part.CreateScriptInstances(startParam, postOnRez, engine); } } } 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 /// /// Start all the scripts contained in this prim's inventory /// - public void CreateScriptInstances(int startParam, bool postOnRez) + public void CreateScriptInstances(int startParam, bool postOnRez, string engine) { lock (m_taskInventory) { @@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Scenes { if ((int)InventoryType.LSL == item.InvType) { - CreateScriptInstance(item, startParam, postOnRez); + CreateScriptInstance(item, startParam, postOnRez, engine); } } } @@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez) + public void CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine) { // m_log.InfoFormat( // "[PRIM INVENTORY]: " + @@ -193,7 +193,7 @@ namespace OpenSim.Region.Environment.Scenes m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; string script = Utils.BytesToString(asset.Data); m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, - startParam, postOnRez); + startParam, postOnRez, engine); m_parentGroup.AddActiveScriptCount(1); ScheduleFullUpdate(); } @@ -207,13 +207,13 @@ namespace OpenSim.Region.Environment.Scenes /// /// A /// - public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez) + public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine) { lock (m_taskInventory) { if (m_taskInventory.ContainsKey(itemId)) { - CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez); + CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez, engine); } else { -- cgit v1.1