diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b9d8daf99a..635e459220 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -700,7 +700,29 @@ namespace OpenSim.Framework } } } + return false; + } + public bool RemoveAttachment(int attachPoint, UUID itemID) + { + lock (m_attachments) + { + if(m_attachments.TryGetValue(attachPoint, out List lst) && lst is not null) + { + int index = lst.FindIndex(delegate(AvatarAttachment a) { return a.ItemID.Equals(itemID); }); + if (index >= 0) + { + // Remove it from the list of attachments at that attach point + lst.RemoveAt(index); + + // And remove the list if there are no more attachments here + if (lst.Count == 0) + m_attachments.Remove(attachPoint); + + return true; + } + } + } return false; } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 36bd26207c..cf21e8c19c 100755 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -492,8 +492,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments for (int indx = 0; indx < attachments.Count; ++indx) { InventoryItemBase attItem = attItems[indx]; - if (attItem is null || attItem.Owner.NotEqual(sp.UUID)) + if(attItem is null) + { + m_log.Error($"[ATTACHMENTS MODULE]: inventory item {items[indx]} not found, removing from {sp.Name} appearance"); + sp.Appearance.RemoveAttachment(attachments[indx].AttachPoint, items[indx]); continue; + } + if (attItem.Owner.NotEqual(sp.UUID)) + { + m_log.Error($"[ATTACHMENTS MODULE]: inventory item {items[indx]} has wrong owner, removing from {sp.Name} appearance"); + sp.Appearance.RemoveAttachment(attachments[indx].AttachPoint, items[indx]); + continue; + } + AvatarAttachment attach = attachments[indx]; uint attachmentPt = (uint)attach.AttachPoint; diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index cfde00ad97..3dfa2eba10 100755 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -57,7 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory private int m_savetime = 5; // seconds to wait before saving changed appearance private int m_sendtime = 2; // seconds to wait before sending changed appearance - private bool m_reusetextures = false; private int m_checkTime = 500; // milliseconds to wait between checks for appearance updates private System.Timers.Timer m_updateTimer = new System.Timers.Timer(); @@ -76,10 +75,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory IConfig appearanceConfig = config.Configs["Appearance"]; if (appearanceConfig != null) { - m_savetime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); - m_sendtime = Convert.ToInt32(appearanceConfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); - m_reusetextures = appearanceConfig.GetBoolean("ReuseTextures",m_reusetextures); - + m_savetime = appearanceConfig.GetInt("DelayBeforeAppearanceSave", m_savetime); + m_sendtime = appearanceConfig.GetInt("DelayBeforeAppearanceSend", m_sendtime); // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 43c866fa0a..f9e56d0028 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { void state(string newState); - //ApiDesc Returns absolute version as val (ie as postive value) + //ApiDesc Returns absolute version as val (ie as positive value) LSL_Integer llAbs(LSL_Integer val); //ApiDesc Returns cosine of val (val in radians) LSL_Float llAcos(LSL_Float val);