diff --git a/Modules/CustomWinnerHolder.cs b/Modules/CustomWinnerHolder.cs
index 1dec88a42..56051bee7 100644
--- a/Modules/CustomWinnerHolder.cs
+++ b/Modules/CustomWinnerHolder.cs
@@ -28,12 +28,14 @@ public static class CustomWinnerHolder
AdditionalWinnerTeams = [];
WinnerRoles = [];
WinnerIds = [];
+ Logger.Info("Reset", "CustomWinnerHolder");
}
public static void ClearWinners()
{
WinnerRoles.Clear();
WinnerIds.Clear();
+ Logger.Info("ClearWinners", "CustomWinnerHolder");
}
/// Assign a value to WinnerTeam. Add to AdditionalWinnerTeams if already assigned.
@@ -41,6 +43,7 @@ public static class CustomWinnerHolder
{
if (WinnerTeam == CustomWinner.Default) WinnerTeam = winner;
else AdditionalWinnerTeams.Add((AdditionalWinners)winner);
+ Logger.Info($"WinnerTeam: {WinnerTeam}, AdditionalWinnerTeams: {string.Join(", ", AdditionalWinnerTeams)}", "CustomWinnerHolder.SetWinnerOrAdditonalWinner");
}
/// Assign a value to WinnerTeam. If it is already assigned, add the existing value to AdditionalWinnerTeams and then assign it.
@@ -49,6 +52,7 @@ public static class CustomWinnerHolder
if (WinnerTeam != CustomWinner.Default)
AdditionalWinnerTeams.Add((AdditionalWinners)WinnerTeam);
WinnerTeam = winner;
+ Logger.Info($"WinnerTeam: {WinnerTeam}, AdditionalWinnerTeams: {string.Join(", ", AdditionalWinnerTeams)}", "CustomWinnerHolder.ShiftWinnerAndSetWinner");
}
/// Delete any existing values and then assign the values to WinnerTeam.
@@ -56,6 +60,7 @@ public static class CustomWinnerHolder
{
Reset();
WinnerTeam = winner;
+ Logger.Info($"WinnerTeam: {WinnerTeam}", "CustomWinnerHolder.ResetAndSetWinner");
}
public static MessageWriter WriteTo(MessageWriter writer)
diff --git a/Patches/AirShipElectricalDoors.cs b/Patches/AirShipElectricalDoors.cs
index a631ffb3d..eaedbda3a 100644
--- a/Patches/AirShipElectricalDoors.cs
+++ b/Patches/AirShipElectricalDoors.cs
@@ -3,7 +3,7 @@ using HarmonyLib;
namespace EHR;
-public class AirshipElectricalDoors
+public static class AirshipElectricalDoors
{
private static ElectricalDoors Instance
=> ShipStatus.Instance.Systems[SystemTypes.Decontamination].Cast();
@@ -42,7 +42,7 @@ public class AirshipElectricalDoors
}
[HarmonyPatch(typeof(ElectricalDoors), nameof(ElectricalDoors.Initialize))]
-class ElectricalDoorsInitializePatch
+static class ElectricalDoorsInitializePatch
{
public static void Postfix( /*ElectricalDoors __instance*/)
{
diff --git a/Patches/AirshipStatus.cs b/Patches/AirshipStatus.cs
index 71ccbc3ad..a9e533054 100644
--- a/Patches/AirshipStatus.cs
+++ b/Patches/AirshipStatus.cs
@@ -8,6 +8,6 @@ public static class AirshipStatusPrespawnStepPatch
{
public static bool Prefix()
{
- return !PlayerControl.LocalPlayer.Is(CustomRoles.GM); // GMは湧き画面をスキップ
+ return !PlayerControl.LocalPlayer.Is(CustomRoles.GM);
}
}
\ No newline at end of file
diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs
index f2c923119..971233486 100644
--- a/Patches/CheckGameEndPatch.cs
+++ b/Patches/CheckGameEndPatch.cs
@@ -411,6 +411,8 @@ static class GameEndChecker
{
reason = GameOverReason.ImpostorByKill;
+ if (Main.HasJustStarted) return false;
+
PlayerControl[] aapc = Main.AllAlivePlayerControls;
if (CustomRoles.Sunnyboy.RoleExist() && aapc.Length > 1) return false;
@@ -486,6 +488,7 @@ static class GameEndChecker
}
else return false;
+ Logger.Info($"Crew: {Crew}, Imp: {Imp}", "CheckGameEndPatch.CheckGameEndByLivingPlayers");
ResetAndSetWinner((CustomWinner)winner);
return true;
}
diff --git a/Patches/ClientOptionsPatch.cs b/Patches/ClientOptionsPatch.cs
index 17f467627..2bc8d8974 100644
--- a/Patches/ClientOptionsPatch.cs
+++ b/Patches/ClientOptionsPatch.cs
@@ -39,7 +39,15 @@ public static class OptionsMenuBehaviourStartPatch
if (GM == null || GM.ToggleButton == null)
{
- GM = ClientOptionItem.Create("GM", Main.GM, __instance);
+ GM = ClientOptionItem.Create("GM", Main.GM, __instance, GMButtonToggle);
+
+ static void GMButtonToggle()
+ {
+ if (Main.GM.Value)
+ {
+ HudManager.Instance.ShowPopUp(Translator.GetString("EnabledGMWarning"));
+ }
+ }
}
if (UnlockFPS == null || UnlockFPS.ToggleButton == null)
diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs
index ecfbf33e0..3e1d80be8 100644
--- a/Patches/HudPatch.cs
+++ b/Patches/HudPatch.cs
@@ -232,7 +232,7 @@ static class HudManagerPatch
break;
}
- if (role.PetActivatedAbility() && Options.CurrentGameMode == CustomGameMode.Standard)
+ if (role.PetActivatedAbility() && Options.CurrentGameMode == CustomGameMode.Standard && !player.GetCustomSubRoles().Any(StartGameHostPatch.BasisChangingAddons.ContainsKey))
__instance.AbilityButton?.Hide();
if (LowerInfoText == null)
diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs
index ac0bdeda4..0b3541b16 100644
--- a/Patches/IntroPatch.cs
+++ b/Patches/IntroPatch.cs
@@ -895,11 +895,13 @@ static class IntroCutsceneDestroyPatch
LateTask.New(() => aapc.Do(x => x.CheckAndSetUnshiftState()), 2f, "UnshiftTrigger SS");
}
- if (Main.GM.Value)
+ if (Main.GM.Value && lp.Is(CustomRoles.GM))
{
- lp.RpcExile();
- lp.RpcSetCustomRole(CustomRoles.GM);
- Main.PlayerStates[lp.PlayerId].SetDead();
+ LateTask.New(() =>
+ {
+ lp.RpcExile();
+ Main.PlayerStates[lp.PlayerId].SetDead();
+ }, 1f, "Set GM Dead");
}
if (Options.RandomSpawn.GetBool())
diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs
index 8aa67091d..475030f3c 100644
--- a/Patches/MeetingHudPatch.cs
+++ b/Patches/MeetingHudPatch.cs
@@ -87,6 +87,7 @@ static class CheckForEndVotingPatch
pva.UnsetVote();
__instance.RpcClearVote(pc.GetClientId());
__instance.UpdateButtons();
+ pva.VotedFor = byte.MaxValue;
}
else if (voteTarget != null && !pc.GetCustomRole().CancelsVote())
Main.PlayerStates[pc.PlayerId].Role.OnVote(pc, voteTarget);
@@ -1174,12 +1175,14 @@ static class MeetingHudCastVotePatch
__instance.RpcClearVote(pc_src.GetClientId());
+ pva_src.VotedFor = byte.MaxValue;
+
ShouldCancelVoteList.Remove(srcPlayerId);
}
}
[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.CmdCastVote))]
-class MeetingHudCmdCastVotePatch
+static class MeetingHudCmdCastVotePatch
{
public static bool Prefix(MeetingHud __instance, [HarmonyArgument(0)] byte srcPlayerId, [HarmonyArgument(1)] byte suspectPlayerId)
{
diff --git a/Patches/ServerVersionPatch.cs b/Patches/ServerVersionPatch.cs
index 2e3124a98..68cff892d 100644
--- a/Patches/ServerVersionPatch.cs
+++ b/Patches/ServerVersionPatch.cs
@@ -3,14 +3,15 @@
namespace EHR.Patches;
[HarmonyPatch(typeof(Constants), nameof(Constants.GetBroadcastVersion))]
-class ServerUpdatePatch
+static class ServerUpdatePatch
{
- static void Postfix(ref int __result)
+ public static void Postfix(ref int __result)
{
if (GameStates.IsLocalGame)
{
Logger.Info($"IsLocalGame: {__result}", "VersionServer");
}
+
if (GameStates.IsOnlineGame)
{
// Changing server version for AU mods
diff --git a/Patches/UsablesPatch.cs b/Patches/UsablesPatch.cs
index 796ae2b58..6ba5199ae 100644
--- a/Patches/UsablesPatch.cs
+++ b/Patches/UsablesPatch.cs
@@ -11,7 +11,7 @@ static class CanUsePatch
{
canUse = couldUse = false;
// Even if you return this with false, usable items other than tasks will remain usable (buttons, etc.)
- if (Main.GM.Value && GameStates.InGame) return false;
+ if (Main.GM.Value && AmongUsClient.Instance.AmHost && GameStates.InGame) return false;
var lp = PlayerControl.LocalPlayer;
return __instance.AllowImpostor || (Utils.HasTasks(lp.Data, false) && (!lp.Is(CustomRoles.Wizard) || HasTasksAsWizard()));
diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json
index e7ef86908..8791a4d39 100644
--- a/Resources/Lang/en_US.json
+++ b/Resources/Lang/en_US.json
@@ -2186,6 +2186,7 @@
"Warning.NoModHost": "EHR is not installed on the host",
"Warning.MismatchedVersion": "{0} has a different version than {1}",
"Warning.AutoExitAtMismatchedVersion": "The host has no or a different version of {0}\\nYou will be kicked in {1}",
+ "EnabledGMWarning": "You have enabled Game Master. This will make you a ghost at the start of every game. Due to an unknown issue, games may end with the 'Everyone died' reason instantly, if this happens, please disable Game Master.",
"Commands.NoAccess": "You don't have access to this command or cannot use it currently",
"CommandDescription.LT": "View the lobby timer",
"CommandDescription.Dump": "Dumps the log file to the desktop",