diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fc755705ca..3c181080b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2201,7 +2201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(sceneOG.IsAttachment) return; - if (sceneOG.OwnerID != m_host.OwnerID) + if (sceneOG.OwnerID.NotEqual(m_host.OwnerID)) return; // harakiri check @@ -4249,38 +4249,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void ForceAttachToAvatarFromInventory(UUID avatarId, string itemName, int attachmentPoint) { IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; - - if (attachmentsModule == null) + if (attachmentsModule is null) return; InitLSL(); TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); - - if (item == null) + if (item is null) { - m_LSL_Api.llSay(0, string.Format("Could not find object '{0}'", itemName)); + m_LSL_Api?.llSay(0, string.Format("Could not find object '{0}'", itemName)); throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName)); } if (item.InvType != (int)InventoryType.Object) { - // FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set - // up the api reference. - if (m_LSL_Api != null) - m_LSL_Api.llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); - + m_LSL_Api?.llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName)); } - ScenePresence sp = World.GetScenePresence(avatarId); + if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) != 0) + { + m_LSL_Api?.llSay(0, string.Format("Unable to attach coalesced object, item '{0}' ", itemName)); + throw new Exception(String.Format("The inventory item '{0}' is a coalesced object", itemName)); + } - if (sp == null) + ScenePresence sp = World.GetScenePresence(avatarId); + if (sp is null) return; InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out string message); - if (newItem == null) + if (newItem is null) { m_log.ErrorFormat( "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",