aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs18
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs12
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs79
5 files changed, 98 insertions, 22 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs
index a500154..fef85dd 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IAvatar.cs
@@ -32,10 +32,8 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 34{
35 public interface IAvatar 35 public interface IAvatar : IEntity
36 { 36 {
37 string Name { get; } 37
38 UUID GlobalID { get; }
39 Vector3 Position { get; }
40 } 38 }
41} 39}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs
index fd62328..dc2e3fa 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IObject.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
48 48
49 public delegate void OnTouchDelegate(IObject sender, TouchEventArgs e); 49 public delegate void OnTouchDelegate(IObject sender, TouchEventArgs e);
50 50
51 public interface IObject 51 public interface IObject : IEntity
52 { 52 {
53 #region Events 53 #region Events
54 54
@@ -92,17 +92,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
92 uint LocalID { get; } 92 uint LocalID { get; }
93 93
94 /// <summary> 94 /// <summary>
95 /// The global 'world-unique' ID for this object.
96 /// (Note, may not actually be world unique)
97 /// </summary>
98 UUID GlobalID { get; }
99
100 /// <summary>
101 /// The name of this Object.
102 /// </summary>
103 String Name { get; set; }
104
105 /// <summary>
106 /// The description assigned to this object. 95 /// The description assigned to this object.
107 /// </summary> 96 /// </summary>
108 String Description { get; set; } 97 String Description { get; set; }
@@ -141,11 +130,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
141 Quaternion OffsetRotation { get; set; } 130 Quaternion OffsetRotation { get; set; }
142 131
143 /// <summary> 132 /// <summary>
144 /// The position of the object relative to the Scene
145 /// </summary>
146 Vector3 WorldPosition { get; set; }
147
148 /// <summary>
149 /// The position of the object relative to a parent object 133 /// The position of the object relative to a parent object
150 /// If root, works the same as WorldPosition 134 /// If root, works the same as WorldPosition
151 /// </summary> 135 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs
index b35b57d..e7d9024 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IWorld.cs
@@ -25,13 +25,25 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29
28namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 30namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
29{ 31{
32 public class ChatEventArgs : EventArgs
33 {
34 public string Text;
35 public IEntity Sender;
36 }
37
38 public delegate void OnChatDelegate(IWorld sender, ChatEventArgs e);
39
30 public interface IWorld 40 public interface IWorld
31 { 41 {
32 IObjectAccessor Objects { get; } 42 IObjectAccessor Objects { get; }
33 IAvatar[] Avatars { get; } 43 IAvatar[] Avatars { get; }
34 IParcel[] Parcels { get; } 44 IParcel[] Parcels { get; }
35 IHeightmap Terrain { get; } 45 IHeightmap Terrain { get; }
46
47 event OnChatDelegate OnChat;
36 } 48 }
37} 49}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
index 25b547c..41074c3 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Region.Framework.Scenes; 30using OpenSim.Region.Framework.Scenes;
30 31
@@ -49,6 +50,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
49 public string Name 50 public string Name
50 { 51 {
51 get { return GetSP().Name; } 52 get { return GetSP().Name; }
53 set { throw new InvalidOperationException("Avatar Names are a read-only property."); }
52 } 54 }
53 55
54 public UUID GlobalID 56 public UUID GlobalID
@@ -56,9 +58,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
56 get { return m_ID; } 58 get { return m_ID; }
57 } 59 }
58 60
59 public Vector3 Position 61 public Vector3 WorldPosition
60 { 62 {
61 get { return GetSP().AbsolutePosition; } 63 get { return GetSP().AbsolutePosition; }
64 set { GetSP().AbsolutePosition = value; }
62 } 65 }
63 } 66 }
64} 67}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index 05a6a84..e3553bf 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim.Framework;
29using OpenSim.Region.Framework.Interfaces; 30using OpenSim.Region.Framework.Interfaces;
30using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
31 32
@@ -45,6 +46,84 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
45 m_objs = new ObjectAccessor(m_internalScene); 46 m_objs = new ObjectAccessor(m_internalScene);
46 } 47 }
47 48
49 #region Events
50
51 #region OnChat
52 private event OnChatDelegate _OnChat;
53 private bool _OnChatActive;
54
55 public event OnChatDelegate OnChat
56 {
57 add
58 {
59 if (!_OnChatActive)
60 {
61 _OnChatActive = true;
62 m_internalScene.EventManager.OnChatFromClient += EventManager_OnChatFromClient;
63 m_internalScene.EventManager.OnChatFromWorld += EventManager_OnChatFromWorld;
64 }
65
66 _OnChat += value;
67 }
68 remove
69 {
70 _OnChat -= value;
71
72 if (_OnChat == null)
73 {
74 _OnChatActive = false;
75 m_internalScene.EventManager.OnChatFromClient -= EventManager_OnChatFromClient;
76 m_internalScene.EventManager.OnChatFromWorld -= EventManager_OnChatFromWorld;
77 }
78 }
79 }
80
81 void EventManager_OnChatFromWorld(object sender, OpenSim.Framework.OSChatMessage chat)
82 {
83 if (_OnChat != null)
84 {
85 HandleChatPacket(chat);
86 return;
87 }
88 }
89
90 private void HandleChatPacket(OSChatMessage chat)
91 {
92 // Object?
93 if (chat.Sender == null && chat.SenderObject != null)
94 {
95 ChatEventArgs e = new ChatEventArgs();
96 e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId);
97 e.Text = chat.Message;
98
99 _OnChat(this, e);
100 return;
101 }
102 // Avatar?
103 if (chat.SenderObject != null && chat.SenderObject == null)
104 {
105 ChatEventArgs e = new ChatEventArgs();
106 e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID);
107 e.Text = chat.Message;
108
109 _OnChat(this, e);
110 return;
111 }
112 // Skip if other
113 }
114
115 void EventManager_OnChatFromClient(object sender, OpenSim.Framework.OSChatMessage chat)
116 {
117 if (_OnChat != null)
118 {
119 HandleChatPacket(chat);
120 return;
121 }
122 }
123 #endregion
124
125 #endregion
126
48 public IObjectAccessor Objects 127 public IObjectAccessor Objects
49 { 128 {
50 get { return m_objs; } 129 get { return m_objs; }