Skip to content

Commit ea1ef17

Browse files
committed
Add SyncWorker for ThingDefCount serialization
Introduces a SyncWorker delegate to handle reading and writing of ThingDefCount objects for synchronization.
1 parent f0221d0 commit ea1ef17

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Source/Client/Syncing/Dict/SyncDictRimWorld.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,23 @@ public static class SyncDictRimWorld
810810
}
811811
}, true // implicit
812812
},
813+
{
814+
(SyncWorker sync, ref ThingDefCount thingDefCount) =>
815+
{
816+
if (sync.isWriting)
817+
{
818+
sync.Write(thingDefCount.ThingDef);
819+
sync.Write(thingDefCount.Count);
820+
}
821+
else
822+
{
823+
var def = sync.Read<ThingDef>();
824+
var count = sync.Read<int>();
825+
826+
thingDefCount = new ThingDefCount(def, count);
827+
}
828+
}
829+
},
813830
#endregion
814831

815832
#region Databases

0 commit comments

Comments
 (0)