aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs43
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
30namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 30namespace 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 {