aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs89
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs20
3 files changed, 132 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}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0ea363a..b1fbed5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -394,5 +394,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
394 /// </summary> 394 /// </summary>
395 /// <returns></returns> 395 /// <returns></returns>
396 void osSetContentType(LSL_Key id, string type); 396 void osSetContentType(LSL_Key id, string type);
397
398 /// <summary>
399 /// Attempts to drop an attachment to the ground
400 /// </summary>
401 void osDropAttachment();
402
403 /// <summary>
404 /// Attempts to drop an attachment to the ground while bypassing the script permissions
405 /// </summary>
406 void osForceDropAttachment();
407
408 /// <summary>
409 /// Attempts to drop an attachment at the specified coordinates.
410 /// </summary>
411 /// <param name="pos"></param>
412 /// <param name="rot"></param>
413 void osDropAttachmentAt(vector pos, rotation rot);
414
415 /// <summary>
416 /// Attempts to drop an attachment at the specified coordinates while bypassing the script permissions
417 /// </summary>
418 /// <param name="pos"></param>
419 /// <param name="rot"></param>
420 void osForceDropAttachmentAt(vector pos, rotation rot);
397 } 421 }
398} 422}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 52ca3da..dee1b28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -972,5 +972,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
972 { 972 {
973 m_OSSL_Functions.osSetContentType(id,type); 973 m_OSSL_Functions.osSetContentType(id,type);
974 } 974 }
975
976 public void osDropAttachment()
977 {
978 m_OSSL_Functions.osDropAttachment();
979 }
980
981 public void osForceDropAttachment()
982 {
983 m_OSSL_Functions.osForceDropAttachment();
984 }
985
986 public void osDropAttachmentAt(vector pos, rotation rot)
987 {
988 m_OSSL_Functions.osDropAttachmentAt(pos, rot);
989 }
990
991 public void osForceDropAttachmentAt(vector pos, rotation rot)
992 {
993 m_OSSL_Functions.osForceDropAttachmentAt(pos, rot);
994 }
975 } 995 }
976} 996}