File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,8 +220,23 @@ public int GetFactionId(ZoneManager zoneManager)
220220 {
221221 return factionData . First ( kv => kv . Value . zoneManager == zoneManager ) . Key ;
222222 }
223+ public AreaManager AllAreaManager ( )
224+ {
225+ AreaManager areaManager = new AreaManager ( this . map ) ;
226+
227+ foreach ( var data in factionData )
228+ {
229+ foreach ( var area in data . Value . areaManager . AllAreas )
230+ {
231+ areaManager . areas . Add ( area ) ;
232+ }
233+ }
234+ return areaManager ;
235+ }
223236 }
224237
238+
239+
225240 [ HarmonyPatch ( typeof ( MapDrawer ) , nameof ( MapDrawer . DrawMapMesh ) ) ]
226241 static class ForceShowDialogs
227242 {
@@ -235,7 +250,8 @@ static void Prefix(MapDrawer __instance)
235250 {
236251 var newDialog = comp . mapDialogs . First ( ) . Dialog ;
237252 //If NO mapdialogs (Dialog_NodeTrees) are open, add the first one to the window stack
238- if ( ! Find . WindowStack . IsOpen ( typeof ( Dialog_NodeTree ) ) && ! Find . WindowStack . IsOpen ( newDialog . GetType ( ) ) ) {
253+ if ( ! Find . WindowStack . IsOpen ( typeof ( Dialog_NodeTree ) ) && ! Find . WindowStack . IsOpen ( newDialog . GetType ( ) ) )
254+ {
239255 Find . WindowStack . Add ( newDialog ) ;
240256 }
241257 }
Original file line number Diff line number Diff line change 1+ using HarmonyLib ;
2+ using System ;
3+ using System . Collections . Generic ;
4+ using System . Linq ;
5+ using System . Text ;
6+ using System . Threading . Tasks ;
7+ using Verse ;
8+
9+ namespace Multiplayer . Client . Patches
10+ {
11+ [ HarmonyPatch ( typeof ( AreaSource ) ) ]
12+ static class AreaSource_Patch
13+ {
14+ [ HarmonyPatch ( nameof ( AreaSource . ComputeAll ) ) ]
15+ [ HarmonyPatch ( nameof ( AreaSource . UpdateIncrementally ) ) ]
16+ static void Prefix ( AreaSource __instance , ref AreaManager __state )
17+ {
18+ if ( Multiplayer . Client == null || ! Multiplayer . GameComp . multifaction ) return ;
19+ __state = __instance . map . areaManager ;
20+ __instance . map . areaManager = __instance . map . MpComp ( ) . AllAreaManager ( ) ;
21+ }
22+
23+ [ HarmonyPatch ( nameof ( AreaSource . ComputeAll ) ) ]
24+ [ HarmonyPatch ( nameof ( AreaSource . UpdateIncrementally ) ) ]
25+ static void Finalizer ( AreaSource __instance , AreaManager __state )
26+ {
27+ if ( Multiplayer . Client == null || ! Multiplayer . GameComp . multifaction ) return ;
28+
29+ // restore original
30+ __instance . map . areaManager = __state ;
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments