diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 124 |
1 files changed, 116 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 5b1c9f4..4733547 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -550,6 +550,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
550 | /// </remarks> | 550 | /// </remarks> |
551 | public event ScriptControlEvent OnScriptControlEvent; | 551 | public event ScriptControlEvent OnScriptControlEvent; |
552 | 552 | ||
553 | public delegate void ScriptMovingStartEvent(uint localID); | ||
554 | |||
555 | /// <summary> | ||
556 | /// TODO: Should be triggered when a physics object starts moving. | ||
557 | /// </summary> | ||
558 | public event ScriptMovingStartEvent OnScriptMovingStartEvent; | ||
559 | |||
560 | public delegate void ScriptMovingEndEvent(uint localID); | ||
561 | |||
562 | /// <summary> | ||
563 | /// TODO: Should be triggered when a physics object stops moving. | ||
564 | /// </summary> | ||
565 | public event ScriptMovingEndEvent OnScriptMovingEndEvent; | ||
566 | |||
553 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); | 567 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); |
554 | 568 | ||
555 | /// <summary> | 569 | /// <summary> |
@@ -755,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | public event ScriptTimerEvent OnScriptTimerEvent; | 769 | public event ScriptTimerEvent OnScriptTimerEvent; |
756 | */ | 770 | */ |
757 | 771 | ||
758 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 772 | public delegate void EstateToolsSunUpdate(ulong regionHandle); |
759 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 773 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
760 | 774 | ||
761 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; | 775 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; |
@@ -778,6 +792,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
778 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
779 | 793 | ||
780 | /// <summary> | 794 | /// <summary> |
795 | /// Triggered when an object is placed into the physical scene (PhysicsActor created). | ||
796 | /// </summary> | ||
797 | public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene; | ||
798 | /// <summary> | ||
799 | /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed). | ||
800 | /// </summary> | ||
801 | /// <remarks> | ||
802 | /// Note: this is triggered just before the PhysicsActor is removed from the | ||
803 | /// physics engine so the receiver can do any necessary cleanup before its destruction. | ||
804 | /// </remarks> | ||
805 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | ||
806 | |||
807 | /// <summary> | ||
781 | /// Triggered when an object is removed from the scene. | 808 | /// Triggered when an object is removed from the scene. |
782 | /// </summary> | 809 | /// </summary> |
783 | /// <remarks> | 810 | /// <remarks> |
@@ -1527,6 +1554,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1527 | } | 1554 | } |
1528 | } | 1555 | } |
1529 | 1556 | ||
1557 | public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) | ||
1558 | { | ||
1559 | Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene; | ||
1560 | if (handler != null) | ||
1561 | { | ||
1562 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1563 | { | ||
1564 | try | ||
1565 | { | ||
1566 | d(obj); | ||
1567 | } | ||
1568 | catch (Exception e) | ||
1569 | { | ||
1570 | m_log.ErrorFormat( | ||
1571 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", | ||
1572 | e.Message, e.StackTrace); | ||
1573 | } | ||
1574 | } | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) | ||
1579 | { | ||
1580 | Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene; | ||
1581 | if (handler != null) | ||
1582 | { | ||
1583 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1584 | { | ||
1585 | try | ||
1586 | { | ||
1587 | d(obj); | ||
1588 | } | ||
1589 | catch (Exception e) | ||
1590 | { | ||
1591 | m_log.ErrorFormat( | ||
1592 | "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", | ||
1593 | e.Message, e.StackTrace); | ||
1594 | } | ||
1595 | } | ||
1596 | } | ||
1597 | } | ||
1598 | |||
1530 | public void TriggerShutdown() | 1599 | public void TriggerShutdown() |
1531 | { | 1600 | { |
1532 | Action handlerShutdown = OnShutdown; | 1601 | Action handlerShutdown = OnShutdown; |
@@ -2238,6 +2307,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
2238 | } | 2307 | } |
2239 | } | 2308 | } |
2240 | 2309 | ||
2310 | public void TriggerMovingStartEvent(uint localID) | ||
2311 | { | ||
2312 | ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent; | ||
2313 | if (handlerScriptMovingStartEvent != null) | ||
2314 | { | ||
2315 | foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList()) | ||
2316 | { | ||
2317 | try | ||
2318 | { | ||
2319 | d(localID); | ||
2320 | } | ||
2321 | catch (Exception e) | ||
2322 | { | ||
2323 | m_log.ErrorFormat( | ||
2324 | "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}", | ||
2325 | e.Message, e.StackTrace); | ||
2326 | } | ||
2327 | } | ||
2328 | } | ||
2329 | } | ||
2330 | |||
2331 | public void TriggerMovingEndEvent(uint localID) | ||
2332 | { | ||
2333 | ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent; | ||
2334 | if (handlerScriptMovingEndEvent != null) | ||
2335 | { | ||
2336 | foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList()) | ||
2337 | { | ||
2338 | try | ||
2339 | { | ||
2340 | d(localID); | ||
2341 | } | ||
2342 | catch (Exception e) | ||
2343 | { | ||
2344 | m_log.ErrorFormat( | ||
2345 | "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}", | ||
2346 | e.Message, e.StackTrace); | ||
2347 | } | ||
2348 | } | ||
2349 | } | ||
2350 | } | ||
2351 | |||
2241 | public void TriggerRequestChangeWaterHeight(float height) | 2352 | public void TriggerRequestChangeWaterHeight(float height) |
2242 | { | 2353 | { |
2243 | if (height < 0) | 2354 | if (height < 0) |
@@ -2536,13 +2647,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | } | 2647 | } |
2537 | 2648 | ||
2538 | /// <summary> | 2649 | /// <summary> |
2539 | /// Updates the system as to how the position of the sun should be handled. | 2650 | /// Called when the sun's position parameters have changed in the Region and/or Estate |
2540 | /// </summary> | 2651 | /// </summary> |
2541 | /// <param name="regionHandle"></param> | 2652 | /// <param name="regionHandle">The region that changed</param> |
2542 | /// <param name="FixedTime">True if the Sun Position is fixed</param> | 2653 | public void TriggerEstateToolsSunUpdate(ulong regionHandle) |
2543 | /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param> | ||
2544 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> | ||
2545 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) | ||
2546 | { | 2654 | { |
2547 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 2655 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
2548 | if (handlerEstateToolsSunUpdate != null) | 2656 | if (handlerEstateToolsSunUpdate != null) |
@@ -2551,7 +2659,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2551 | { | 2659 | { |
2552 | try | 2660 | try |
2553 | { | 2661 | { |
2554 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 2662 | d(regionHandle); |
2555 | } | 2663 | } |
2556 | catch (Exception e) | 2664 | catch (Exception e) |
2557 | { | 2665 | { |