aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs53
1 files changed, 4 insertions, 49 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index a9ded3f..90e4a1f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework.Types;
35using OpenSim.Framework.Communications.Caches; 35using OpenSim.Framework.Communications.Caches;
36using OpenSim.Framework.Data; 36using OpenSim.Framework.Data;
37using OpenSim.Framework.Utilities; 37using OpenSim.Framework.Utilities;
38using OpenSim.Region.Environment.Interfaces;
38 39
39namespace OpenSim.Region.Environment.Scenes 40namespace OpenSim.Region.Environment.Scenes
40{ 41{
@@ -94,7 +95,7 @@ namespace OpenSim.Region.Environment.Scenes
94 } 95 }
95 96
96 /// <summary> 97 /// <summary>
97 /// Should be removed soon as the Chat modules should take over this function 98 ///
98 /// </summary> 99 /// </summary>
99 /// <param name="message"></param> 100 /// <param name="message"></param>
100 /// <param name="type"></param> 101 /// <param name="type"></param>
@@ -103,56 +104,10 @@ namespace OpenSim.Region.Environment.Scenes
103 /// <param name="fromAgentID"></param> 104 /// <param name="fromAgentID"></param>
104 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 105 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
105 { 106 {
106 ScenePresence avatar = null; 107 if (m_simChatModule != null)
107 if (this.Avatars.ContainsKey(fromAgentID))
108 { 108 {
109 avatar = this.Avatars[fromAgentID]; 109 m_simChatModule.SimChat(message, type, fromPos, fromName, fromAgentID);
110 fromPos = avatar.AbsolutePosition;
111 fromName = avatar.Firstname + " " + avatar.Lastname;
112 avatar = null;
113 } 110 }
114
115 this.ForEachScenePresence(delegate(ScenePresence presence)
116 {
117 int dis = -1000;
118 if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId))
119 {
120 avatar = this.Avatars[presence.ControllingClient.AgentId];
121 dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos);
122 }
123
124 switch (type)
125 {
126 case 0: // Whisper
127 if ((dis < 10) && (dis > -10))
128 {
129 //should change so the message is sent through the avatar rather than direct to the ClientView
130 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
131 fromAgentID);
132 }
133 break;
134 case 1: // Say
135 if ((dis < 30) && (dis > -30))
136 {
137 //Console.WriteLine("sending chat");
138 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
139 fromAgentID);
140 }
141 break;
142 case 2: // Shout
143 if ((dis < 100) && (dis > -100))
144 {
145 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
146 fromAgentID);
147 }
148 break;
149
150 case 0xff: // Broadcast
151 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
152 fromAgentID);
153 break;
154 }
155 });
156 } 111 }
157 112
158 /// <summary> 113 /// <summary>