Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Source/Client/Comp/Map/MultiplayerMapComp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,23 @@ public int GetFactionId(ZoneManager zoneManager)
{
return factionData.First(kv => kv.Value.zoneManager == zoneManager).Key;
}
public AreaManager AllAreaManager()
{
AreaManager areaManager = new AreaManager(this.map);

foreach (var data in factionData)
{
foreach (var area in data.Value.areaManager.AllAreas)
{
areaManager.areas.Add(area);
}
}
return areaManager;
}
}



[HarmonyPatch(typeof(MapDrawer), nameof(MapDrawer.DrawMapMesh))]
static class ForceShowDialogs
{
Expand All @@ -235,7 +250,8 @@ static void Prefix(MapDrawer __instance)
{
var newDialog = comp.mapDialogs.First().Dialog;
//If NO mapdialogs (Dialog_NodeTrees) are open, add the first one to the window stack
if (!Find.WindowStack.IsOpen(typeof(Dialog_NodeTree)) && !Find.WindowStack.IsOpen(newDialog.GetType())) {
if (!Find.WindowStack.IsOpen(typeof(Dialog_NodeTree)) && !Find.WindowStack.IsOpen(newDialog.GetType()))
{
Find.WindowStack.Add(newDialog);
}
}
Expand Down
33 changes: 33 additions & 0 deletions Source/Client/Patches/AreaSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;

namespace Multiplayer.Client.Patches
{
[HarmonyPatch(typeof(AreaSource))]
static class AreaSource_Patch
{
[HarmonyPatch(nameof(AreaSource.ComputeAll))]
[HarmonyPatch(nameof(AreaSource.UpdateIncrementally))]
static void Prefix(AreaSource __instance, ref AreaManager __state)
{
if (Multiplayer.Client == null || !Multiplayer.GameComp.multifaction) return;
__state = __instance.map.areaManager;
__instance.map.areaManager = __instance.map.MpComp().AllAreaManager();
}

[HarmonyPatch(nameof(AreaSource.ComputeAll))]
[HarmonyPatch(nameof(AreaSource.UpdateIncrementally))]
static void Finalizer(AreaSource __instance, AreaManager __state)
{
if (Multiplayer.Client == null || !Multiplayer.GameComp.multifaction) return;

// restore original
__instance.map.areaManager = __state;
}
}
}
Loading