Attempt to enable chat, but seems to be a problem with the distances

merge
MW 2007-05-30 21:05:35 +00:00
parent 1aab2d7427
commit 0274b19cad
3 changed files with 14 additions and 3 deletions

View File

@ -136,7 +136,6 @@ namespace OpenSim.world
//really really should be moved somewhere else (RegionInfo.cs ?)
public void SendRegionHandshake()
{
Console.WriteLine("sending handshake");
this.ControllingClient.SendRegionHandshake(this.regionData);
}

View File

@ -33,10 +33,20 @@ namespace OpenSim.world
public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
Console.WriteLine("chat message");
Avatar avatar = null;
foreach (IClientAPI client in m_clientThreads.Values)
{
// int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos);
int dis = -1000;
if (this.Avatars.ContainsKey(client.AgentId))
{
avatar = this.Avatars[client.AgentId];
// int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
dis= (int)avatar.Pos.GetDistanceTo(fromPos);
Console.WriteLine("found avatar at " +dis);
}
switch (type)
{
@ -50,6 +60,7 @@ namespace OpenSim.world
case 1: // Say
if ((dis < 30) && (dis > -30))
{
Console.WriteLine("sending chat");
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
}
break;

View File

@ -505,6 +505,7 @@ namespace OpenSim.world
{
remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
Avatar newAvatar = null;
try