Mantis#1439. Thank you kindly, Melanie for a patch that

plumbs in the events for on_rez.
0.6.0-stable
Charles Krinke 2008-06-04 14:31:36 +00:00
parent 67dee6410d
commit d635b526e5
4 changed files with 53 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -98,6 +98,21 @@ namespace OpenSim.Region.Environment.Scenes
}
}
/// <summary>
/// Start the scripts contained in all the prims in this group.
/// </summary>
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)

View File

@ -152,6 +152,24 @@ namespace OpenSim.Region.Environment.Scenes
}
}
/// <summary>
/// Start all the scripts contained in this prim's inventory
/// </summary>
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);
}
}
}
}
/// <summary>
/// Stop all the scripts in this prim.
/// </summary>
@ -175,6 +193,12 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
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(