Attempt to enable chat, but seems to be a problem with the distances
parent
1aab2d7427
commit
0274b19cad
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue