diff options
author | UbitUmarov | 2016-10-08 01:27:02 +0100 |
---|---|---|
committer | UbitUmarov | 2016-10-08 01:27:02 +0100 |
commit | 9843e3776ed4a613fb5682112e9e6b618cb14f9f (patch) | |
tree | e6198111f4a331e331643ef00ddc29cc007d9af0 /OpenSim/Region/ScriptEngine/Shared | |
parent | recover regions main http server ssl suport. Using a PKCS12 cert file, and no... (diff) | |
parent | remove attachment to event OnPreAgentUpdate that is doing nothing (diff) | |
download | opensim-SC-9843e3776ed4a613fb5682112e9e6b618cb14f9f.zip opensim-SC-9843e3776ed4a613fb5682112e9e6b618cb14f9f.tar.gz opensim-SC-9843e3776ed4a613fb5682112e9e6b618cb14f9f.tar.bz2 opensim-SC-9843e3776ed4a613fb5682112e9e6b618cb14f9f.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 167 |
1 files changed, 72 insertions, 95 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..57bff6e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2664,13 +2664,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2664 | private LSL_Key NpcCreate( | 2664 | private LSL_Key NpcCreate( |
2665 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent, bool hostGroupID) | 2665 | string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent, bool hostGroupID) |
2666 | { | 2666 | { |
2667 | |||
2668 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) | 2667 | if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) |
2668 | { | ||
2669 | OSSLError("no permission to rez NPC at requested location"); | ||
2669 | return new LSL_Key(UUID.Zero.ToString()); | 2670 | return new LSL_Key(UUID.Zero.ToString()); |
2671 | } | ||
2670 | 2672 | ||
2671 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2673 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
2672 | if(module == null) | 2674 | if(module == null) |
2673 | new LSL_Key(UUID.Zero.ToString()); | 2675 | { |
2676 | OSSLError("NPC module not enabled"); | ||
2677 | return new LSL_Key(UUID.Zero.ToString()); | ||
2678 | } | ||
2674 | 2679 | ||
2675 | string groupTitle = String.Empty; | 2680 | string groupTitle = String.Empty; |
2676 | UUID groupID = UUID.Zero; | 2681 | UUID groupID = UUID.Zero; |
@@ -3878,11 +3883,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3878 | m_host.AddScriptLPS(1); | 3883 | m_host.AddScriptLPS(1); |
3879 | 3884 | ||
3880 | UUID targetUUID; | 3885 | UUID targetUUID; |
3886 | if(!UUID.TryParse(avatar.ToString(), out targetUUID)) | ||
3887 | return; | ||
3888 | |||
3889 | if(targetUUID == UUID.Zero) | ||
3890 | return; | ||
3891 | |||
3881 | ScenePresence target; | 3892 | ScenePresence target; |
3893 | if(!World.TryGetScenePresence(targetUUID, out target)) | ||
3894 | return; | ||
3882 | 3895 | ||
3883 | if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) | 3896 | if(target.IsDeleted || target.IsInTransit) |
3897 | return; | ||
3898 | |||
3899 | List<int> aps = new List<int>(); | ||
3900 | if(attachmentPoints.Length != 0) | ||
3884 | { | 3901 | { |
3885 | List<int> aps = new List<int>(); | ||
3886 | foreach (object point in attachmentPoints.Data) | 3902 | foreach (object point in attachmentPoints.Data) |
3887 | { | 3903 | { |
3888 | int ipoint; | 3904 | int ipoint; |
@@ -3891,115 +3907,76 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3891 | aps.Add(ipoint); | 3907 | aps.Add(ipoint); |
3892 | } | 3908 | } |
3893 | } | 3909 | } |
3910 | // parsing failed | ||
3911 | if(aps.Count != attachmentPoints.Length) | ||
3912 | return; | ||
3913 | } | ||
3894 | 3914 | ||
3895 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); | 3915 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(); |
3896 | 3916 | ||
3897 | bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); | 3917 | bool msgAll; |
3898 | bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; | 3918 | bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; |
3899 | 3919 | ||
3900 | if (msgAll && invertPoints) | 3920 | if(aps.Count == 0) |
3901 | { | 3921 | { |
3902 | return; | 3922 | if(!invertPoints) |
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 | |||
3919 | // if we have no attachments at this point, exit now | ||
3920 | if (attachments.Count == 0) | ||
3921 | { | ||
3922 | return; | 3923 | return; |
3923 | } | 3924 | msgAll = true; |
3925 | invertPoints = false; | ||
3926 | } | ||
3927 | else | ||
3928 | msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); | ||
3924 | 3929 | ||
3925 | List<SceneObjectGroup> ignoreThese = new List<SceneObjectGroup>(); | 3930 | if (msgAll && invertPoints) |
3931 | return; | ||
3926 | 3932 | ||
3927 | if (invertPoints) | 3933 | if (msgAll || invertPoints) |
3934 | { | ||
3935 | attachments = target.GetAttachments(); | ||
3936 | } | ||
3937 | else | ||
3938 | { | ||
3939 | foreach (int point in aps) | ||
3928 | { | 3940 | { |
3929 | foreach (SceneObjectGroup attachment in attachments) | 3941 | if (point > 0) |
3930 | { | 3942 | { |
3931 | if (aps.Contains((int)attachment.AttachmentPoint)) | 3943 | attachments.AddRange(target.GetAttachments((uint)point)); |
3932 | { | ||
3933 | ignoreThese.Add(attachment); | ||
3934 | } | ||
3935 | } | 3944 | } |
3936 | } | 3945 | } |
3946 | } | ||
3937 | 3947 | ||
3938 | foreach (SceneObjectGroup attachment in ignoreThese) | 3948 | // if we have no attachments at this point, exit now |
3939 | { | 3949 | if (attachments.Count == 0) |
3940 | attachments.Remove(attachment); | 3950 | { |
3941 | } | 3951 | return; |
3942 | ignoreThese.Clear(); | 3952 | } |
3943 | |||
3944 | // if inverting removed all attachments to check, exit now | ||
3945 | if (attachments.Count < 1) | ||
3946 | { | ||
3947 | return; | ||
3948 | } | ||
3949 | 3953 | ||
3950 | if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0) | 3954 | bool optionObjCreator = (options & |
3951 | { | 3955 | ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0; |
3952 | foreach (SceneObjectGroup attachment in attachments) | 3956 | bool optionScriptCreator = (options & |
3953 | { | 3957 | ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0; |
3954 | if (attachment.RootPart.CreatorID != m_host.CreatorID) | ||
3955 | { | ||
3956 | ignoreThese.Add(attachment); | ||
3957 | } | ||
3958 | } | ||
3959 | 3958 | ||
3960 | foreach (SceneObjectGroup attachment in ignoreThese) | 3959 | UUID hostCreatorID = m_host.CreatorID; |
3961 | { | 3960 | UUID itemCreatorID = m_item.CreatorID; |
3962 | attachments.Remove(attachment); | ||
3963 | } | ||
3964 | ignoreThese.Clear(); | ||
3965 | 3961 | ||
3966 | // if filtering by same object creator removed all | 3962 | foreach (SceneObjectGroup sog in attachments) |
3967 | // attachments to check, exit now | 3963 | { |
3968 | if (attachments.Count == 0) | 3964 | if(sog.IsDeleted || sog.inTransit) |
3969 | { | 3965 | continue; |
3970 | return; | ||
3971 | } | ||
3972 | } | ||
3973 | 3966 | ||
3974 | if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0) | 3967 | if (invertPoints && aps.Contains((int)sog.AttachmentPoint)) |
3975 | { | 3968 | continue; |
3976 | foreach (SceneObjectGroup attachment in attachments) | ||
3977 | { | ||
3978 | if (attachment.RootPart.CreatorID != m_item.CreatorID) | ||
3979 | { | ||
3980 | ignoreThese.Add(attachment); | ||
3981 | } | ||
3982 | } | ||
3983 | 3969 | ||
3984 | foreach (SceneObjectGroup attachment in ignoreThese) | 3970 | UUID CreatorID = sog.RootPart.CreatorID; |
3985 | { | 3971 | if (optionObjCreator && CreatorID != hostCreatorID) |
3986 | attachments.Remove(attachment); | 3972 | continue; |
3987 | } | ||
3988 | ignoreThese.Clear(); | ||
3989 | 3973 | ||
3990 | // if filtering by object creator must match originating | 3974 | if (optionScriptCreator && CreatorID != itemCreatorID) |
3991 | // script creator removed all attachments to check, | 3975 | continue; |
3992 | // exit now | ||
3993 | if (attachments.Count == 0) | ||
3994 | { | ||
3995 | return; | ||
3996 | } | ||
3997 | } | ||
3998 | 3976 | ||
3999 | foreach (SceneObjectGroup attachment in attachments) | 3977 | SceneObjectPart[] parts = sog.Parts; |
4000 | { | 3978 | foreach(SceneObjectPart p in parts) |
4001 | MessageObject(attachment.RootPart.UUID, message); | 3979 | MessageObject(p.UUID, message); |
4002 | } | ||
4003 | } | 3980 | } |
4004 | } | 3981 | } |
4005 | 3982 | ||