some fixes

This commit is contained in:
Gurge44 committed 2024-10-27 10:47:59 +01:00
1 parent d84e8f019e
commit b870a12c62
11 files changed
+36 -13

No files matched your search

+5
View File
@@ -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");
}
/// <summary><para>Assign a value to WinnerTeam. </para><para>Add to AdditionalWinnerTeams if already assigned.</para></summary>
@@ -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");
}
/// <summary><para>Assign a value to WinnerTeam. </para><para>If it is already assigned, add the existing value to AdditionalWinnerTeams and then assign it.</para></summary>
@@ -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");
}
/// <summary><para>Delete any existing values and then assign the values to WinnerTeam.</para></summary>
@@ -56,6 +60,7 @@ public static class CustomWinnerHolder
{
Reset();
WinnerTeam = winner;
Logger.Info($"WinnerTeam: {WinnerTeam}", "CustomWinnerHolder.ResetAndSetWinner");
}
public static MessageWriter WriteTo(MessageWriter writer)
+2 -2
View File
@@ -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<ElectricalDoors>();
@@ -42,7 +42,7 @@ public class AirshipElectricalDoors
}
[HarmonyPatch(typeof(ElectricalDoors), nameof(ElectricalDoors.Initialize))]
class ElectricalDoorsInitializePatch
static class ElectricalDoorsInitializePatch
{
public static void Postfix( /*ElectricalDoors __instance*/)
{
+1 -1
View File
@@ -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);
}
}
+3
View File
@@ -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;
}
+9 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+6 -4
View File
@@ -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())
+4 -1
View File
@@ -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)
{
+3 -2
View File
@@ -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
+1 -1
View File
@@ -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()));
+1
View File
@@ -2186,6 +2186,7 @@
"Warning.NoModHost": "EHR is not installed on the host",
"Warning.MismatchedVersion": "<b>{0}</b> has a different version than <b>{1}</b>",
"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",