Fixed custom regions

Merged stable dev branch with master branch
This commit is contained in:
Daemon authored and GitHub committed 2021-03-13 15:23:51 +00:00
commit fe8f24ce98
5 files changed
+24 -31

No files matched your search

+6 -8
View File
@@ -1,9 +1,5 @@
> The 2021.3.5s release of this mod currently may not work properly or even at all since
> [Impostor](https://github.com/Impostor/Impostor) doesn't officially support 2021.3.5s yet and I haven't
> been able to test the mod to see if the custom regions actually work. However, you can compile an
> in-development version of Impostor [here](https://github.com/Impostor/Impostor/tree/2021.3.5) to try
> and connect to a local server using 2021.3.5s. I have tried to compile and run that version of Impostor
> but it didn't work at the time of testing.
> The 2021.3.5s release of this mod requires you to compile an in-development version of Impostor
> [here](https://github.com/Impostor/Impostor/tree/2021.3.5) if you want to host a local server.
# Unify
@@ -26,14 +22,16 @@ The following regions have been added:
> **⚠ WARNING**
>
> This mod is only compatible with the steam release of the game.
> This mod requires you to have BepInEx and Reactor installed. You can install BepInEx and Reactor by following [this guide](INSTALLATION.md) or by following the steps on the
> following two pages: https://docs.reactor.gg/docs/basic/install_bepinex and https://docs.reactor.gg/docs/basic/install_reactor.
> This mod is only compatible with the steam release of the game.
> If you are still using 2020.12.9s and Reactor fails to load, try using the Reactor version located
> here: https://github.com/NuclearPowered/Reactor/actions/runs/593649307.
> If you are using 2021.3.5s and Reactor fails to load, ensure you have the latest version of Reactor installed.
1. Ensure that BepInEx and Reactor are installed (more information above).
2. Download the latest mod on the [releases](https://github.com/DaemonBeast/Unify/releases) page.
3. Move the mod to the `(Among Us game files)/BepInEx/plugins` folder.
+15 -20
View File
@@ -9,21 +9,17 @@ namespace Unify.Patches
{
private static IRegionInfo[] _newRegions = new IRegionInfo[]
{
new StaticRegionInfo("skeld.net", StringNames.NoTranslation, "192.241.154.115", new ServerInfo[]
{
new ServerInfo("skeld.net-Master-1", "192.241.154.115", 22023)
}).Duplicate(),
new StaticRegionInfo("localhost", StringNames.NoTranslation, "127.0.0.1", new ServerInfo[]
{
new ServerInfo("localhost", "127.0.0.1", 22023)
}).Duplicate()
new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115")
.Duplicate(),
new DnsRegionInfo("localhost", "localhost", StringNames.NoTranslation, "127.0.0.1")
.Duplicate()
};
private static IRegionInfo[] _customRegions = MergeRegions(_newRegions, LoadCustomRegions());
private static IRegionInfo[] _customRegions = MergeRegions(_newRegions, LoadCustomUserRegions());
public static void Patch()
{
IRegionInfo[] patchedRegions = MergeRegions(ServerManager.DefaultRegions, _customRegions);
ServerManager.DefaultRegions = patchedRegions;
ServerManager.Instance.AvailableRegions = patchedRegions;
ServerManager.Instance.SaveServers();
@@ -38,23 +34,22 @@ namespace Unify.Patches
return patchedRegions;
}
private static IRegionInfo[] LoadCustomRegions()
private static IRegionInfo[] LoadCustomUserRegions()
{
List<IRegionInfo> customRegions = new List<IRegionInfo>();
for (int x = 0; x < 5; x++)
{
ConfigEntry<string> regionName = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", $"Name", "custom region");
ConfigEntry<string> regionIp = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", "IP", "");
ConfigEntry<ushort> regionPort = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", "Port", (ushort) 22023);
ConfigEntry<string> regionName = UnifyPlugin.ConfigFile.Bind(
$"Region {x + 1}", $"Name", "custom region");
ConfigEntry<string> regionIp = UnifyPlugin.ConfigFile.Bind(
$"Region {x + 1}", "IP", "");
if (String.IsNullOrWhiteSpace(regionIp.Value)) continue;
IRegionInfo regionInfo = new StaticRegionInfo(
regionName.Value, StringNames.NoTranslation, regionIp.Value, new ServerInfo[]
{
new ServerInfo(regionName.Value, regionIp.Value, regionPort.Value)
}).Duplicate();
IRegionInfo regionInfo = new DnsRegionInfo(
regionIp.Value, regionName.Value, StringNames.NoTranslation, regionIp.Value)
.Duplicate();
customRegions.Add(regionInfo);
}
+1 -1
View File
@@ -15,7 +15,7 @@ namespace Unify
{
public const string Id = "daemon.unify.reactor";
private const string Name = "Unify";
private const string Version = "2.0.0";
private const string Version = "2.0.1";
public static readonly ConfigFile ConfigFile =
new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true);
+2 -2
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>
<Description>Region mod for Reactor</Description>
@@ -14,7 +14,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
<GameVersion>2020.11.17i</GameVersion>
<GameVersion>2021.11.17i</GameVersion>
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
</PropertyGroup>
Binary file not shown.