From 0611d3339bcba420b3f4fa811394ee2e4b0d3e89 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 20 Oct 2018 01:00:55 +0100 Subject: remove TempAttachments module --- .../Avatar/Attachments/TempAttachmentsModule.cs | 191 --------------------- .../Shared/Api/Implementation/LSL_Api.cs | 57 +++++- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 5 +- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 9 +- 4 files changed, 62 insertions(+), 200 deletions(-) delete mode 100644 OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs deleted file mode 100644 index c3f3851..0000000 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using log4net; -using Mono.Addins; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Console; -using OpenSim.Framework.Monitoring; -using OpenSim.Region.ClientStack.LindenUDP; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using PermissionMask = OpenSim.Framework.PermissionMask; - -namespace OpenSim.Region.OptionalModules.Avatar.Attachments -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")] - public class TempAttachmentsModule : INonSharedRegionModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Scene m_scene; - private IRegionConsole m_console; - - public void Initialise(IConfigSource configSource) - { - } - - public void AddRegion(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - } - - public void RegionLoaded(Scene scene) - { - m_scene = scene; - - IScriptModuleComms comms = scene.RequestModuleInterface(); - if (comms != null) - { - comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp"); - m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions"); - m_console = scene.RequestModuleInterface(); - - if (m_console != null) - { - m_console.AddCommand("TempAttachModule", false, "set auto_grant_attach_perms", "set auto_grant_attach_perms true|false", "Allow objects owned by the region owner or estate managers to obtain attach permissions without asking the user", SetAutoGrantAttachPerms); - } - } - else - { - m_log.ErrorFormat("[TEMP ATTACHS]: Failed to register script functions"); - } - } - - public void Close() - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public string Name - { - get { return "TempAttachmentsModule"; } - } - - private void SendConsoleOutput(UUID agentID, string text) - { - if (m_console == null) - return; - - m_console.SendConsoleOutput(agentID, text); - } - - private void SetAutoGrantAttachPerms(string module, string[] parms) - { - UUID agentID = new UUID(parms[parms.Length - 1]); - Array.Resize(ref parms, parms.Length - 1); - - if (parms.Length != 3) - { - SendConsoleOutput(agentID, "Command parameter error"); - return; - } - - string val = parms[2]; - if (val != "true" && val != "false") - { - SendConsoleOutput(agentID, "Command parameter error"); - return; - } - - m_scene.StoreExtraSetting("auto_grant_attach_perms", val); - - SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val)); - } - - private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) - { - SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); - if (hostPart == null) - return 0; - - SceneObjectGroup hostgroup = hostPart.ParentGroup; - - if (hostgroup== null || hostgroup.IsAttachment) - return 0; - - IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface(); - if (attachmentsModule == null) - return 0; - - TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script); - if (item == null) - return 0; - - if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH - return 0; - - ScenePresence target; - if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) - return 0; - - if (target.UUID != hostgroup.OwnerID) - { - uint effectivePerms = hostgroup.EffectiveOwnerPerms; - - if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) - return 0; - - hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId); - - if (m_scene.Permissions.PropagatePermissions()) - { - foreach (SceneObjectPart child in hostgroup.Parts) - { - child.Inventory.ChangeInventoryOwner(target.UUID); - child.TriggerScriptChangedEvent(Changed.OWNER); - child.ApplyNextOwnerPermissions(); - } - hostgroup.InvalidateEffectivePerms(); - } - - hostgroup.RootPart.ObjectSaleType = 0; - hostgroup.RootPart.SalePrice = 10; - - hostgroup.HasGroupChanged = true; - hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient); - hostgroup.RootPart.ScheduleFullUpdate(); - } - - return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0; - } - } -} diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 68804a1..6497d10 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3864,7 +3864,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llAttachToAvatar(int attachmentPoint) + public void llAttachToAvatar(LSL_Integer attachmentPoint) { m_host.AddScriptLPS(1); @@ -3875,7 +3875,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AttachToAvatar(attachmentPoint); } - public void llDetachFromAvatar() + public void llAttachToAvatarTemp(LSL_Integer attachmentPoint) + { + IAttachmentsModule attachmentsModule = World.RequestModuleInterface(); + if (attachmentsModule == null) + return; + + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + return; + + SceneObjectGroup grp = m_host.ParentGroup; + if (grp == null || grp.IsDeleted || grp.IsAttachment) + return; + + ScenePresence target; + if (!World.TryGetScenePresence(m_item.PermsGranter, out target)) + return; + + if (target.UUID != grp.OwnerID) + { + uint effectivePerms = grp.EffectiveOwnerPerms; + + if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) + return; + + grp.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId); + + if (World.Permissions.PropagatePermissions()) + { + foreach (SceneObjectPart child in grp.Parts) + { + child.Inventory.ChangeInventoryOwner(target.UUID); + child.TriggerScriptChangedEvent(Changed.OWNER); + child.ApplyNextOwnerPermissions(); + } + grp.InvalidateEffectivePerms(); + } + + grp.RootPart.ObjectSaleType = 0; + grp.RootPart.SalePrice = 10; + + grp.HasGroupChanged = true; + grp.RootPart.SendPropertiesToClient(target.ControllingClient); + grp.RootPart.ScheduleFullUpdate(); + } + + attachmentsModule.AttachObject(target, grp, (uint)attachmentPoint, false, false, true); + } + + public void llDetachFromAvatar() { m_host.AddScriptLPS(1); @@ -7873,7 +7921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget - public LSL_Key llAvatarOnLinkSitTarget(int linknum) + public LSL_Key llAvatarOnLinkSitTarget(LSL_Integer linknum) { m_host.AddScriptLPS(1); if(linknum == ScriptBaseClass.LINK_SET || @@ -13052,10 +13100,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float time = 0.0f; // default is from start ScenePresence presence = null; - + int cmd; for (int i = 0; i < commandList.Data.Length; i++) { - int cmd; if(commandList.Data[i] is LSL_Integer) cmd = (LSL_Integer)commandList.Data[i]; else diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 4529d9a..11f6710 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -52,9 +52,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llApplyRotationalImpulse(LSL_Vector force, int local); LSL_Float llAsin(double val); LSL_Float llAtan2(double x, double y); - void llAttachToAvatar(int attachment); + void llAttachToAvatar(LSL_Integer attachment); + void llAttachToAvatarTemp(LSL_Integer attachmentPoint); LSL_Key llAvatarOnSitTarget(); - LSL_Key llAvatarOnLinkSitTarget(int linknum); + LSL_Key llAvatarOnLinkSitTarget(LSL_Integer linknum); LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up); LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle); LSL_Integer llBase64ToInteger(string str); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 0b474f4..1511495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -120,7 +120,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llAtan2(x, y); } - public void llAttachToAvatar(int attachment) + public void llAttachToAvatar(LSL_Integer attachment) + { + m_LSL_Functions.llAttachToAvatar(attachment); + } + + public void llAttachToAvatarTemp(LSL_Integer attachment) { m_LSL_Functions.llAttachToAvatar(attachment); } @@ -130,7 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llAvatarOnSitTarget(); } - public LSL_Key llAvatarOnLinkSitTarget(int linknum) + public LSL_Key llAvatarOnLinkSitTarget(LSL_Integer linknum) { return m_LSL_Functions.llAvatarOnLinkSitTarget(linknum); } -- cgit v1.1