From 53833babf99d83a27d0be2b820efbe41067ef723 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Jan 2013 03:57:51 +0000 Subject: 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. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 902ded1..9ee1520 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -549,6 +549,20 @@ namespace OpenSim.Region.Framework.Scenes /// public event ScriptControlEvent OnScriptControlEvent; + public delegate void ScriptMovingStartEvent(uint localID); + + /// + /// TODO: Should be triggered when a physics object starts moving. + /// + public event ScriptMovingStartEvent OnScriptMovingStartEvent; + + public delegate void ScriptMovingEndEvent(uint localID); + + /// + /// TODO: Should be triggered when a physics object stops moving. + /// + public event ScriptMovingEndEvent OnScriptMovingEndEvent; + public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); /// @@ -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) -- cgit v1.1