* Updated Voice Chat Server, added support for voice to cross region boundaries providing they are all located on the same simulator.

0.6.0-stable
Adam Frisby 2008-02-26 11:17:52 +00:00
parent 577cc7358a
commit e7b785f9a0
1 changed files with 7 additions and 6 deletions

View File

@ -306,22 +306,23 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat
} }
} }
public ScenePresence getScenePresence(LLUUID clientID) public LLVector3 getScenePresencePosition(LLUUID clientID)
{ {
foreach (Scene scene in m_scenes) foreach (Scene scene in m_scenes)
{ {
ScenePresence x; ScenePresence x;
if ((x = scene.GetScenePresence(clientID)) != null) if ((x = scene.GetScenePresence(clientID)) != null)
{ {
return x; return x.AbsolutePosition + new LLVector3(Constants.RegionSize * scene.RegionInfo.RegionLocX,
Constants.RegionSize * scene.RegionInfo.RegionLocY, 0);
} }
} }
return null; return LLVector3.Zero;
} }
public void BroadcastVoice(VoicePacket packet) public void BroadcastVoice(VoicePacket packet)
{ {
libsecondlife.LLVector3 origPos = getScenePresence(packet.m_clientId).AbsolutePosition; libsecondlife.LLVector3 origPos = getScenePresencePosition(packet.m_clientId);
byte[] bytes = packet.GetBytes(); byte[] bytes = packet.GetBytes();
foreach (VoiceClient client in m_clients.Values) foreach (VoiceClient client in m_clients.Values)
@ -329,9 +330,9 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat
if (client.IsEnabled() && client.m_clientId != packet.m_clientId && if (client.IsEnabled() && client.m_clientId != packet.m_clientId &&
client.m_authenticated && client.IsCodecSupported(packet.m_codec)) client.m_authenticated && client.IsCodecSupported(packet.m_codec))
{ {
ScenePresence presence = getScenePresence(client.m_clientId); LLVector3 presenceLoc = getScenePresencePosition(client.m_clientId);
if (presence != null && Util.GetDistanceTo(presence.AbsolutePosition, origPos) < 20) if (presenceLoc != LLVector3.Zero && Util.GetDistanceTo(presenceLoc, origPos) < 20)
{ {
client.SendTo(bytes); client.SendTo(bytes);
} }