filter local chat from avatars or attachment acording to parcel hide (

not fully tested)
avinationmerge
UbitUmarov 2014-08-01 01:43:12 +01:00
parent 0a1e9d731d
commit e5f9f064a7
1 changed files with 34 additions and 3 deletions

View File

@ -216,6 +216,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
bool checkParcelHide = false;
UUID sourceParcelID = UUID.Zero;
Vector3 hidePos = fromPos;
if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
switch (sourceType) switch (sourceType)
@ -237,15 +241,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
} }
destination = UUID.Zero; // Avatars cant "SayTo" destination = UUID.Zero; // Avatars cant "SayTo"
ownerID = c.Sender.AgentId; ownerID = c.Sender.AgentId;
checkParcelHide = true;
hidePos = fromPos;
break; break;
case ChatSourceType.Object: case ChatSourceType.Object:
fromID = c.SenderUUID; fromID = c.SenderUUID;
if (c.SenderObject != null && c.SenderObject is SceneObjectPart) if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
{
ownerID = ((SceneObjectPart)c.SenderObject).OwnerID; ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
if (((SceneObjectPart)c.SenderObject).ParentGroup.IsAttachment)
{
checkParcelHide = true;
hidePos = ((SceneObjectPart)c.SenderObject).ParentGroup.AbsolutePosition;
}
}
break; break;
} }
@ -258,13 +269,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType); // fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType);
HashSet<UUID> receiverIDs = new HashSet<UUID>(); HashSet<UUID> receiverIDs = new HashSet<UUID>();
if (checkParcelHide)
{
checkParcelHide = false;
if (c.Type < ChatTypeEnum.DebugChannel && destination == UUID.Zero)
{
ILandObject srcland = (scene as Scene).LandChannel.GetLandObject(hidePos.X, hidePos.Y);
if (srcland != null && !srcland.LandData.SeeAVs)
{
sourceParcelID = srcland.LandData.GlobalID;
checkParcelHide = true;
}
}
}
foreach (Scene s in m_scenes) foreach (Scene s in m_scenes)
{ {
// This should use ForEachClient, but clients don't have a position. // This should use ForEachClient, but clients don't have a position.
// If camera is moved into client, then camera position can be used // If camera is moved into client, then camera position can be used
// MT: No, it can't, as chat is heard from the avatar position, not // MT: No, it can't, as chat is heard from the avatar position, not
// the camera position. // the camera position.
s.ForEachScenePresence( s.ForEachScenePresence(
delegate(ScenePresence presence) delegate(ScenePresence presence)
{ {
@ -277,6 +303,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
// perfect, but it will do. For now. Better // perfect, but it will do. For now. Better
// than the prior behavior of muting all // than the prior behavior of muting all
// objects on a parcel with access restrictions // objects on a parcel with access restrictions
if (checkParcelHide)
{
if (sourceParcelID != Presencecheck.LandData.GlobalID)
return;
}
if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
{ {
if (destination != UUID.Zero) if (destination != UUID.Zero)