diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 91 |
2 files changed, 100 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 |