diff --git a/GameMode/FFAManager.cs b/GameMode/FFAManager.cs index be9bbad10..c58e99a73 100644 --- a/GameMode/FFAManager.cs +++ b/GameMode/FFAManager.cs @@ -52,8 +52,6 @@ internal static class FFAManager public static OptionItem FFATeamMode; public static OptionItem FFATeamNumber; - public static Dictionary NameNotify = []; - public static void SetupCustomOption() { FFAGameTime = new IntegerOptionItem(67_223_001, "FFA_GameTime", new(30, 600, 10), 300, TabGroup.GameSettings) @@ -151,26 +149,17 @@ internal static class FFAManager } } - LateTask.New(() => { Utils.NotifyRoles(NoCache: true, ForceLoop: true); }, 10f, log: false); + LateTask.New(() => Utils.NotifyRoles(NoCache: true, ForceLoop: true), 10f, log: false); } } - public static void GetNameNotify(PlayerControl player, ref string name) - { - if (Options.CurrentGameMode != CustomGameMode.FFA || player == null) return; - if (NameNotify.TryGetValue(player.PlayerId, out (string TEXT, long TIMESTAMP) value)) - { - name = value.TEXT; - } - } - - public static int GetRankOfScore(byte playerId) + public static int GetRankFromScore(byte playerId) { try { int ms = KillCount[playerId]; int rank = 1 + KillCount.Values.Count(x => x > ms); - rank += KillCount.Where(x => x.Value == ms).ToList().IndexOf(new(playerId, ms)); + rank += KillCount.Where(x => x.Value == ms).Select(x => x.Key).ToList().IndexOf(playerId); // In the old version, the struct 'KeyValuePair' was checked for equality using the inefficient runtime-provided implementation return rank; } catch @@ -397,12 +386,6 @@ internal static class FFAManager RoundTime--; - foreach (var pc in Main.AllPlayerControls.Where(pc => NameNotify.TryGetValue(pc.PlayerId, out var nn) && nn.TIMESTAMP < now).ToArray()) - { - NameNotify.Remove(pc.PlayerId); - Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc); - } - var rd = IRandom.Instance; byte FFAdoTPdecider = (byte)rd.Next(0, 100); bool FFAdoTP = FFAdoTPdecider == 0; diff --git a/GameMode/RoomRush.cs b/GameMode/RoomRush.cs index d47bcbc46..dd6644b6e 100644 --- a/GameMode/RoomRush.cs +++ b/GameMode/RoomRush.cs @@ -210,8 +210,19 @@ namespace EHR private static void StartNewRound(bool initial = false) { + SystemTypes previous = !initial + ? RoomGoal + : Main.CurrentMap switch + { + MapNames.Skeld => SystemTypes.Cafeteria, + MapNames.Mira => SystemTypes.Launchpad, + MapNames.Dleks => SystemTypes.Cafeteria, + MapNames.Polus => SystemTypes.Dropship, + MapNames.Airship => SystemTypes.MainHall, + MapNames.Fungle => SystemTypes.Dropship, + _ => throw new ArgumentOutOfRangeException(Main.CurrentMap.ToString(), "Invalid map") + }; DonePlayers.Clear(); - SystemTypes previous = RoomGoal; RoomGoal = AllRooms.Without(previous).RandomElement(); Vector2 goalPos = Map.Positions.GetValueOrDefault(RoomGoal, RoomGoal.GetRoomClass().transform.position); Vector2 previousPos = Map.Positions.GetValueOrDefault(previous, initial ? Main.AllAlivePlayerControls.RandomElement().Pos() : previous.GetRoomClass().transform.position); diff --git a/Modules/Camouflague.cs b/Modules/Camouflague.cs index 3c337d3b0..2a9be7902 100644 --- a/Modules/Camouflague.cs +++ b/Modules/Camouflague.cs @@ -42,7 +42,7 @@ public static class Camouflage public static bool BlockCamouflage; public static Dictionary PlayerSkins = []; public static List ResetSkinAfterDeathPlayers = []; - public static HashSet WaitingForSkinChange = []; + private static HashSet WaitingForSkinChange = []; public static void Init() { diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index 08098876a..d402b0496 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -330,7 +330,7 @@ internal static class CustomRolesHelper CustomRoles.Venter => CustomRoles.Impostor, CustomRoles.Agent => CustomRoles.Impostor, CustomRoles.Taskinator => CustomRoles.Crewmate, - + // Room Rush CustomRoles.RRPlayer => CustomRoles.Crewmate, @@ -1174,6 +1174,7 @@ internal static class CustomRolesHelper CustomRoles.Technician => RoleOptionType.Neutral_Benign, CustomRoles.Tank => RoleOptionType.Neutral_Benign, CustomRoles.Totocalcio => RoleOptionType.Neutral_Benign, + CustomRoles.Arsonist => RoleOptionType.Neutral_Evil, CustomRoles.Jester => RoleOptionType.Neutral_Evil, CustomRoles.Gaslighter => RoleOptionType.Neutral_Evil, CustomRoles.God => RoleOptionType.Neutral_Evil, diff --git a/Modules/DevManager.cs b/Modules/DevManager.cs index ea1f57aa3..5cc238b1e 100644 --- a/Modules/DevManager.cs +++ b/Modules/DevManager.cs @@ -29,16 +29,16 @@ public static class DevManager [ // Dev new(code: "actorour#0029", color: "#ffc0cb", tag: "TOHE/TONX Developer", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "KARPED1EM"), - new(code: "pinklaze#1776", color: null, tag: "null", isUp: true, isDev: true, deBug: true, colorCmd: false, upName: "NCSIMON"), - new(code: "keepchirpy#6354", color: "#1FF3C6", tag: "TOHE Developer", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "TommyXL"), //Tommy-XL + new(code: "pinklaze#1776", color: null, tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "NCSIMON"), + new(code: "keepchirpy#6354", color: "#1FF3C6", tag: "TOHEN Developer", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "TommyXL"), //Tommy-XL new(code: "motelchief#4112", color: "#eb57af", tag: "Twilight Raven", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "Drakos"), //Drakos new(code: "eagergaol#1562", color: "#5534eb", tag: "Drakos Alt", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "Drakos"), //Drakos Steam Alt - new(code: "timedapper#9496", color: null, tag: null, isUp: false, isDev: true, deBug: false, colorCmd: false, upName: null), //阿龍 - new(code: "sofaagile#3120", color: "null", tag: "null", isUp: false, isDev: true, deBug: true, colorCmd: false, upName: null), //天寸 - new(code: "keyscreech#2151", color: "null", tag: null, isUp: false, isDev: true, deBug: false, upName: null), //Endrmen40409 + new(code: "timedapper#9496", color: null, tag: null, isUp: false, isDev: false, deBug: false, colorCmd: false, upName: null), //阿龍 + new(code: "sofaagile#3120", color: "null", tag: "null", isUp: false, isDev: false, deBug: false, colorCmd: false, upName: null), //天寸 + new(code: "keyscreech#2151", color: "null", tag: null, isUp: false, isDev: false, deBug: false, upName: null), //Endrmen40409 // Up - new(code: "primether#5348", color: "null", tag: "YouTuber/Streamer", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "AnonWorks"), + new(code: "primether#5348", color: "null", tag: "YouTuber/Streamer", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "AnonWorks"), new(code: "truantwarm#9165", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "萧暮不姓萧"), new(code: "drilldinky#1386", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "爱玩AU的河豚"), new(code: "farardour#6818", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "-提米SaMa-"), @@ -54,19 +54,18 @@ public static class DevManager new(code: "storkfey#3570", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Calypso"), new(code: "fellowsand#1003", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "C-Faust"), new(code: "jetsafe#8512", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Hoream是好人"), - new(code: "primether#5348", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "AnonWorks"), new(code: "spoonkey#0792", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "没好康的"), new(code: "beakedmire#6099", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "茄-au"), new(code: "doggedsize#7892", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "TronAndRey"), - new(code: "openlanded#9533", color: "#9e2424", tag: "God Of Death Love Apples", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "ryuk"), - new(code: "unlikecity#4086", color: "#eD2F91", tag: "Ward", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Ward"), - new(code: "iconicdrop#2727", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "jackler"), + new(code: "openlanded#9533", color: "#9e2424", tag: "God Of Death Love Apples", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "ryuk"), + new(code: "unlikecity#4086", color: "#eD2F91", tag: "Ward", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Ward"), + new(code: "iconicdrop#2727", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "jackler"), new(code: "goneria#8334", color: "#FFFF00", tag: "The Dev on Phone", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"), // Me on phone new(code: "neatnet#5851", color: "#FFFF00", tag: "[Developer] The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"), new(code: "contenthue#0404", color: "#FFFF00", tag: "[Developer] The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "[Developer] The 200IQ guy"), - new(code: "theseform#5686", color: "null", tag: "PTBR-Translator/Role Idea Creator", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Role idea creator"), + new(code: "theseform#5686", color: "null", tag: "PTBR-Translator/Role Idea Creator", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Tomix"), new(code: "heavyclod#2286", color: "#FFFF00", tag: "小叨.exe已停止运行", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "小叨院长"), new(code: "storeroan#0331", color: "#FF0066", tag: "Night_瓜", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Night_瓜"), new(code: "teamelder#5856", color: "#1379bf", tag: "屑Slok(没信誉的鸽子)", isUp: true, isDev: false, colorCmd: false, deBug: false, upName: "Slok7565"), @@ -111,6 +110,8 @@ public static class DevManager new(code: "pagersane#4064", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Bluejava3"), new(code: "pocketdoor#9080", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Imnot"), new(code: "motorstack#2287", color: "#E34234", tag: "Foxfire", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Esrazraft"), + new(code: "luckyframe#0173", color: "#666DCD", tag: "SUS Detector", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "[Blank]"), + new(code: "numbsett#3800", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Shoyo"), // Sponsor new(code: "recentduct#6068", color: "#FF00FF", tag: "高冷男模法师", isUp: false, isDev: false, colorCmd: false, deBug: true, upName: null), @@ -125,16 +126,12 @@ public static class DevManager new(code: "lordcosy#8966", color: "#FFD6EC", tag: "HostEHR", isUp: false, isDev: false, colorCmd: false, deBug: false, upName: null), //K new(code: "honestsofa#2870", color: "#D381D9", tag: "Discord: SolarFlare#0700", isUp: true, isDev: false, colorCmd: false, deBug: false, upName: "SolarFlare"), //SolarFlare new(code: "caseeast#7194", color: "#1c2451", tag: "disc.gg/maul", isUp: false, isDev: false, colorCmd: false, deBug: false, upName: null), //laikrai - // lol hi go away - //new(code: "gnuedaphic#7196", color: "#ffc0cb", tag: "TOH-RE Developer", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Loonie"), //Loonie - // Lauryn and Moe - new(code: "straymovie#6453", color: "#F6B05E", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Moe"), //Moe - new(code: "singlesign#1823", color: "#ffb6cd", tag: "Princess", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Lauryn"), //Lauryn + // Other - new(code: "peakcrown#8292", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: null), //Hakaka + new(code: "peakcrown#8292", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: null) //Hakaka ]; } - public static bool IsDevUser(this string code) => DevUserList.Any(x => x.Code == code); + private static bool IsDevUser(this string code) => DevUserList.Any(x => x.Code == code); public static DevUser GetDevUser(this string code) => code.IsDevUser() ? DevUserList.Find(x => x.Code == code) : DefaultDevUser; } \ No newline at end of file diff --git a/Modules/EAC.cs b/Modules/EAC.cs index 82914d593..e5f929882 100644 --- a/Modules/EAC.cs +++ b/Modules/EAC.cs @@ -706,7 +706,7 @@ static class CheckInvalidMovementPatch public static void Postfix(PlayerControl __instance) { - if (!GameStates.IsInTask || ExileController.Instance || !Options.EnableMovementChecking.GetBool() || Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod) >= 1.9f || AmongUsClient.Instance.Ping >= 300 || Options.CurrentGameMode == CustomGameMode.NaturalDisasters || Utils.GetRegionName() is not ("EU" or "NA" or "AS") || __instance == null || __instance.PlayerId == 255 || !__instance.IsAlive()) return; + if (!GameStates.IsInTask || ExileController.Instance || !Options.EnableMovementChecking.GetBool() || Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod) >= 1.9f || AmongUsClient.Instance.Ping >= 300 || Options.CurrentGameMode == CustomGameMode.NaturalDisasters || Utils.GetRegionName() is not ("EU" or "NA" or "AS") || __instance == null || __instance.PlayerId == 255 || !__instance.IsAlive() || __instance.inVent) return; var pos = __instance.Pos(); var now = Utils.TimeStamp; @@ -721,10 +721,10 @@ static class CheckInvalidMovementPatch SetCurrentData(); - if (ExemptedPlayers.Remove(__instance.PlayerId)) return; - if (Vector2.Distance(lastPosition, pos) > 10f && PhysicsHelpers.AnythingBetween(__instance.Collider, lastPosition, pos, Constants.ShipOnlyMask, false)) { + if (ExemptedPlayers.Remove(__instance.PlayerId)) return; + EAC.WarnHost(); EAC.Report(__instance, "This player is moving too fast, possibly using a speed hack."); } diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 845b597e6..e853ab66c 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -302,6 +302,8 @@ static class ExtendedPlayerControl player.RpcResetAbilityCooldown(); player.SyncGeneralOptions(); + if (Camouflage.IsCamouflage) Camouflage.RpcSetSkin(player); + NotifyRoles(SpecifySeer: player, NoCache: true); NotifyRoles(SpecifyTarget: player, NoCache: true); } diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index ae9c87b79..5c9e48c7d 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -457,6 +457,8 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS AURoleOptions.ProtectionDurationSeconds = 0f; AURoleOptions.ImpostorsCanSeeProtect = false; + Logger.Info($"Updated vision for {player.GetNameWithRole()}: Crew = {opt.GetFloat(FloatOptionNames.CrewLightMod)}, Impostor = {opt.GetFloat(FloatOptionNames.ImpostorLightMod)}", "BuildGameOptions"); + return opt; void SetMaxVision() diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index a7f0bc60b..502773f06 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -312,6 +312,7 @@ public static class GuessManager case CustomRoles.Pestilence: if (!isUI) Utils.SendMessage(GetString("GuessPestilence"), pc.PlayerId); else pc.ShowPopUp(GetString("GuessPestilence")); + if (DoubleShot.CheckGuess(pc, isUI)) return true; guesserSuicide = true; break; case CustomRoles.Phantasm: @@ -367,7 +368,11 @@ public static class GuessManager if (!isUI) Utils.SendMessage(GetString("GuessOnbound"), pc.PlayerId); else pc.ShowPopUp(GetString("GuessOnbound")); - if (Onbound.GuesserSuicides.GetBool()) guesserSuicide = true; + if (Onbound.GuesserSuicides.GetBool()) + { + if (DoubleShot.CheckGuess(pc, isUI)) return true; + guesserSuicide = true; + } else return true; } @@ -466,18 +471,14 @@ public static class GuessManager if (DoubleShot.CheckGuess(pc, isUI)) return true; guesserSuicide = true; } - else if (pc.Is(CustomRoles.NiceGuesser) && target.Is(CustomRoleTypes.Crewmate) && !Options.GGCanGuessCrew.GetBool() && !pc.Is(CustomRoles.Madmate)) + else if (pc.Is(CustomRoles.NiceGuesser) && target.IsCrewmate() && !Options.GGCanGuessCrew.GetBool() && !pc.Is(CustomRoles.Madmate)) { - if (DoubleShot.CheckGuess(pc, isUI)) return true; - if (!isUI) Utils.SendMessage(GetString("GuessCrewRole"), pc.PlayerId, Utils.ColorString(Color.cyan, GetString("MessageFromGurge44"))); else pc.ShowPopUp(Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")) + "\n" + GetString("GuessCrewRole")); return true; } - else if (pc.Is(CustomRoles.EvilGuesser) && target.Is(CustomRoleTypes.Impostor) && !Options.EGCanGuessImp.GetBool()) + else if (pc.Is(CustomRoles.EvilGuesser) && target.IsImpostor() && !Options.EGCanGuessImp.GetBool()) { - if (DoubleShot.CheckGuess(pc, isUI)) return true; - if (!isUI) Utils.SendMessage(GetString("GuessImpRole"), pc.PlayerId, Utils.ColorString(Color.cyan, GetString("MessageFromGurge44"))); else pc.ShowPopUp(Utils.ColorString(Color.cyan, GetString("MessageFromGurge44")) + "\n" + GetString("GuessImpRole")); return true; diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 9ff00f8b3..6355debbf 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1383,7 +1383,7 @@ public static class Utils break; case CustomGameMode.FFA: List<(int, byte)> list2 = []; - list2.AddRange(cloneRoles.Select(id => (FFAManager.GetRankOfScore(id), id))); + list2.AddRange(cloneRoles.Select(id => (FFAManager.GetRankFromScore(id), id))); list2.Sort(); foreach ((int, byte) id in list2) @@ -2130,7 +2130,6 @@ public static class Utils SelfName = $"{SelfTaskText}\r\n{SelfName}"; break; case CustomGameMode.FFA: - FFAManager.GetNameNotify(seer, ref SelfName); SelfName = $"{SelfTaskText}\r\n{SelfName}"; break; default: diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index d815417ee..2660007db 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -564,7 +564,7 @@ static class GameEndChecker if (FFAManager.RoundTime <= 0) { - var winner = Main.GM.Value && Main.AllPlayerControls.Length == 1 ? PlayerControl.LocalPlayer : Main.AllPlayerControls.Where(x => !x.Is(CustomRoles.GM) && x != null).OrderBy(x => FFAManager.GetRankOfScore(x.PlayerId)).First(); + var winner = Main.GM.Value && Main.AllPlayerControls.Length == 1 ? PlayerControl.LocalPlayer : Main.AllPlayerControls.Where(x => !x.Is(CustomRoles.GM) && x != null).OrderBy(x => FFAManager.GetRankFromScore(x.PlayerId)).First(); byte winnerId = winner.PlayerId; @@ -644,7 +644,7 @@ static class GameEndChecker } PlayerControl[] aapc = Main.AllAlivePlayerControls; - + if (aapc.Any(x => x.GetTaskState().IsTaskFinished)) { SetWinner(aapc.First(x => x.GetTaskState().IsTaskFinished)); @@ -774,7 +774,7 @@ static class GameEndChecker } } } - + class RoomRushGameEndPredicate : GameEndPredicate { public override bool CheckForEndGame(out GameOverReason reason) diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index c3ca842e3..6f9a67220 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -671,7 +671,7 @@ static class TaskPanelBehaviourPatch case CustomGameMode.FFA: - AllText += Main.PlayerStates.Keys.OrderBy(FFAManager.GetRankOfScore).Aggregate("", (s, x) => $"{s}\r\n{FFAManager.GetRankOfScore(x)}. {x.ColoredPlayerName()} -{string.Format(GetString("KillCount"), FFAManager.KillCount.GetValueOrDefault(x, 0))}"); + AllText += Main.PlayerStates.Keys.OrderBy(FFAManager.GetRankFromScore).Aggregate("", (s, x) => $"{s}\r\n{FFAManager.GetRankFromScore(x)}. {x.ColoredPlayerName()} -{string.Format(GetString("KillCount"), FFAManager.KillCount.GetValueOrDefault(x, 0))}"); AllText += ""; break; @@ -764,7 +764,7 @@ static class TaskPanelBehaviourPatch AllText += ""; break; - + case CustomGameMode.RoomRush: AllText += Main.AllPlayerControls diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 793bd56fa..36018e336 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -417,7 +417,7 @@ internal static class StartGameHostPatch while (true) { bool stopWaiting = true; - int maxTimer = GameOptionsManager.Instance.CurrentGameOptions.MapId is 5 or 4 ? 20 : 15; + int maxTimer = GameOptionsManager.Instance.CurrentGameOptions.MapId is 5 or 4 ? 17 : 12; lock (AUClient.allClients) { // For loop is necessary, or else when a client times out, a foreach loop will throw: @@ -840,10 +840,10 @@ internal static class StartGameHostPatch if ((MapNames)Main.NormalOptions.MapId == MapNames.Airship && AmongUsClient.Instance.AmHost && Main.GM.Value) { - LateTask.New(() => { PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8)); }, 15f, "GM Auto-TP Failsafe"); // TP to Main Hall + LateTask.New(() => PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8)), 15f, "GM Auto-TP Failsafe"); // TP to Main Hall } - LateTask.New(() => { Main.HasJustStarted = false; }, 10f, "HasJustStarted to false"); + LateTask.New(() => Main.HasJustStarted = false, 12f, "HasJustStarted to false"); } catch (Exception ex) { diff --git a/Patches/OutroPatch.cs b/Patches/OutroPatch.cs index 8b220e076..788b90aad 100644 --- a/Patches/OutroPatch.cs +++ b/Patches/OutroPatch.cs @@ -430,7 +430,7 @@ class SetEverythingUpPatch case CustomGameMode.FFA: { List<(int, byte)> list = []; - list.AddRange(cloneRoles.Select(id => (FFAManager.GetRankOfScore(id), id))); + list.AddRange(cloneRoles.Select(id => (FFAManager.GetRankFromScore(id), id))); list.Sort(); foreach (var id in list.Where(x => EndGamePatch.SummaryText.ContainsKey(x.Item2))) diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 369362939..ad80f00cd 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -1171,7 +1171,7 @@ static class FixedUpdatePatch public static void Postfix(PlayerControl __instance) { if (__instance == null || __instance.PlayerId == 255) return; - + if (__instance.PlayerId == PlayerControl.LocalPlayer.PlayerId) CustomNetObject.FixedUpdate(); @@ -1260,6 +1260,7 @@ static class FixedUpdatePatch ThrowException(ex); LastErrorTS = now; } + Logger.Error($"Error for {__instance.GetNameWithRole()}: {ex}", "FixedUpdatePatch"); } } @@ -1487,7 +1488,7 @@ static class FixedUpdatePatch RoleText.enabled = false; return; } - + bool shouldSeeTargetAddons = playerId == lpId || new[] { PlayerControl.LocalPlayer, player }.All(x => x.Is(Team.Impostor)); var RoleTextData = GetRoleText(lpId, playerId, seeTargetBetrayalAddons: shouldSeeTargetAddons); @@ -1555,7 +1556,6 @@ static class FixedUpdatePatch SoloKombatManager.GetNameNotify(target, ref RealName); break; case CustomGameMode.FFA: - FFAManager.GetNameNotify(target, ref RealName); break; } @@ -1957,6 +1957,8 @@ static class CoEnterVentPatch Main.KillTimers[__instance.myPlayer.PlayerId] = timer + 0.5f; } + CheckInvalidMovementPatch.ExemptedPlayers.Add(__instance.myPlayer.PlayerId); + switch (Options.CurrentGameMode) { case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2: diff --git a/Resources/Loading.gif b/Resources/Loading.gif deleted file mode 100644 index 7dfdd7082..000000000 Binary files a/Resources/Loading.gif and /dev/null differ diff --git a/Roles/Crewmate/Wizard.cs b/Roles/Crewmate/Wizard.cs index 97bdcbdb2..3a2bb0c3b 100644 --- a/Roles/Crewmate/Wizard.cs +++ b/Roles/Crewmate/Wizard.cs @@ -179,11 +179,15 @@ namespace EHR.Crewmate switch (TaskMode) { - case true when pc.GetAbilityUseLimit() >= 1 || pc.GetTaskState().IsTaskFinished: + case true when (pc.GetAbilityUseLimit() >= 1 || pc.GetTaskState().IsTaskFinished) && pc.IsAlive(): pc.RpcChangeRoleBasis(CustomRoles.Wizard); TaskMode = false; break; - case false when pc.GetAbilityUseLimit() < 1 || !pc.IsAlive(): + case false when !pc.IsAlive(): + pc.RpcSetRoleDesync(RoleTypes.CrewmateGhost, pc.GetClientId()); + TaskMode = true; + break; + case false when pc.GetAbilityUseLimit() < 1 && pc.IsAlive(): pc.RpcChangeRoleBasis(CustomRoles.CrewmateEHR); pc.Notify(Translator.GetString("OutOfAbilityUsesDoMoreTasks")); TaskMode = true;