-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
50 lines (45 loc) · 1.71 KB
/
Copy pathPlugin.cs
File metadata and controls
50 lines (45 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using BepInEx;
using HarmonyLib;
using Sunless.Game.ApplicationProviders;
using Sunless.Game.Entities.Geography;
namespace CorrespondentFix;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
Harmony.CreateAndPatchAll(typeof(CorrespondentChartPatch));
}
}
[HarmonyPatch(typeof(LegacyProvider), MethodType.Getter)]
public static class CorrespondentChartPatch
{
[HarmonyPrefix]
[HarmonyPatch("Chart")]
private static bool PrefixChart(ref SerializableTileConfig __result, LegacyProvider __instance)
{
if (!__instance.Correspondent.Selected)
{
__result = null; // Return null, the game generates a new chart
}
else
{
SerializableTileConfig deadCharacterTiles = __instance.DeadCharacter.TileConfig;
foreach (TileInstance tileInstance in deadCharacterTiles.Tiles)
{
// Clear all discovered curiosities from the tile
tileInstance.DiscoveredFlavourItems.Clear();
tileInstance.ProceduralTerrain.Clear();
tileInstance.ProceduralDecals.Clear();
tileInstance.DiscoveredSpawnPoints.Clear();
tileInstance.DiscoveredTerrain.Clear();
tileInstance.DiscoveredLabels.Clear();
tileInstance.Discoveredphenomena.Clear();
tileInstance.AbyssBuff.Clear();
}
__result = deadCharacterTiles; // Return the modified tiles
}
return false; // Don't run the original function
}
}