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:
parent
deabab575a
commit
49e6c6f2d1
13 changed files with 132 additions and 61 deletions
|
|
@ -26,6 +26,7 @@ public static class GenericPersistence
|
|||
string name,
|
||||
Action<IGenericWriter> serializer,
|
||||
Action<IGenericReader> deserializer,
|
||||
Action afterSerialize = null,
|
||||
int priority = Persistence.DefaultPriority
|
||||
)
|
||||
{
|
||||
|
|
@ -49,6 +50,6 @@ public static class GenericPersistence
|
|||
void Deserialize(string savePath, Dictionary<ulong, string> typesDb) =>
|
||||
AdhocPersistence.Deserialize(Path.Combine(savePath, name, $"{name}.bin"), deserializer);
|
||||
|
||||
Persistence.Register(name, Serialize, WriteSnapshot, Deserialize, priority);
|
||||
Persistence.Register(name, Serialize, WriteSnapshot, Deserialize, afterSerialize, priority);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue