aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorUbitUmarov2016-09-22 17:05:05 +0100
committerUbitUmarov2016-09-22 17:05:05 +0100
commit94e983c95f2cb0d0366a856047c1b0dcab3b25ee (patch)
treebf4f54a52c4c4a98738f414d8fee6c4964c423cd /OpenSim/Region/ScriptEngine
parentmantis 8027: allow messages to be sent to attachments child prims in llRegion... (diff)
downloadopensim-SC_OLD-94e983c95f2cb0d0366a856047c1b0dcab3b25ee.zip
opensim-SC_OLD-94e983c95f2cb0d0366a856047c1b0dcab3b25ee.tar.gz
opensim-SC_OLD-94e983c95f2cb0d0366a856047c1b0dcab3b25ee.tar.bz2
opensim-SC_OLD-94e983c95f2cb0d0366a856047c1b0dcab3b25ee.tar.xz
mantis 8027: let osMessageAttachments also send to attachments child prims.. also changed its code structure and could not test
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs158
1 files changed, 65 insertions, 93 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4af4339..abb7d70 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3878,11 +3878,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3878 m_host.AddScriptLPS(1); 3878 m_host.AddScriptLPS(1);
3879 3879
3880 UUID targetUUID; 3880 UUID targetUUID;
3881 if(!UUID.TryParse(avatar.ToString(), out targetUUID))
3882 return;
3883
3884 if(targetUUID == UUID.Zero)
3885 return;
3886
3881 ScenePresence target; 3887 ScenePresence target;
3888 if(!World.TryGetScenePresence(targetUUID, out target))
3889 return;
3882 3890
3883 if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) 3891 if(target.IsDeleted || target.IsInTransit)
3892 return;
3893
3894 List<int> aps = new List<int>();
3895 if(attachmentPoints.Length != 0)
3884 { 3896 {
3885 List<int> aps = new List<int>();
3886 foreach (object point in attachmentPoints.Data) 3897 foreach (object point in attachmentPoints.Data)
3887 { 3898 {
3888 int ipoint; 3899 int ipoint;
@@ -3891,115 +3902,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3891 aps.Add(ipoint); 3902 aps.Add(ipoint);
3892 } 3903 }
3893 } 3904 }
3905 // parsing failed
3906 if(aps.Count != attachmentPoints.Length)
3907 return;
3908 }
3894 3909
3895 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); 3910 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>();
3896
3897 bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
3898 bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
3899 3911
3900 if (msgAll && invertPoints) 3912 bool msgAll;
3901 { 3913 bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0;
3902 return;
3903 }
3904 else if (msgAll || invertPoints)
3905 {
3906 attachments = target.GetAttachments();
3907 }
3908 else
3909 {
3910 foreach (int point in aps)
3911 {
3912 if (point > 0)
3913 {
3914 attachments.AddRange(target.GetAttachments((uint)point));
3915 }
3916 }
3917 }
3918 3914
3919 // if we have no attachments at this point, exit now 3915 if(aps.Count == 0)
3920 if (attachments.Count == 0) 3916 {
3921 { 3917 if(!invertPoints)
3922 return; 3918 return;
3923 } 3919 msgAll = true;
3920 invertPoints = false;
3921 }
3922 else
3923 msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL);
3924 3924
3925 List<SceneObjectGroup> ignoreThese = new List<SceneObjectGroup>(); 3925 if (msgAll && invertPoints)
3926 return;
3926 3927
3927 if (invertPoints) 3928 if (msgAll || invertPoints)
3929 {
3930 attachments = target.GetAttachments();
3931 }
3932 else
3933 {
3934 foreach (int point in aps)
3928 { 3935 {
3929 foreach (SceneObjectGroup attachment in attachments) 3936 if (point > 0)
3930 { 3937 {
3931 if (aps.Contains((int)attachment.AttachmentPoint)) 3938 attachments.AddRange(target.GetAttachments((uint)point));
3932 {
3933 ignoreThese.Add(attachment);
3934 }
3935 } 3939 }
3936 } 3940 }
3941 }
3937 3942
3938 foreach (SceneObjectGroup attachment in ignoreThese) 3943 // if we have no attachments at this point, exit now
3939 { 3944 if (attachments.Count == 0)
3940 attachments.Remove(attachment); 3945 {
3941 } 3946 return;
3942 ignoreThese.Clear(); 3947 }
3943
3944 // if inverting removed all attachments to check, exit now
3945 if (attachments.Count < 1)
3946 {
3947 return;
3948 }
3949 3948
3950 if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0) 3949 bool optionObjCreator = (options &
3951 { 3950 ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0;
3952 foreach (SceneObjectGroup attachment in attachments) 3951 bool optionScriptCreator = (options &
3953 { 3952 ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0;
3954 if (attachment.RootPart.CreatorID != m_host.CreatorID)
3955 {
3956 ignoreThese.Add(attachment);
3957 }
3958 }
3959 3953
3960 foreach (SceneObjectGroup attachment in ignoreThese) 3954 UUID hostCreatorID = m_host.CreatorID;
3961 { 3955 UUID itemCreatorID = m_item.CreatorID;
3962 attachments.Remove(attachment);
3963 }
3964 ignoreThese.Clear();
3965 3956
3966 // if filtering by same object creator removed all 3957 foreach (SceneObjectGroup sog in attachments)
3967 // attachments to check, exit now 3958 {
3968 if (attachments.Count == 0) 3959 if(sog.IsDeleted || sog.inTransit)
3969 { 3960 continue;
3970 return;
3971 }
3972 }
3973 3961
3974 if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0) 3962 if (invertPoints && aps.Contains((int)sog.AttachmentPoint))
3975 { 3963 continue;
3976 foreach (SceneObjectGroup attachment in attachments)
3977 {
3978 if (attachment.RootPart.CreatorID != m_item.CreatorID)
3979 {
3980 ignoreThese.Add(attachment);
3981 }
3982 }
3983 3964
3984 foreach (SceneObjectGroup attachment in ignoreThese) 3965 UUID CreatorID = sog.RootPart.CreatorID;
3985 { 3966 if (optionObjCreator && CreatorID != hostCreatorID)
3986 attachments.Remove(attachment); 3967 continue;
3987 }
3988 ignoreThese.Clear();
3989 3968
3990 // if filtering by object creator must match originating 3969 if (optionScriptCreator && CreatorID != itemCreatorID)
3991 // script creator removed all attachments to check, 3970 continue;
3992 // exit now
3993 if (attachments.Count == 0)
3994 {
3995 return;
3996 }
3997 }
3998 3971
3999 foreach (SceneObjectGroup attachment in attachments) 3972 SceneObjectPart[] parts = sog.Parts;
4000 { 3973 foreach(SceneObjectPart p in parts)
4001 MessageObject(attachment.RootPart.UUID, message); 3974 MessageObject(p.UUID, message);
4002 }
4003 } 3975 }
4004 } 3976 }
4005 3977