Add OnScriptMovingStartEvent and OnScriptMovingEndEvent to EventManager so that these can be triggered by future code (not yet implemented).
Also hooks up moving_start and moving_end script events, eliminating itemID on XEngine EventManager methods since this is completely unused. An adaptation of the patch in http://opensimulator.org/mantis/view.php?id=6515 Thanks Garmin Kawaguichi and Signpost Marv.user_profiles
parent
8ea112a5b2
commit
53833babf9
|
@ -549,6 +549,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </remarks>
|
||||
public event ScriptControlEvent OnScriptControlEvent;
|
||||
|
||||
public delegate void ScriptMovingStartEvent(uint localID);
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Should be triggered when a physics object starts moving.
|
||||
/// </summary>
|
||||
public event ScriptMovingStartEvent OnScriptMovingStartEvent;
|
||||
|
||||
public delegate void ScriptMovingEndEvent(uint localID);
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Should be triggered when a physics object stops moving.
|
||||
/// </summary>
|
||||
public event ScriptMovingEndEvent OnScriptMovingEndEvent;
|
||||
|
||||
public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
|
||||
|
||||
/// <summary>
|
||||
|
@ -2212,6 +2226,48 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerMovingStartEvent(uint localID)
|
||||
{
|
||||
ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
|
||||
if (handlerScriptMovingStartEvent != null)
|
||||
{
|
||||
foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(localID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerMovingEndEvent(uint localID)
|
||||
{
|
||||
ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
|
||||
if (handlerScriptMovingEndEvent != null)
|
||||
{
|
||||
foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(localID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerRequestChangeWaterHeight(float height)
|
||||
{
|
||||
if (height < 0)
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target;
|
||||
myScriptEngine.World.EventManager.OnScriptAtRotTargetEvent += at_rot_target;
|
||||
myScriptEngine.World.EventManager.OnScriptNotAtRotTargetEvent += not_at_rot_target;
|
||||
myScriptEngine.World.EventManager.OnScriptMovingStartEvent += moving_start;
|
||||
myScriptEngine.World.EventManager.OnScriptMovingEndEvent += moving_end;
|
||||
myScriptEngine.World.EventManager.OnScriptControlEvent += control;
|
||||
myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start;
|
||||
myScriptEngine.World.EventManager.OnScriptColliding += collision;
|
||||
|
@ -419,14 +421,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
// dataserver: not handled here
|
||||
// link_message: not handled here
|
||||
|
||||
public void moving_start(uint localID, UUID itemID)
|
||||
public void moving_start(uint localID)
|
||||
{
|
||||
myScriptEngine.PostObjectEvent(localID, new EventParams(
|
||||
"moving_start",new object[0],
|
||||
new DetectParams[0]));
|
||||
}
|
||||
|
||||
public void moving_end(uint localID, UUID itemID)
|
||||
public void moving_end(uint localID)
|
||||
{
|
||||
myScriptEngine.PostObjectEvent(localID, new EventParams(
|
||||
"moving_end",new object[0],
|
||||
|
|
Loading…
Reference in New Issue