aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.World/World.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.World/World.PacketHandlers.cs')
-rw-r--r--OpenSim/OpenSim.World/World.PacketHandlers.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs
index 3357536..9908525 100644
--- a/OpenSim/OpenSim.World/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.World/World.PacketHandlers.cs
@@ -33,11 +33,21 @@ namespace OpenSim.world
33 33
34 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 34 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
35 { 35 {
36 Console.WriteLine("chat message");
37 Avatar avatar = null;
36 foreach (IClientAPI client in m_clientThreads.Values) 38 foreach (IClientAPI client in m_clientThreads.Values)
37 { 39 {
38 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); 40 int dis = -1000;
39 int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); 41 if (this.Avatars.ContainsKey(client.AgentId))
42 {
43
44 avatar = this.Avatars[client.AgentId];
45 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
46 dis= (int)avatar.Pos.GetDistanceTo(fromPos);
47 Console.WriteLine("found avatar at " +dis);
40 48
49 }
50
41 switch (type) 51 switch (type)
42 { 52 {
43 case 0: // Whisper 53 case 0: // Whisper
@@ -50,6 +60,7 @@ namespace OpenSim.world
50 case 1: // Say 60 case 1: // Say
51 if ((dis < 30) && (dis > -30)) 61 if ((dis < 30) && (dis > -30))
52 { 62 {
63 Console.WriteLine("sending chat");
53 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); 64 client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
54 } 65 }
55 break; 66 break;