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.cs70
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
3 files changed, 86 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 02b97e8..d0db15f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3538,7 +3538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3538 3538
3539 return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); 3539 return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
3540 } 3540 }
3541 3541
3542 /// <summary> 3542 /// <summary>
3543 /// Sets the response type for an HTTP request/response 3543 /// Sets the response type for an HTTP request/response
3544 /// </summary> 3544 /// </summary>
@@ -3549,11 +3549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3549 if (m_UrlModule != null) 3549 if (m_UrlModule != null)
3550 m_UrlModule.HttpContentType(new UUID(id),type); 3550 m_UrlModule.HttpContentType(new UUID(id),type);
3551 } 3551 }
3552 3552 /// Shout an error if the object owner did not grant the script the specified permissions.
3553 public void osDropAttachment() 3553 /// </summary>
3554 /// <param name="perms"></param>
3555 /// <returns>boolean indicating whether an error was shouted.</returns>
3556 protected bool ShoutErrorOnLackingOwnerPerms(int perms, string errorPrefix)
3554 { 3557 {
3555 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment"); 3558 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
3556 m_host.AddScriptLPS(1); 3559 m_host.AddScriptLPS(1);
3560 bool fail = false;
3561 if (m_item.PermsGranter != m_host.OwnerID)
3562 {
3563 fail = true;
3564 OSSLShoutError(string.Format("{0}. Permissions not granted to owner.", errorPrefix));
3565 }
3566 else if ((m_item.PermsMask & perms) == 0)
3567 {
3568 fail = true;
3569 OSSLShoutError(string.Format("{0}. Permissions not granted.", errorPrefix));
3570 }
3571
3572 return fail;
3573 }
3574
3575 protected void DropAttachment(bool checkPerms)
3576 {
3577 if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
3578 {
3579 return;
3580 }
3557 3581
3558 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3582 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3559 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); 3583 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
@@ -3564,10 +3588,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3564 } 3588 }
3565 } 3589 }
3566 3590
3567 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot) 3591 protected void DropAttachemntAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot)
3568 { 3592 {
3569 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt"); 3593 if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
3570 m_host.AddScriptLPS(1); 3594 {
3595 return;
3596 }
3571 3597
3572 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3598 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3573 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID); 3599 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
@@ -3579,5 +3605,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3579 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot); 3605 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot);
3580 } 3606 }
3581 } 3607 }
3608
3609 public void osDropAttachment()
3610 {
3611 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
3612 m_host.AddScriptLPS(1);
3613
3614 DropAttachment(true);
3615 }
3616
3617 public void osForceDropAttachment()
3618 {
3619 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment");
3620 m_host.AddScriptLPS(1);
3621
3622 DropAttachment(false);
3623 }
3624
3625 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
3626 {
3627 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt");
3628 m_host.AddScriptLPS(1);
3629
3630 DropAttachemntAt(true, pos, rot);
3631 }
3632
3633 public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
3634 {
3635 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt");
3636 m_host.AddScriptLPS(1);
3637
3638 DropAttachemntAt(false, pos, rot);
3639 }
3582 } 3640 }
3583} \ No newline at end of file 3641} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index e28473d..93188c9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -401,10 +401,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
401 void osDropAttachment(); 401 void osDropAttachment();
402 402
403 /// <summary> 403 /// <summary>
404 /// Attempts to drop an attachment to the ground while bypassing the script permissions
405 /// </summary>
406 void osForceDropAttachment();
407
408 /// <summary>
404 /// Attempts to drop an attachment at the specified coordinates. 409 /// Attempts to drop an attachment at the specified coordinates.
405 /// </summary> 410 /// </summary>
406 /// <param name="pos"></param> 411 /// <param name="pos"></param>
407 /// <param name="rot"></param> 412 /// <param name="rot"></param>
408 void osDropAttachmentAt(vector pos, rotation rot); 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);
409 } 421 }
410} 422}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index bae5594..dee1b28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -978,9 +978,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
978 m_OSSL_Functions.osDropAttachment(); 978 m_OSSL_Functions.osDropAttachment();
979 } 979 }
980 980
981 public void osForceDropAttachment()
982 {
983 m_OSSL_Functions.osForceDropAttachment();
984 }
985
981 public void osDropAttachmentAt(vector pos, rotation rot) 986 public void osDropAttachmentAt(vector pos, rotation rot)
982 { 987 {
983 m_OSSL_Functions.osDropAttachmentAt(pos, rot); 988 m_OSSL_Functions.osDropAttachmentAt(pos, rot);
984 } 989 }
990
991 public void osForceDropAttachmentAt(vector pos, rotation rot)
992 {
993 m_OSSL_Functions.osForceDropAttachmentAt(pos, rot);
994 }
985 } 995 }
986} 996}