Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 8259494

Browse files
committed
Fix
1 parent 0cdbfad commit 8259494

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

.github/workflows/build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
- name: Del Other Files
5858
run: rm -rf ./Release/BepInEx/plugins/TheOtherRoles.deps.json ./Release/BepInEx/plugins/TheOtherRoles.pdb ./Release/changelog.txt ./Release/BepInEx/config/BepInEx.cfg
5959

60+
- name: make
61+
run: mkdir ./Release/BepInEx/config
62+
6063
- name: Move cfg
6164
run: mv BepInEx.cfg ./Release/BepInEx/config
6265

TheOtherRoles/Helper/HandshakeHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public void Send(HandshakeHelper.ShareMode mode)
214214
{
215215
Info($"again send mode:{mode} id:{playerId}");
216216

217-
if (AmongUsClient.Instance == null || CachedPlayer.LocalPlayer.PlayerControl == null) return;
217+
if (AmongUsClient.Instance == null || CachedPlayer.LocalPlayer == null) return;
218218

219219
var writer = FastRpcWriter.StartNewRpcWriter(CustomRPC.VersionHandshakeEx, SendOption.Reliable,
220220
RPCSendMode.SendToPlayer, playerId)

TheOtherRoles/Modules/ChatCommands.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static bool Prefix(ChatController __instance) {
5555
var writer = FastRpcWriter.StartNewRpcWriter(CustomRPC.ShareGamemode)
5656
.Write(gameMode);
5757
writer.RPCSend();
58-
RPCProcedure.shareGameMode((byte)gameMode);
58+
RPCProcedure.shareGamemode((byte)gameMode);
5959
}
6060
else
6161
{

TheOtherRoles/Patches/GameStartManagerPatch.cs

+14-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ public class GameStartManagerPatch
1818

1919
private static bool IsStart(GameStartManager __instance)
2020
{
21-
return __instance.GameStartText.text.StartsWith(
22-
FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.GameStarting));
21+
return __instance.GameStartText.text.Contains(
22+
FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.GameStarting, [Mathf.CeilToInt(__instance.countDownTimer)]));
23+
}
24+
25+
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnGameEnd))]
26+
public class AmongUsClientOnGameEndPatch
27+
{
28+
public static void Postfix(AmongUsClient __instance)
29+
{
30+
if (AmongUsClient.Instance.AmHost)
31+
HandshakeHelper.ShareGameMode();
32+
}
2333
}
2434

2535
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerJoined))]
@@ -51,15 +61,15 @@ public static void Postfix(GameStartManager __instance)
5161
new Il2CppReferenceArray<Il2CppSystem.Object>(0)) + "\r\n" + code;
5262

5363
// Send version as soon as CachedPlayer.LocalPlayer.PlayerControl exists
64+
65+
if (AmongUsClient.Instance.AmHost) HandshakeHelper.ShareGameMode();
5466

5567
if (CachedPlayer.LocalPlayer == null) return;
5668

5769
HandshakeHelper.PlayerAgainInfo.Clear();
5870

5971
HandshakeHelper.shareGameVersion();
6072
HandshakeHelper.shareGameGUID();
61-
62-
if (AmongUsClient.Instance.AmHost) HandshakeHelper.ShareGameMode();
6373
}
6474
}
6575

TheOtherRoles/RPC.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,10 @@ public static void forceEnd()
286286
}
287287
}
288288
}
289-
290-
public static void shareGameMode(byte mode)
291-
{
292-
gameMode = (CustomGamemodes)mode;
293-
}
294-
289+
295290
public static void shareGamemode(byte gm)
296291
{
297-
TORMapOptions.gameMode = (CustomGamemodes)gm;
292+
gameMode = (CustomGamemodes)gm;
298293
}
299294

300295
public static void stopStart(byte playerId)

0 commit comments

Comments
 (0)