aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
authorlbsa712007-07-09 21:03:36 +0000
committerlbsa712007-07-09 21:03:36 +0000
commit08a1fa3f96eee5e067475da453a3770ff15780f9 (patch)
tree1ed047e466e20dcf327f8c890efbf1779ead6ad6 /OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
parent* Ignored all those autogenned build files (diff)
downloadopensim-SC_OLD-08a1fa3f96eee5e067475da453a3770ff15780f9.zip
opensim-SC_OLD-08a1fa3f96eee5e067475da453a3770ff15780f9.tar.gz
opensim-SC_OLD-08a1fa3f96eee5e067475da453a3770ff15780f9.tar.bz2
opensim-SC_OLD-08a1fa3f96eee5e067475da453a3770ff15780f9.tar.xz
* Introduced ClientManager for great justice.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs84
1 files changed, 43 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 6dc9968..bb19996 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -139,48 +139,50 @@ namespace OpenSim.Region.Environment.Scenes
139 { 139 {
140 // Console.WriteLine("Chat message"); 140 // Console.WriteLine("Chat message");
141 ScenePresence avatar = null; 141 ScenePresence avatar = null;
142 foreach (IClientAPI client in m_clientThreads.Values)
143 {
144 int dis = -1000;
145 if (this.Avatars.ContainsKey(client.AgentId))
146 {
147
148 avatar = this.Avatars[client.AgentId];
149 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
150 dis= (int)avatar.Pos.GetDistanceTo(fromPos);
151 //Console.WriteLine("found avatar at " +dis);
152
153 }
154
155 switch (type)
156 {
157 case 0: // Whisper
158 if ((dis < 10) && (dis > -10))
159 {
160 //should change so the message is sent through the avatar rather than direct to the ClientView
161 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
162 }
163 break;
164 case 1: // Say
165 if ((dis < 30) && (dis > -30))
166 {
167 Console.WriteLine("sending chat");
168 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
169 }
170 break;
171 case 2: // Shout
172 if ((dis < 100) && (dis > -100))
173 {
174 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
175 }
176 break;
177 142
178 case 0xff: // Broadcast 143 m_clientThreads.ForEachClient(delegate(IClientAPI client)
179 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); 144 {
180 break; 145 int dis = -1000;
181 } 146 if (this.Avatars.ContainsKey(client.AgentId))
182 147 {
183 } 148 avatar = this.Avatars[client.AgentId];
149 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
150 dis = (int) avatar.Pos.GetDistanceTo(fromPos);
151 //Console.WriteLine("found avatar at " +dis);
152 }
153
154 switch (type)
155 {
156 case 0: // Whisper
157 if ((dis < 10) && (dis > -10))
158 {
159 //should change so the message is sent through the avatar rather than direct to the ClientView
160 client.SendChatMessage(message, type, fromPos, fromName,
161 fromAgentID);
162 }
163 break;
164 case 1: // Say
165 if ((dis < 30) && (dis > -30))
166 {
167 Console.WriteLine("sending chat");
168 client.SendChatMessage(message, type, fromPos, fromName,
169 fromAgentID);
170 }
171 break;
172 case 2: // Shout
173 if ((dis < 100) && (dis > -100))
174 {
175 client.SendChatMessage(message, type, fromPos, fromName,
176 fromAgentID);
177 }
178 break;
179
180 case 0xff: // Broadcast
181 client.SendChatMessage(message, type, fromPos, fromName,
182 fromAgentID);
183 break;
184 }
185 });
184 } 186 }
185 187
186 /// <summary> 188 /// <summary>