diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index ea44f9a3e3..eee4e4ad3c 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs @@ -96,9 +96,12 @@ namespace OpenSim.Region.Environment.Scenes public event OnPermissionErrorDelegate OnPermissionError; public delegate void NewRezScript(uint localID, LLUUID itemID, string script); + public delegate void RezEvent(uint localID, LLUUID itemID, int param); public event NewRezScript OnRezScript; + public event RezEvent OnRezEvent; + public delegate void RemoveScript(uint localID, LLUUID itemID); public event RemoveScript OnRemoveScript; @@ -319,6 +322,7 @@ namespace OpenSim.Region.Environment.Scenes private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset private NewRezScript handlerRezScript = null; //OnRezScript; + private RezEvent handlerOnRezEvent = null; //OnRezEvent; private RemoveScript handlerRemoveScript = null; //OnRemoveScript; private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab; @@ -513,6 +517,15 @@ namespace OpenSim.Region.Environment.Scenes } } + public void TriggerOnRezEvent(uint localID, LLUUID itemID, int param) + { + handlerOnRezEvent = OnRezEvent; + if (handlerOnRezEvent != null) + { + handlerOnRezEvent(localID, itemID, param); + } + } + public void TriggerRemoveScript(uint localID, LLUUID itemID) { handlerRemoveScript = OnRemoveScript; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 306998e07e..c816e41238 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1673,7 +1673,7 @@ namespace OpenSim.Region.Environment.Scenes group.UpdateGroupRotation(rot); group.ApplyPhysics(m_physicalPrim); group.Velocity = vel; - group.StartScripts(); + group.StartScripts(param); rootPart.ScheduleFullUpdate(); return rootPart.ParentGroup; } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index c49970ff03..3e84af05b8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -98,6 +98,21 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// Start the scripts contained in all the prims in this group. + /// + public void StartScripts(int param) + { + // Don't start scripts if they're turned off in the region! + if (!((m_scene.RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipScripts) == Simulator.RegionFlags.SkipScripts)) + { + foreach (SceneObjectPart part in m_parts.Values) + { + part.StartScripts(param); + } + } + } + public void StopScripts() { lock (m_parts) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index a1d087e53c..5ef9c7977c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -152,6 +152,24 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// Start all the scripts contained in this prim's inventory + /// + public void StartScripts(int param) + { + lock (m_taskInventory) + { + foreach (TaskInventoryItem item in m_taskInventory.Values) + { + // XXX more hardcoding badness. Should be an enum in TaskInventoryItem + if (10 == item.Type) + { + StartScript(item, param); + } + } + } + } + /// /// Stop all the scripts in this prim. /// @@ -175,6 +193,12 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + public void StartScript(TaskInventoryItem item, int param) + { + StartScript(item); + m_parentGroup.Scene.EventManager.TriggerOnRezEvent(LocalId, item.ItemID, param); + } + public void StartScript(TaskInventoryItem item) { // m_log.InfoFormat(