mantis 8027: let osMessageAttachments also send to attachments child prims.. also changed its code structure and could not test
parent
bbe8ef0528
commit
94e983c95f
|
@ -3878,11 +3878,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
UUID targetUUID;
|
UUID targetUUID;
|
||||||
|
if(!UUID.TryParse(avatar.ToString(), out targetUUID))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(targetUUID == UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
ScenePresence target;
|
ScenePresence target;
|
||||||
|
if(!World.TryGetScenePresence(targetUUID, out target))
|
||||||
|
return;
|
||||||
|
|
||||||
if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target))
|
if(target.IsDeleted || target.IsInTransit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<int> aps = new List<int>();
|
||||||
|
if(attachmentPoints.Length != 0)
|
||||||
{
|
{
|
||||||
List<int> aps = new List<int>();
|
|
||||||
foreach (object point in attachmentPoints.Data)
|
foreach (object point in attachmentPoints.Data)
|
||||||
{
|
{
|
||||||
int ipoint;
|
int ipoint;
|
||||||
|
@ -3891,115 +3902,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
aps.Add(ipoint);
|
aps.Add(ipoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// parsing failed
|
||||||
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
|
if(aps.Count != attachmentPoints.Length)
|
||||||
|
|
||||||
bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
|
|
||||||
bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
|
|
||||||
|
|
||||||
if (msgAll && invertPoints)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (msgAll || invertPoints)
|
|
||||||
{
|
|
||||||
attachments = target.GetAttachments();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (int point in aps)
|
|
||||||
{
|
|
||||||
if (point > 0)
|
|
||||||
{
|
|
||||||
attachments.AddRange(target.GetAttachments((uint)point));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we have no attachments at this point, exit now
|
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
|
||||||
if (attachments.Count == 0)
|
|
||||||
{
|
bool msgAll;
|
||||||
|
bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
|
||||||
|
|
||||||
|
if(aps.Count == 0)
|
||||||
|
{
|
||||||
|
if(!invertPoints)
|
||||||
return;
|
return;
|
||||||
}
|
msgAll = true;
|
||||||
|
invertPoints = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
|
||||||
|
|
||||||
List<SceneObjectGroup> ignoreThese = new List<SceneObjectGroup>();
|
if (msgAll && invertPoints)
|
||||||
|
return;
|
||||||
|
|
||||||
if (invertPoints)
|
if (msgAll || invertPoints)
|
||||||
|
{
|
||||||
|
attachments = target.GetAttachments();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (int point in aps)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup attachment in attachments)
|
if (point > 0)
|
||||||
{
|
{
|
||||||
if (aps.Contains((int)attachment.AttachmentPoint))
|
attachments.AddRange(target.GetAttachments((uint)point));
|
||||||
{
|
|
||||||
ignoreThese.Add(attachment);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (SceneObjectGroup attachment in ignoreThese)
|
// if we have no attachments at this point, exit now
|
||||||
{
|
if (attachments.Count == 0)
|
||||||
attachments.Remove(attachment);
|
{
|
||||||
}
|
return;
|
||||||
ignoreThese.Clear();
|
}
|
||||||
|
|
||||||
// if inverting removed all attachments to check, exit now
|
bool optionObjCreator = (options &
|
||||||
if (attachments.Count < 1)
|
ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0;
|
||||||
{
|
bool optionScriptCreator = (options &
|
||||||
return;
|
ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0;
|
||||||
}
|
|
||||||
|
|
||||||
if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0)
|
UUID hostCreatorID = m_host.CreatorID;
|
||||||
{
|
UUID itemCreatorID = m_item.CreatorID;
|
||||||
foreach (SceneObjectGroup attachment in attachments)
|
|
||||||
{
|
|
||||||
if (attachment.RootPart.CreatorID != m_host.CreatorID)
|
|
||||||
{
|
|
||||||
ignoreThese.Add(attachment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SceneObjectGroup attachment in ignoreThese)
|
foreach (SceneObjectGroup sog in attachments)
|
||||||
{
|
{
|
||||||
attachments.Remove(attachment);
|
if(sog.IsDeleted || sog.inTransit)
|
||||||
}
|
continue;
|
||||||
ignoreThese.Clear();
|
|
||||||
|
|
||||||
// if filtering by same object creator removed all
|
if (invertPoints && aps.Contains((int)sog.AttachmentPoint))
|
||||||
// attachments to check, exit now
|
continue;
|
||||||
if (attachments.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0)
|
UUID CreatorID = sog.RootPart.CreatorID;
|
||||||
{
|
if (optionObjCreator && CreatorID != hostCreatorID)
|
||||||
foreach (SceneObjectGroup attachment in attachments)
|
continue;
|
||||||
{
|
|
||||||
if (attachment.RootPart.CreatorID != m_item.CreatorID)
|
|
||||||
{
|
|
||||||
ignoreThese.Add(attachment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SceneObjectGroup attachment in ignoreThese)
|
if (optionScriptCreator && CreatorID != itemCreatorID)
|
||||||
{
|
continue;
|
||||||
attachments.Remove(attachment);
|
|
||||||
}
|
|
||||||
ignoreThese.Clear();
|
|
||||||
|
|
||||||
// if filtering by object creator must match originating
|
SceneObjectPart[] parts = sog.Parts;
|
||||||
// script creator removed all attachments to check,
|
foreach(SceneObjectPart p in parts)
|
||||||
// exit now
|
MessageObject(p.UUID, message);
|
||||||
if (attachments.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SceneObjectGroup attachment in attachments)
|
|
||||||
{
|
|
||||||
MessageObject(attachment.RootPart.UUID, message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue