From d635b526e5997a66f3a54134230289cb248a9cee Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Wed, 4 Jun 2008 14:31:36 +0000
Subject: Mantis#1439. Thank you kindly, Melanie for a patch that plumbs in the
events for on_rez.
---
OpenSim/Region/Environment/Scenes/EventManager.cs | 13 ++++++++++++
.../Region/Environment/Scenes/Scene.Inventory.cs | 2 +-
.../Scenes/SceneObjectGroup.Inventory.cs | 15 ++++++++++++++
.../Scenes/SceneObjectPart.Inventory.cs | 24 ++++++++++++++++++++++
4 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs
index ea44f9a..eee4e4a 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 306998e..c816e41 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 c49970f..3e84af0 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 a1d087e..5ef9c79 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -153,6 +153,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.
///
public void StopScripts()
@@ -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(
--
cgit v1.1