2 Commits
Author SHA1 Message Date
js6pak 081e6e2ba9 1.2.1 2022-02-18 22:40:48 +01:00
js6pak 70155fe8a6 Don't reload regionInfo.json when the game saves it 2022-02-18 22:38:35 +01:00
3 changed files with 23 additions and 2 deletions

No files matched your search

+21
View File
@@ -1,5 +1,6 @@
using System;
using System.IO;
using HarmonyLib;
using Reactor.Extensions;
using UnityEngine;
using Object = UnityEngine.Object;
@@ -10,6 +11,8 @@ namespace Reactor.Patches
{
private FileSystemWatcher Watcher { get; }
public bool IgnoreNext { get; set; }
internal RegionInfoWatcher()
{
Watcher = new FileSystemWatcher(
@@ -21,6 +24,12 @@ namespace Reactor.Patches
{
if (new FileInfo(e.Name).Length > 0)
{
if (IgnoreNext)
{
IgnoreNext = false;
return;
}
Dispatcher.Instance.Enqueue(() =>
{
ServerManager.Instance.LoadServers();
@@ -44,5 +53,17 @@ namespace Reactor.Patches
{
Watcher.Dispose();
}
[HarmonyPatch(typeof(FileIO), nameof(FileIO.WriteAllText))]
private static class WritePatch
{
public static void Prefix(string path)
{
if (ServerManager.Instance && path == ServerManager.Instance.serverInfoFileJson)
{
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = true;
}
}
}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<VersionPrefix>1.2.0</VersionPrefix>
<VersionPrefix>1.2.1</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<Description>Core mod and API for Among Us</Description>
<Authors>NuclearPowered</Authors>
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Reactor
public ConfigEntry<bool>? AllowVanillaServers { get; private set; }
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
internal RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
public ReactorPlugin()
{