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 ?)
|
//really really should be moved somewhere else (RegionInfo.cs ?)
|
||||||
public void SendRegionHandshake()
|
public void SendRegionHandshake()
|
||||||
{
|
{
|
||||||
Console.WriteLine("sending handshake");
|
|
||||||
this.ControllingClient.SendRegionHandshake(this.regionData);
|
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)
|
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)
|
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 = -1000;
|
||||||
int dis = 0; // (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos);
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +60,7 @@ namespace OpenSim.world
|
||||||
case 1: // Say
|
case 1: // Say
|
||||||
if ((dis < 30) && (dis > -30))
|
if ((dis < 30) && (dis > -30))
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("sending chat");
|
||||||
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
|
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -505,6 +505,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
|
remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
|
||||||
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
|
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
|
||||||
|
remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
|
||||||
|
|
||||||
Avatar newAvatar = null;
|
Avatar newAvatar = null;
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue