Skip to content

Commit 492d406

Browse files
SirrWilliamnotfood
andauthored
Add SyncWorker for Room serialization (#565)
Co-authored-by: Meru <notfood@users.noreply.github.com>
1 parent 1bcb548 commit 492d406

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Source/Client/Syncing/Dict/SyncDictRimWorld.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,22 @@ public static class SyncDictRimWorld
10951095
return data.MpContext().map.zoneManager.AllZones.Find(zone => zone.ID == zoneId);
10961096
}, true
10971097
},
1098+
{
1099+
(ByteWriter data, Room room) => {
1100+
if(room == null){
1101+
data.WriteInt32(-1);
1102+
} else {
1103+
data.MpContext().map = room.Map;
1104+
data.WriteInt32(room.ID);
1105+
}
1106+
},
1107+
(ByteReader data) => {
1108+
int roomId = data.ReadInt32();
1109+
if (roomId == -1)
1110+
return null;
1111+
return data.MpContext().map.regionGrid.allRooms.Find(r => r.ID == roomId);
1112+
}, true
1113+
},
10981114
{
10991115
(ByteWriter data, Plan plan) =>
11001116
{

0 commit comments

Comments
 (0)