fix: Fixes world save decay (#1540)

This commit is contained in:
Kamron Batman 2023-10-11 14:04:13 -07:00 • committed by GitHub
parent 1ebaf5390d
commit 28068c8241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -2247,8 +2247,7 @@ public class Item : IHued, IComparable<Item>, 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() =>

View file

@ -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);
}
}