diff options
author | Adam Frisby | 2009-04-09 13:22:27 +0000 |
---|---|---|
committer | Adam Frisby | 2009-04-09 13:22:27 +0000 |
commit | 98eda9ebdb168957725c0476abc12cca4dcccd88 (patch) | |
tree | 7a9caf22991a9e8eef1f171b8be3382bd5e0e3c7 /OpenSim/Region | |
parent | * Limits MRM scripting to Region Master Avatar only. (diff) | |
download | opensim-SC-98eda9ebdb168957725c0476abc12cca4dcccd88.zip opensim-SC-98eda9ebdb168957725c0476abc12cca4dcccd88.tar.gz opensim-SC-98eda9ebdb168957725c0476abc12cca4dcccd88.tar.bz2 opensim-SC-98eda9ebdb168957725c0476abc12cca4dcccd88.tar.xz |
* Adds World.OnNewUser += delegate(IWorld sender, NewUserEventArgs e);
* This event fires when a new avatar is created within the Scene. (Internally corresponds to EventManager.OnNewPresence)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | 43 |
2 files changed, 50 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs index e7d9024..acb569f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs | |||
@@ -29,6 +29,13 @@ using System; | |||
29 | 29 | ||
30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 30 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
31 | { | 31 | { |
32 | public class NewUserEventArgs : EventArgs | ||
33 | { | ||
34 | public IAvatar Avatar; | ||
35 | } | ||
36 | |||
37 | public delegate void OnNewUserDelegate(IWorld sender, NewUserEventArgs e); | ||
38 | |||
32 | public class ChatEventArgs : EventArgs | 39 | public class ChatEventArgs : EventArgs |
33 | { | 40 | { |
34 | public string Text; | 41 | public string Text; |
@@ -45,5 +52,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
45 | IHeightmap Terrain { get; } | 52 | IHeightmap Terrain { get; } |
46 | 53 | ||
47 | event OnChatDelegate OnChat; | 54 | event OnChatDelegate OnChat; |
55 | event OnNewUserDelegate OnNewUser; | ||
48 | } | 56 | } |
49 | } | 57 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 34f66d8..2280022 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -51,6 +51,47 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
51 | 51 | ||
52 | #region Events | 52 | #region Events |
53 | 53 | ||
54 | #region OnNewUser | ||
55 | |||
56 | private event OnNewUserDelegate _OnNewUser; | ||
57 | private bool _OnNewUserActive; | ||
58 | |||
59 | public event OnNewUserDelegate OnNewUser | ||
60 | { | ||
61 | add | ||
62 | { | ||
63 | if (!_OnNewUserActive) | ||
64 | { | ||
65 | _OnNewUserActive = true; | ||
66 | m_internalScene.EventManager.OnNewPresence += EventManager_OnNewPresence; | ||
67 | } | ||
68 | |||
69 | _OnNewUser += value; | ||
70 | } | ||
71 | remove | ||
72 | { | ||
73 | _OnNewUser -= value; | ||
74 | |||
75 | if (_OnNewUser == null) | ||
76 | { | ||
77 | _OnNewUserActive = false; | ||
78 | m_internalScene.EventManager.OnNewPresence -= EventManager_OnNewPresence; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | void EventManager_OnNewPresence(ScenePresence presence) | ||
84 | { | ||
85 | if (_OnNewUser != null) | ||
86 | { | ||
87 | NewUserEventArgs e = new NewUserEventArgs(); | ||
88 | e.Avatar = new SPAvatar(m_internalScene, presence.UUID); | ||
89 | _OnNewUser(this, e); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | #endregion | ||
94 | |||
54 | #region OnChat | 95 | #region OnChat |
55 | private event OnChatDelegate _OnChat; | 96 | private event OnChatDelegate _OnChat; |
56 | private bool _OnChatActive; | 97 | private bool _OnChatActive; |
@@ -81,7 +122,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
81 | } | 122 | } |
82 | } | 123 | } |
83 | 124 | ||
84 | void EventManager_OnChatFromWorld(object sender, OpenSim.Framework.OSChatMessage chat) | 125 | void EventManager_OnChatFromWorld(object sender, OSChatMessage chat) |
85 | { | 126 | { |
86 | if (_OnChat != null) | 127 | if (_OnChat != null) |
87 | { | 128 | { |