fix: Adds AfterSerialize support. Removes BeforeSerialize support. (#1208)

### Changes
* Implements an AfterSerialize method that is executed synchronously.
* Removes `BeforeSerialize` support since it was dangerous in its current implementation.
* Moves PlayerMobile kill/virtual decay to AfterSerialize.
* Adds kill decay to after Deserialize.
This commit is contained in:
Kamron Batman 2022-10-27 23:27:22 -07:00 • committed by GitHub
parent deabab575a
commit 49e6c6f2d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 132 additions and 61 deletions

View file

@ -3402,6 +3402,17 @@ namespace Server.Mobiles
writer.Write(GameTime);
}
// Do we need to run an after serialize?
public override bool ShouldExecuteAfterSerialize => ShouldKillDecay() || ShouldAtrophy();
public override void AfterSerialize()
{
base.AfterSerialize();
CheckKillDecay();
CheckAtrophies();
}
public bool ShouldAtrophy()
{
var sacrifice = SacrificeVirtue.ShouldAtrophy(this);