mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
remove attachments from current appearence if they are not found in inventory
This commit is contained in:
@@ -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<AvatarAttachment> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user