aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs91
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs20
4 files changed, 144 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 52d96bc..7fa6f05 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4006,7 +4006,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4006 { 4006 {
4007 m_host.AddScriptLPS(1); 4007 m_host.AddScriptLPS(1);
4008 Vector3 av3 = Util.Clip(color, 0.0f, 1.0f); 4008 Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
4009 m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); 4009 if (text.Length > 254)
4010 text = text.Remove(254);
4011
4012 byte[] data;
4013 do
4014 {
4015 data = Util.UTF8.GetBytes(text);
4016 if (data.Length > 254)
4017 text = text.Substring(0, text.Length - 1);
4018 } while (data.Length > 254);
4019
4020 m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
4010 //m_host.ParentGroup.HasGroupChanged = true; 4021 //m_host.ParentGroup.HasGroupChanged = true;
4011 //m_host.ParentGroup.ScheduleGroupForFullUpdate(); 4022 //m_host.ParentGroup.ScheduleGroupForFullUpdate();
4012 } 4023 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8b73cd9..31be450 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,6 +3549,91 @@ 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 } 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)
3557 {
3558 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
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 }
3581
3582 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3583 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
3584
3585 if (attachmentsModule != null && sp != null)
3586 {
3587 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId);
3588 }
3589 }
3590
3591 protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot)
3592 {
3593 if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
3594 {
3595 return;
3596 }
3597
3598 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3599 ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
3600
3601 if (attachmentsModule != null && sp != null)
3602 {
3603 attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, pos, rot);
3604 }
3605 }
3606
3607 public void osDropAttachment()
3608 {
3609 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
3610 m_host.AddScriptLPS(1);
3611
3612 DropAttachment(true);
3613 }
3614
3615 public void osForceDropAttachment()
3616 {
3617 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachment");
3618 m_host.AddScriptLPS(1);
3619
3620 DropAttachment(false);
3621 }
3622
3623 public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
3624 {
3625 CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachmentAt");
3626 m_host.AddScriptLPS(1);
3627
3628 DropAttachmentAt(true, pos, rot);
3629 }
3630
3631 public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
3632 {
3633 CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt");
3634 m_host.AddScriptLPS(1);
3635
3636 DropAttachmentAt(false, pos, rot);
3637 }
3638 }
3554} \ No newline at end of file 3639} \ 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 3985e66..93188c9 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}