diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8ad1451..2c682d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3593,7 +3593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3593 | 3593 | ||
3594 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); | 3594 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); |
3595 | } | 3595 | } |
3596 | 3596 | ||
3597 | /// <summary> | 3597 | /// <summary> |
3598 | /// Sets the response type for an HTTP request/response | 3598 | /// Sets the response type for an HTTP request/response |
3599 | /// </summary> | 3599 | /// </summary> |
@@ -3604,5 +3604,92 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3604 | if (m_UrlModule != null) | 3604 | if (m_UrlModule != null) |
3605 | m_UrlModule.HttpContentType(new UUID(id),type); | 3605 | m_UrlModule.HttpContentType(new UUID(id),type); |
3606 | } | 3606 | } |
3607 | |||
3608 | /// Shout an error if the object owner did not grant the script the specified permissions. | ||
3609 | /// </summary> | ||
3610 | /// <param name="perms"></param> | ||
3611 | /// <returns>boolean indicating whether an error was shouted.</returns> | ||
3612 | protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix) | ||
3613 | { | ||
3614 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); | ||
3615 | m_host.AddScriptLPS(1); | ||
3616 | bool fail = false; | ||
3617 | if (m_item.PermsGranter != m_host.OwnerID) | ||
3618 | { | ||
3619 | fail = true; | ||
3620 | OSSLShoutError(string.Format("{0}. Permissions not granted to owner.", errorPrefix)); | ||
3621 | } | ||
3622 | else if ((m_item.PermsMask & perms) == 0) | ||
3623 | { | ||
3624 | fail = true; | ||
3625 | OSSLShoutError(string.Format("{0}. Permissions not granted.", errorPrefix)); | ||
3626 | } | ||
3627 | |||
3628 | return fail; | ||
3629 | } | ||
3630 | |||
3631 | protected void DropAttachment(bool checkPerms) | ||
3632 | { | ||
3633 | if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) | ||
3634 | { | ||
3635 | return; | ||
3636 | } | ||
3637 | |||
3638 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3639 | ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); | ||
3640 | |||
3641 | if (attachmentsModule != null && sp != null) | ||
3642 | { | ||
3643 | attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId); | ||
3644 | } | ||
3645 | } | ||
3646 | |||
3647 | protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot) | ||
3648 | { | ||
3649 | if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment")) | ||
3650 | { | ||
3651 | return; | ||
3652 | } | ||
3653 | |||
3654 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | ||
3655 | ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); | ||
3656 | |||
3657 | if (attachmentsModule != null && sp != null) | ||
3658 | { | ||
3659 | attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, pos, rot); | ||
3660 | } | ||
3661 | } | ||
3662 | |||
3663 | public void osDropAttachment() | ||
3664 | { | ||
3665 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); | ||
3666 | m_host.AddScriptLPS(1); | ||
3667 | |||
3668 | DropAttachment(true); | ||
3669 | } | ||
3670 | |||
3671 | public void osForceDropAttachment() | ||
3672 | { | ||
3673 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment"); | ||
3674 | m_host.AddScriptLPS(1); | ||
3675 | |||
3676 | DropAttachment(false); | ||
3677 | } | ||
3678 | |||
3679 | public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) | ||
3680 | { | ||
3681 | CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); | ||
3682 | m_host.AddScriptLPS(1); | ||
3683 | |||
3684 | DropAttachmentAt(true, pos, rot); | ||
3685 | } | ||
3686 | |||
3687 | public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) | ||
3688 | { | ||
3689 | CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt"); | ||
3690 | m_host.AddScriptLPS(1); | ||
3691 | |||
3692 | DropAttachmentAt(false, pos, rot); | ||
3693 | } | ||
3607 | } | 3694 | } |
3608 | } | 3695 | } |