fix: Fixes issue with duping items and serialization, and sector lists. (#1662)

This commit is contained in:
Kamron Batman 2024-01-23 23:08:52 -08:00 • committed by GitHub
parent 497ea87943
commit 3812a783ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 32 additions and 53 deletions

View file

@ -599,18 +599,16 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
var oldParent = m_Parent;
if (m_Map != null && oldParent == null && value != null)
{
m_Map.OnLeave(this);
}
m_Parent = value;
if (m_Map != null)
if (m_Map != null && oldParent != null && value == null)
{
if (oldParent != null && m_Parent == null)
{
m_Map.OnEnter(this);
}
else if (m_Parent != null)
{
m_Map.OnLeave(this);
}
m_Map.OnEnter(this);
}
}
}
@ -1207,9 +1205,13 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
{
var old = m_Map;
if (m_Map != null && m_Parent == null)
if (m_Map != null)
{
m_Map.OnLeave(this);
if (m_Parent == null)
{
m_Map.OnLeave(this);
}
SendRemovePacket();
}
@ -3328,13 +3330,14 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
}
}
private static readonly HashSet<string> _excludedProperties = new()
{
private static readonly HashSet<string> _excludedProperties =
[
"SaveBuffer",
"Parent",
"Next",
"Previous",
"OnLinkList"
};
];
public virtual bool DupeExcludedProperty(string propertyName) => _excludedProperties.Contains(propertyName);