diff --git a/Projects/Server/Items/BaseMulti.cs b/Projects/Server/Items/BaseMulti.cs index ad27efe583..41c448776b 100644 --- a/Projects/Server/Items/BaseMulti.cs +++ b/Projects/Server/Items/BaseMulti.cs @@ -32,13 +32,9 @@ public override int ItemID { if (base.ItemID != value) { - var facet = Parent == null ? Map : null; - - facet?.OnLeave(this); - + Map?.OnLeave(this); base.ItemID = value; - - facet?.OnEnter(this); + Map?.OnEnter(this); } } } @@ -69,21 +65,6 @@ public override int LabelNumber public virtual MultiComponentList Components => MultiData.GetComponents(ItemID); - [Obsolete("Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true)] - public virtual void RefreshComponents() - { - if (Parent == null) - { - var facet = Map; - - if (facet != null) - { - facet.OnLeave(this); - facet.OnEnter(this); - } - } - } - public override int GetMaxUpdateRange() => 22; public override int GetUpdateRange(Mobile m) => 22; diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index 6d9e59f8ab..c4cdccfc93 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -599,18 +599,16 @@ public IEntity Parent 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 Map Map { 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(); } diff --git a/Projects/Server/Maps/Map.cs b/Projects/Server/Maps/Map.cs index 21721f8566..21af5935ca 100644 --- a/Projects/Server/Maps/Map.cs +++ b/Projects/Server/Maps/Map.cs @@ -568,12 +568,12 @@ public void OnClientChange(NetState oldState, NetState newState, Mobile m) } } - public void OnEnter(Mobile m) + internal void OnEnter(Mobile m) { OnEnter(m.Location, m); } - public void OnEnter(Point3D p, Mobile m) + internal void OnEnter(Point3D p, Mobile m) { if (this != Internal) { @@ -581,14 +581,14 @@ public void OnEnter(Point3D p, Mobile m) } } - public void OnEnter(Item item) + internal void OnEnter(Item item) { OnEnter(item.Location, item); } - public void OnEnter(Point3D p, Item item) + internal void OnEnter(Point3D p, Item item) { - if (this == Internal) + if (this == Internal || item.Parent != null) { return; } @@ -606,12 +606,12 @@ public void OnEnter(Point3D p, Item item) } } - public void OnLeave(Mobile m) + internal void OnLeave(Mobile m) { OnLeave(m.Location, m); } - public void OnLeave(Point3D p, Mobile m) + internal void OnLeave(Point3D p, Mobile m) { if (this != Internal) { @@ -619,14 +619,14 @@ public void OnLeave(Point3D p, Mobile m) } } - public void OnLeave(Item item) + internal void OnLeave(Item item) { OnLeave(item.Location, item); } - public void OnLeave(Point3D p, Item item) + internal void OnLeave(Point3D p, Item item) { - if (this == Internal) + if (this == Internal || item.Parent != null) { return; } diff --git a/Projects/UOContent/World Saves/AutoSave.cs b/Projects/UOContent/World Saves/AutoSave.cs index f113a9068f..21748b2850 100644 --- a/Projects/UOContent/World Saves/AutoSave.cs +++ b/Projects/UOContent/World Saves/AutoSave.cs @@ -35,6 +35,7 @@ public static bool SavesEnabled public static void Configure() { + SavesEnabled = ServerConfiguration.GetOrUpdateSetting("autosave.enabled", true); Delay = ServerConfiguration.GetOrUpdateSetting("autosave.saveDelay", TimeSpan.FromMinutes(5.0)); Warning = ServerConfiguration.GetOrUpdateSetting("autosave.warningDelay", TimeSpan.Zero); }