@@ -39,37 +39,12 @@ public static void Requires(Type type)
3939 return ;
4040 }
4141
42- if ( type == typeof ( ThingDefCount ) )
43- MP . RegisterSyncWorker < ThingDefCount > ( SyncThingDefCount ) ;
44- else if ( type == typeof ( GameCondition ) )
42+ if ( type == typeof ( GameCondition ) )
4543 MP . RegisterSyncWorker < GameCondition > ( SyncGameCondition , isImplicit : true ) ;
46- else if ( type == typeof ( DesignationManager ) )
47- MP . RegisterSyncWorker < DesignationManager > ( SyncDesignationManager ) ;
48- else if ( type == typeof ( Designation ) )
49- {
50- Requires < DesignationManager > ( ) ;
51- MP . RegisterSyncWorker < Designation > ( SyncDesignation , isImplicit : true ) ;
52- }
5344 else
5445 Log . Error ( $ "Trying to register SyncWorker of type { type } , but it's not supported.\n { new StackTrace ( 1 ) } ") ;
5546 }
5647
57- private static void SyncThingDefCount ( SyncWorker sync , ref ThingDefCount thingDefCount )
58- {
59- if ( sync . isWriting )
60- {
61- sync . Write ( thingDefCount . ThingDef ) ;
62- sync . Write ( thingDefCount . Count ) ;
63- }
64- else
65- {
66- var def = sync . Read < ThingDef > ( ) ;
67- var count = sync . Read < int > ( ) ;
68-
69- thingDefCount = new ThingDefCount ( def , count ) ;
70- }
71- }
72-
7348 private static void SyncGameCondition ( SyncWorker sync , ref GameCondition gameCondition )
7449 {
7550 if ( sync . isWriting )
@@ -90,44 +65,6 @@ private static void SyncGameCondition(SyncWorker sync, ref GameCondition gameCon
9065 }
9166 }
9267
93- private static void SyncDesignation ( SyncWorker sync , ref Designation designation )
94- {
95- if ( sync . isWriting )
96- {
97- var canSync = designation ? . designationManager != null ;
98- sync . Write ( canSync ) ;
99-
100- if ( canSync )
101- {
102- sync . Write ( designation . designationManager ) ;
103- sync . Write ( designation . target ) ;
104- sync . Write ( designation . def ) ;
105- }
106- }
107- else
108- {
109- if ( sync . Read < bool > ( ) )
110- {
111- var manager = sync . Read < DesignationManager > ( ) ;
112- var target = sync . Read < LocalTargetInfo > ( ) ;
113- var def = sync . Read < DesignationDef > ( ) ;
114-
115- if ( target . HasThing )
116- designation = manager . DesignationOn ( target . Thing , def ) ;
117- else
118- designation = manager . DesignationAt ( target . Cell , def ) ;
119- }
120- }
121- }
122-
123- private static void SyncDesignationManager ( SyncWorker sync , ref DesignationManager manager )
124- {
125- if ( sync . isWriting )
126- sync . Write ( manager . map ) ;
127- else
128- manager = sync . Read < Map > ( ) . designationManager ;
129- }
130-
13168 private static void SyncPocketMapParent ( SyncWorker sync , ref PocketMapParent pmp )
13269 {
13370 if ( sync . isWriting )
0 commit comments