Add two-way serialization in ExposeData for some of the components that are missing it (#1451)

This commit is contained in:
DrSmugleaf
2020-07-23 01:46:09 +02:00
committed by GitHub
parent 989025b222
commit a8b3c99075
19 changed files with 252 additions and 172 deletions

View File

@@ -61,16 +61,10 @@ namespace Content.Server.GameObjects
{
base.ExposeData(serializer);
// TODO: This does not serialize what objects are held.
serializer.DataField(ref _orderedHands, "hands", new List<string>(0));
if (serializer.Reading)
{
foreach (var handsname in _orderedHands)
{
AddHand(handsname);
}
}
serializer.DataReadWriteFunction("hands",
new List<string>(0),
hands => hands.ForEach(AddHand),
() => _orderedHands);
serializer.DataField(ref _activeIndex, "defaultHand", _orderedHands.LastOrDefault());
}