7 Commits
Author SHA1 Message Date
js6pak 22550a88ca 1.2.6 2022-05-31 00:40:18 +02:00
js6pak 2b98a211bd Merge pull request #55 from miniduikboot/fix/region-info-feedback-loop
Improve regionInfo.json writing logic
2022-05-30 21:43:05 +00:00
miniduikboot cb799e877e Improve regionInfo.json writing logic
Since a few version AU writes the regionInfo.json file after loading it.
This triggers the write observer, causing a positive feedback loop.
70155fe8a6 took the first stab at stopping
this positive feedback, but unfortunately it isn't adequate enough when
4+ clients are running at the same time, so this commit takes it a step
further by not writing the data if it didn't change, stopping the loop.
2022-05-30 23:38:15 +02:00
js6pak fcc8056aaa 1.2.5 2022-05-06 14:02:13 +02:00
js6pak c4a8c8abbe [skip ci] Create release from CI 2022-05-06 14:00:24 +02:00
js6pak 7203698222 Totally didn't forget to commit this 2022-04-01 10:08:10 +02:00
js6pak d3fa33aaf0 2022.3.29 2022-03-31 22:26:18 +02:00
11 changed files with 46 additions and 33 deletions

No files matched your search

+6
View File
@@ -44,3 +44,9 @@ jobs:
with:
name: Reactor.Debugger.dll
path: Reactor.Debugger/bin/Release/netstandard2.1/Reactor.Debugger.dll
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: Reactor/bin/Release/netstandard2.1/Reactor.dll
+2 -2
View File
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2022.2.23</GameVersion>
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.12.15</GameVersion>
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2022.3.29</GameVersion>
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2022.3.29</GameVersion>
</PropertyGroup>
<ItemGroup>
+5 -4
View File
@@ -80,10 +80,11 @@ namespace Reactor.Debugger
playerControl.GetComponent<DummyBehaviour>().enabled = true;
playerControl.NetTransform.enabled = false;
playerControl.SetName($"{TranslationController.Instance.GetString(StringNames.Dummy, Array.Empty<Il2CppSystem.Object>())} {i}");
playerControl.SetColor((byte) (i % Palette.PlayerColors.Length));
playerControl.SetHat(HatManager.Instance.AllHats.ToArray().ElementAt(i % HatManager.Instance.AllHats.Count).ProdId, playerControl.Data.DefaultOutfit.ColorId);
playerControl.SetPet(HatManager.Instance.AllPets.ToArray().ElementAt(i % HatManager.Instance.AllPets.Count).ProdId);
playerControl.SetSkin(HatManager.Instance.AllSkins.ToArray().ElementAt(i % HatManager.Instance.AllSkins.Count).ProdId);
var color = (byte) (i % Palette.PlayerColors.Length);
playerControl.SetColor(color);
playerControl.SetHat(HatManager.Instance.allHats[i % HatManager.Instance.allHats.Count].ProdId, playerControl.Data.DefaultOutfit.ColorId);
playerControl.SetPet(HatManager.Instance.allPets[i % HatManager.Instance.allPets.Count].ProdId);
playerControl.SetSkin(HatManager.Instance.allSkins[i % HatManager.Instance.allSkins.Count].ProdId, color);
GameData.Instance.RpcSetTasks(playerControl.PlayerId, new Il2CppStructArray<byte>(0));
}
}
+3 -3
View File
@@ -4,9 +4,9 @@
".NETStandard,Version=v2.1": {
"AmongUs.GameLibs.Steam": {
"type": "Direct",
"requested": "[2022.2.23, )",
"resolved": "2022.2.23",
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
"requested": "[2022.3.29, )",
"resolved": "2022.3.29",
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
},
"BepInEx.AutoPlugin": {
"type": "Direct",
+3 -3
View File
@@ -4,9 +4,9 @@
".NETStandard,Version=v2.1": {
"AmongUs.GameLibs.Steam": {
"type": "Direct",
"requested": "[2022.2.23, )",
"resolved": "2022.2.23",
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
"requested": "[2022.3.29, )",
"resolved": "2022.3.29",
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
},
"BepInEx.AutoPlugin": {
"type": "Direct",
+4 -4
View File
@@ -32,14 +32,14 @@ namespace Reactor
}
public static implicit operator StringNames(CustomStringName name) => (StringNames) name.Id;
public static explicit operator CustomStringName(StringNames name) => List.SingleOrDefault(x => x.Id == (int) name);
public static explicit operator CustomStringName?(StringNames name) => List.SingleOrDefault(x => x.Id == (int) name);
[HarmonyPatch(typeof(LanguageUnit), nameof(LanguageUnit.GetString), typeof(StringNames), typeof(string), typeof(Il2CppReferenceArray<Il2CppSystem.Object>))]
[HarmonyPatch(typeof(TranslationController), nameof(TranslationController.GetString), typeof(StringNames), typeof(Il2CppReferenceArray<Il2CppSystem.Object>))]
private static class GetStringPatch
{
public static bool Prefix(StringNames stringId, Il2CppReferenceArray<Il2CppSystem.Object> parts, ref string __result)
public static bool Prefix(StringNames id, Il2CppReferenceArray<Il2CppSystem.Object> parts, ref string __result)
{
var customStringName = (CustomStringName) stringId;
var customStringName = (CustomStringName?) id;
if (customStringName != null)
{
+15 -2
View File
@@ -57,12 +57,25 @@ namespace Reactor.Patches
[HarmonyPatch(typeof(FileIO), nameof(FileIO.WriteAllText))]
private static class WritePatch
{
public static void Prefix(string path)
public static bool Prefix(string path, string contents)
{
// Among Us' region loading code unfortunately contains a call
// to SaveServers, which will write out the region file. This
// will lead to a positive feedback loop when detecting writes,
// which is undesireable. So we check if the write makes a
// change to the file on disk and if it would write the same
// file again, stop AU from actually writing it.
if (ServerManager.Instance && path == ServerManager.Instance.serverInfoFileJson)
{
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = true;
var currentContents = FileIO.ReadAllText(path);
var continueWrite = currentContents != contents;
Logger<ReactorPlugin>.Debug($"Continue serverInfoFile write? {continueWrite}");
// If we will write, ignore the next change action from the observer.
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = continueWrite;
return continueWrite;
}
return true;
}
}
}
+4 -10
View File
@@ -1,19 +1,13 @@
using System;
using UnityEngine.SceneManagement;
using HarmonyLib;
namespace Reactor.Patches
{
[HarmonyPatch(typeof(SplashManager), nameof(SplashManager.Start))]
internal static class SplashSkip
{
internal static void Initialize()
private static void Prefix(SplashManager __instance)
{
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
{
if (scene.name == "SplashIntro")
{
SceneManager.LoadScene("MainMenu");
}
}));
__instance.minimumSecondsBeforeSceneChange = 0;
}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<VersionPrefix>1.2.3</VersionPrefix>
<VersionPrefix>1.2.6</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
<Description>Core mod and API for Among Us</Description>
<Authors>NuclearPowered</Authors>
-1
View File
@@ -50,7 +50,6 @@ namespace Reactor
ReactorVersionShower.Initialize();
FreeNamePatch.Initialize();
SplashSkip.Initialize();
DefaultBundle.Load();
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
+3 -3
View File
@@ -4,9 +4,9 @@
".NETStandard,Version=v2.1": {
"AmongUs.GameLibs.Steam": {
"type": "Direct",
"requested": "[2022.2.23, )",
"resolved": "2022.2.23",
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
"requested": "[2022.3.29, )",
"resolved": "2022.3.29",
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
},
"BepInEx.AutoPlugin": {
"type": "Direct",