mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 11:39:51 +00:00
Compare commits
6
Commits
1.2.0-rc.1
..
1.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
081e6e2ba9 | ||
|
|
70155fe8a6 | ||
|
|
89a8adadf7 | ||
|
|
837ee142b3 | ||
|
|
2453bff8df | ||
|
|
f501dc1897 |
No files matched your search
+2
-2
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.11.9</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.11.9</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.12.15</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.12.15</GameVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
"requested": "[2021.12.15, )",
|
||||
"resolved": "2021.12.15",
|
||||
"contentHash": "YXKxGYWvA5+cLvJXlzcsYOS55q1g/QKzLgy1QNGnyWgTYk91z1scufLb4aMb6lSfQhTPUpEB3ajyupwqtI8uOg=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
"requested": "[2021.12.15, )",
|
||||
"resolved": "2021.12.15",
|
||||
"contentHash": "YXKxGYWvA5+cLvJXlzcsYOS55q1g/QKzLgy1QNGnyWgTYk91z1scufLb4aMb6lSfQhTPUpEB3ajyupwqtI8uOg=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnhollowerBaseLib.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reactor.Extensions;
|
||||
@@ -31,6 +32,7 @@ public class Dispatcher : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
[HideFromIl2Cpp]
|
||||
public void Enqueue(Action action)
|
||||
{
|
||||
lock (_queue)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Reactor.Extensions;
|
||||
|
||||
public static class RandomExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns random <typeparamref name="T"/> from <paramref name="input"/> using <paramref name="random"/>
|
||||
/// </summary>
|
||||
public static T? Random<T>(this IEnumerable<T> input, Random random)
|
||||
{
|
||||
var list = input as IList<T> ?? input.ToList();
|
||||
return list.Count == 0 ? default : list[random.Next(0, list.Count)];
|
||||
}
|
||||
|
||||
/// <summary>Returns a random double that is within a specified range.</summary>
|
||||
public static double NextDouble(this Random random, double minValue, double maxValue)
|
||||
{
|
||||
return random.NextDouble() * (maxValue - minValue) + minValue;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Reactor.Patches
|
||||
if (serverManager.CurrentRegion.TryCast<DnsRegionInfo>() is not { } regionInfo || !regionInfo.Fqdn.EndsWith("among.us"))
|
||||
{
|
||||
var remoteEndPoint = new IPEndPoint(IPAddress.Parse(targetIp), targetPort - 3);
|
||||
__result = new UnityUdpClientConnection(remoteEndPoint);
|
||||
__result = new UnityUdpClientConnection(null, remoteEndPoint);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace Reactor.Patches
|
||||
var servers = Dns.GetHostAddresses(__instance.Fqdn)
|
||||
.Distinct()
|
||||
.Where(ipAddress => ipAddress.AddressFamily == AddressFamily.InterNetwork)
|
||||
.Select(ipAddress => new ServerInfo($"{__instance.Name}-{i++}", ipAddress.ToString(), __instance.Port))
|
||||
.Select(ipAddress => new ServerInfo($"{__instance.Name}-{i++}", ipAddress.ToString(), __instance.Port, __instance.UseDtls))
|
||||
.ToArray();
|
||||
|
||||
__instance.cachedServers = servers;
|
||||
@@ -41,7 +41,7 @@ namespace Reactor.Patches
|
||||
Logger<ReactorPlugin>.Info($"Failed to populate {__instance.Name}: {e}");
|
||||
__instance.cachedServers = new[]
|
||||
{
|
||||
new ServerInfo(__instance.Name ?? string.Empty, __instance.DefaultIp, __instance.Port),
|
||||
new ServerInfo(__instance.Name ?? string.Empty, __instance.DefaultIp, __instance.Port, __instance.UseDtls),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
"requested": "[2021.12.15, )",
|
||||
"resolved": "2021.12.15",
|
||||
"contentHash": "YXKxGYWvA5+cLvJXlzcsYOS55q1g/QKzLgy1QNGnyWgTYk91z1scufLb4aMb6lSfQhTPUpEB3ajyupwqtI8uOg=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
Reference in new issue
Block a user