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/OptionalModules/Scripting/Minimodule/World.cs | |
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 'OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | 43 |
1 files changed, 42 insertions, 1 deletions
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 | { |