From 28068c82416c5f7b26e45fe765851ebe12248758 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:04:13 -0700 Subject: [PATCH] fix: Fixes world save decay (#1540) --- Projects/Server/Items/Item.cs | 3 +-- Projects/Server/World/World.cs | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index e4d9cdcf7..14984747a 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -2247,8 +2247,7 @@ public class Item : IHued, IComparable, ISpawnable, IObjectPropertyListEnt public bool AtPoint(int x, int y) => m_Location.m_X == x && m_Location.m_Y == y; - public virtual bool CanDecay() => - Decays && Parent == null && Map != Map.Internal; + public virtual bool CanDecay() => Decays && Parent == null && Map != Map.Internal; public virtual bool OnDecay() => diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index 0c8fb54c5..11c730045 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -324,7 +324,7 @@ public static class World } WorldState = WorldState.Saving; - + Broadcast(0x35, true, "The world is saving, please wait."); logger.Information("Saving world"); @@ -479,16 +479,16 @@ public static class World } } - public override void WriteSnapshot(string basePath) + public override void Serialize() { - base.WriteSnapshot(basePath); - foreach (var item in EntitiesBySerial.Values) { if (item.CanDecay() && item.LastMoved + item.DecayTime <= _serializationStart) { EnqueueForDecay(item); } + + PushToCache(item); } }