From: gendelo3 Date: Fri, 31 Mar 2023 13:38:25 +0000 (+0200) Subject: Update 4.3.1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=af353e83daa87a552aaa6dce5ff30b9f0d4b99f4;p=rhonda%2Ftheotherroles.git Update 4.3.1 --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ef5f68..bd61d49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,3 +36,4 @@ jobs: with: name: TheOtherRoles.dll path: TheOtherRoles/bin/Release/net6.0/TheOtherRoles.dll + diff --git a/README.md b/README.md index cdfd156..5b3507b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein # Releases | Among Us - Version| Mod Version | Link | |----------|-------------|-----------------| -| 2023.2.28s| v4.3.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.0/TheOtherRoles.zip) +| 2023.03.28s| v4.3.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.1/TheOtherRoles.zip) +| 2023.02.28s| v4.3.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.0/TheOtherRoles.zip) | 2022.12.14s| v4.2.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.2.1/TheOtherRoles.zip)
Click to show older versions @@ -121,6 +122,20 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
Click to show the Changelog +**Version 4.3.1** +- Update to Among Us 2023.3.28 +- Added new options (Information mode - Chat/Map/Both, Roles - Evil Killing / Evil) to the snitch and fixed bugs affecting the snitch +- Changed the maximum amount per modifier to 15 (where applicable) +- Changed the colorblind text and player name to be behind certain objects again (rock on Polus etc.) +- Fixed a bug where a sidekicked bomber would not lose the bomber role +- Fixed a bug where enabled vanilla roles would be assigned even if "block vanilla roles" was turned on +- Fixed several Bugs in both Hide N Seek modes (should be playable again) +- Fixed a bug where Trickster JackInTheBoxes could sometimes not be used if they were placed behind objects +- Fixed a bug where the cosmetics of an invisible Ninja became visible when the camouflage ended +- Fixed a bug where the mini would show a "jump" in age at the end of a meeting due to the time spent in cutscenes +- Fixed a bug where the mayor would always have the mobile emergency button, no matter which setting was selected + + **Version 4.3.0** - Updated to Among Us version 2023.2.28 - Added a new role: [Bomber](#bomber) @@ -1597,6 +1612,8 @@ When the Snitch only has a configurable amount of tasks left, it will be reveale |----------|:-------------:| | Snitch Spawn Chance | - | Task Count Where The Snitch Will Be Revealed | - +| Information Mode | Whether the snitch will get info on the map and/or in the chat +| Targets | Snitch Will See All Evil Players or Killing Evil Players ----------------------- ## Spy diff --git a/TheOtherRoles/Buttons.cs b/TheOtherRoles/Buttons.cs index 41e73b4..72cc7a8 100644 --- a/TheOtherRoles/Buttons.cs +++ b/TheOtherRoles/Buttons.cs @@ -64,7 +64,7 @@ namespace TheOtherRoles private static CustomButton huntedShieldButton; public static Dictionary> deputyHandcuffedButtons = null; - public static PoolablePlayer morphTargetDisplay; + public static PoolablePlayer targetDisplay; public static TMPro.TMP_Text securityGuardButtonScrewsText; public static TMPro.TMP_Text securityGuardChargesText; @@ -236,6 +236,30 @@ namespace TheOtherRoles } } + private static void setButtonTargetDisplay(PlayerControl target, CustomButton button = null, Vector3? offset=null) { + if (target == null || button == null) { + if (targetDisplay != null) { // Reset the poolable player + targetDisplay.gameObject.SetActive(false); + GameObject.Destroy(targetDisplay.gameObject); + targetDisplay = null; + } + return; + } + // Add poolable player to the button so that the target outfit is shown + button.actionButton.cooldownTimerText.transform.localPosition = new Vector3(0, 0, -1f); // Before the poolable player + targetDisplay = UnityEngine.Object.Instantiate(Patches.IntroCutsceneOnDestroyPatch.playerPrefab, button.actionButton.transform); + GameData.PlayerInfo data = target.Data; + target.SetPlayerMaterialColors(targetDisplay.cosmetics.currentBodySprite.BodySprite); + targetDisplay.SetSkin(data.DefaultOutfit.SkinId, data.DefaultOutfit.ColorId); + targetDisplay.SetHat(data.DefaultOutfit.HatId, data.DefaultOutfit.ColorId); + targetDisplay.cosmetics.nameText.text = ""; // Hide the name! + targetDisplay.transform.localPosition = new Vector3(0f, 0.22f, -0.01f); + if (offset != null) targetDisplay.transform.localPosition += (Vector3)offset; + targetDisplay.transform.localScale = Vector3.one * 0.33f; + targetDisplay.setSemiTransparent(false); + targetDisplay.gameObject.SetActive(true); + } + public static void Postfix(HudManager __instance) { initialized = false; @@ -470,7 +494,7 @@ namespace TheOtherRoles RPCProcedure.setFutureShifted(Shifter.currentTarget.PlayerId); SoundEffectsManager.play("shifterShift"); }, - () => { return Shifter.shifter != null && Shifter.shifter == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, + () => { return Shifter.shifter != null && Shifter.shifter == CachedPlayer.LocalPlayer.PlayerControl && Shifter.futureShift == null && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Shifter.currentTarget && Shifter.futureShift == null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, () => { }, Shifter.getButtonSprite(), @@ -499,18 +523,7 @@ namespace TheOtherRoles SoundEffectsManager.play("morphlingSample"); // Add poolable player to the button so that the target outfit is shown - morphlingButton.actionButton.cooldownTimerText.transform.localPosition = new Vector3(0, 0, -1f); // Before the poolable player - morphTargetDisplay = UnityEngine.Object.Instantiate(Patches.IntroCutsceneOnDestroyPatch.playerPrefab, morphlingButton.actionButton.transform); - GameData.PlayerInfo data = Morphling.sampledTarget.Data; - Morphling.sampledTarget.SetPlayerMaterialColors(morphTargetDisplay.cosmetics.currentBodySprite.BodySprite); - morphTargetDisplay.SetSkin(data.DefaultOutfit.SkinId, data.DefaultOutfit.ColorId); - morphTargetDisplay.SetHat(data.DefaultOutfit.HatId, data.DefaultOutfit.ColorId); - // PlayerControl.SetPetImage(data.DefaultOutfit.PetId, data.DefaultOutfit.ColorId, morphTargetDisplay.PetSlot); - morphTargetDisplay.cosmetics.nameText.text = ""; // Hide the name! - morphTargetDisplay.transform.localPosition = new Vector3(0f, 0.22f, -0.01f); - morphTargetDisplay.transform.localScale = Vector3.one * 0.33f; - morphTargetDisplay.setSemiTransparent(false); - morphTargetDisplay.gameObject.SetActive(true); + setButtonTargetDisplay(Morphling.sampledTarget, morphlingButton); } }, () => { return Morphling.morphling != null && Morphling.morphling == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, @@ -521,11 +534,7 @@ namespace TheOtherRoles morphlingButton.isEffectActive = false; morphlingButton.actionButton.cooldownTimerText.color = Palette.EnabledColor; Morphling.sampledTarget = null; - if (morphTargetDisplay != null) { // Reset the poolable player - morphTargetDisplay.gameObject.SetActive(false); - GameObject.Destroy(morphTargetDisplay.gameObject); - morphTargetDisplay = null; - } + setButtonTargetDisplay(null); }, Morphling.getSampleSprite(), CustomButton.ButtonPositions.upperRowLeft, @@ -540,9 +549,7 @@ namespace TheOtherRoles SoundEffectsManager.play("morphlingMorph"); // Reset the poolable player - morphTargetDisplay.gameObject.SetActive(false); - GameObject.Destroy(morphTargetDisplay.gameObject); - morphTargetDisplay = null; + setButtonTargetDisplay(null); } } ); @@ -1680,7 +1687,7 @@ namespace TheOtherRoles AmongUsClient.Instance.FinishRpcImmediately(writer); mayorMeetingButton.Timer = 1f; }, - () => { return Mayor.mayor != null && Mayor.mayor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead; }, + () => { return Mayor.mayor != null && Mayor.mayor == CachedPlayer.LocalPlayer.PlayerControl && !CachedPlayer.LocalPlayer.Data.IsDead && Mayor.meetingButton; }, () => { mayorMeetingButton.actionButton.OverrideText("Emergency ("+ Mayor.remoteMeetingsLeft + ")"); bool sabotageActive = false; @@ -1772,7 +1779,12 @@ namespace TheOtherRoles () => { defuseButton.HasEffect = true; }, - () => { return Bomber.bomb != null && Bomb.canDefuse && !CachedPlayer.LocalPlayer.Data.IsDead; }, + () => { + if (shifterShiftButton.HasButton()) + defuseButton.PositionOffset = new Vector3(0f, 2f, 0f); + else + defuseButton.PositionOffset = new Vector3(0f, 1f, 0f); + return Bomber.bomb != null && Bomb.canDefuse && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { if (defuseButton.isEffectActive && !Bomb.canDefuse) { defuseButton.Timer = 0f; @@ -1785,7 +1797,7 @@ namespace TheOtherRoles defuseButton.isEffectActive = false; }, Bomb.getDefuseSprite(), - new Vector3(1f, 1f, 0), + new Vector3(0f, 1f, 0), __instance, null, true, @@ -1838,9 +1850,6 @@ namespace TheOtherRoles AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.uncheckedMurderPlayer(thief.PlayerId, target.PlayerId, byte.MaxValue); } - - - }, () => { return Thief.thief != null && CachedPlayer.LocalPlayer.PlayerControl == Thief.thief && !CachedPlayer.LocalPlayer.Data.IsDead; }, () => { return Thief.currentTarget != null && CachedPlayer.LocalPlayer.PlayerControl.CanMove; }, @@ -1894,7 +1903,7 @@ namespace TheOtherRoles hunterLighterButton.actionButton.graphic.color = Palette.EnabledColor; }, Hunter.getLightSprite(), - CustomButton.ButtonPositions.upperRowCenter, + CustomButton.ButtonPositions.upperRowFarLeft, __instance, KeyCode.F, true, diff --git a/TheOtherRoles/CustomGameModes/HideNSeekGM.cs b/TheOtherRoles/CustomGameModes/HideNSeekGM.cs index 1a597ef..0908fd3 100644 --- a/TheOtherRoles/CustomGameModes/HideNSeekGM.cs +++ b/TheOtherRoles/CustomGameModes/HideNSeekGM.cs @@ -75,22 +75,23 @@ namespace TheOtherRoles.CustomGameModes { public static float ArrowCooldown = 30f; public static float ArrowDuration = 5f; public static float ArrowPunish = 5f; - private static Sprite buttonSprite; + private static Sprite buttonSpriteLight; + private static Sprite buttonSpriteArrow; public static bool isLightActive (byte playerId) { return lightActive.Contains(playerId); } public static Sprite getArrowSprite() { - if (buttonSprite) return buttonSprite; - buttonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HideNSeekArrowButton.png", 115f); - return buttonSprite; + if (buttonSpriteArrow) return buttonSpriteArrow; + buttonSpriteArrow = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HideNSeekArrowButton.png", 115f); + return buttonSpriteArrow; } public static Sprite getLightSprite() { - if (buttonSprite) return buttonSprite; - buttonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.LighterButton.png", 115f); - return buttonSprite; + if (buttonSpriteLight) return buttonSpriteLight; + buttonSpriteLight = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.LighterButton.png", 115f); + return buttonSpriteLight; } public static void clearAndReload() { diff --git a/TheOtherRoles/CustomOptionHolder.cs b/TheOtherRoles/CustomOptionHolder.cs index bca9a45..0752809 100644 --- a/TheOtherRoles/CustomOptionHolder.cs +++ b/TheOtherRoles/CustomOptionHolder.cs @@ -6,7 +6,7 @@ using Types = TheOtherRoles.CustomOption.CustomOptionType; namespace TheOtherRoles { public class CustomOptionHolder { public static string[] rates = new string[]{"0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"}; - public static string[] ratesModifier = new string[]{"1", "2", "3"}; + public static string[] ratesModifier = new string[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; public static string[] presets = new string[]{"Preset 1", "Preset 2", "Random Preset Skeld", "Random Preset Mira HQ", "Random Preset Polus", "Random Preset Airship", "Random Preset Submerged" }; public static CustomOption presetSelection; @@ -22,6 +22,7 @@ namespace TheOtherRoles { public static CustomOption modifiersCountMax; public static CustomOption enableCodenameHorsemode; + public static CustomOption enableCodenameDisableHorses; public static CustomOption mafiaSpawnRate; public static CustomOption janitorCooldown; @@ -176,6 +177,8 @@ namespace TheOtherRoles { public static CustomOption snitchSpawnRate; public static CustomOption snitchLeftTasksForReveal; + public static CustomOption snitchMode; + public static CustomOption snitchTargets; public static CustomOption spySpawnRate; public static CustomOption spyCanDieToSheriff; @@ -376,7 +379,8 @@ namespace TheOtherRoles { presetSelection = CustomOption.Create(0, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Preset"), presets, null, true); activateRoles = CustomOption.Create(1, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Enable Mod Roles And Block Vanilla Roles"), true, null, true); - if (Utilities.EventUtility.canBeEnabled) enableCodenameHorsemode = CustomOption.Create(10423, Types.General, cs(Color.green, "Enable Codename Horse"), false, null, true); + if (Utilities.EventUtility.canBeEnabled) enableCodenameHorsemode = CustomOption.Create(10423, Types.General, cs(Color.green, "Enable Codename Horsemode"), true, null, true); + if (Utilities.EventUtility.canBeEnabled) enableCodenameDisableHorses = CustomOption.Create(10424, Types.General, cs(Color.green, "Disable Horses"), false, enableCodenameHorsemode, false); // Using new id's for the options to not break compatibilty with older versions crewmateRolesCountMin = CustomOption.Create(300, Types.General, cs(new Color(204f / 255f, 204f / 255f, 0, 1f), "Minimum Crewmate Roles"), 15f, 0f, 15f, 1f, null, true); @@ -572,6 +576,8 @@ namespace TheOtherRoles { snitchSpawnRate = CustomOption.Create(210, Types.Crewmate, cs(Snitch.color, "Snitch"), rates, null, true); snitchLeftTasksForReveal = CustomOption.Create(219, Types.Crewmate, "Task Count Where The Snitch Will Be Revealed", 5f, 0f, 25f, 1f, snitchSpawnRate); + snitchMode = CustomOption.Create(211, Types.Crewmate, "Information Mode", new string[] { "Chat", "Map", "Chat & Map" }, snitchSpawnRate); + snitchTargets = CustomOption.Create(212, Types.Crewmate, "Targets", new string[] { "All Evil Players", "Killing Players" }, snitchSpawnRate); spySpawnRate = CustomOption.Create(240, Types.Crewmate, cs(Spy.color, "Spy"), rates, null, true); spyCanDieToSheriff = CustomOption.Create(241, Types.Crewmate, "Spy Can Die To Sheriff", false, spySpawnRate); diff --git a/TheOtherRoles/Helpers.cs b/TheOtherRoles/Helpers.cs index d07e230..c35bdb2 100644 --- a/TheOtherRoles/Helpers.cs +++ b/TheOtherRoles/Helpers.cs @@ -482,6 +482,20 @@ namespace TheOtherRoles { return false; } + public static bool isKiller(PlayerControl player) { + return player.Data.Role.IsImpostor || + (isNeutral(player) && + player != Jester.jester && + player != Arsonist.arsonist && + player != Vulture.vulture && + player != Lawyer.lawyer && + player != Pursuer.pursuer); + + } + + public static bool isEvil(PlayerControl player) { + return player.Data.Role.IsImpostor || isNeutral(player); + } public static bool zoomOutStatus = false; public static void toggleZoom(bool reset=false) { @@ -493,8 +507,10 @@ namespace TheOtherRoles { if (cam != null && cam.gameObject.name == "UI Camera") cam.orthographicSize = orthographicSize; // The UI is scaled too, else we cant click the buttons. Downside: map is super small. } - HudManagerStartPatch.zoomOutButton.Sprite = zoomOutStatus ? Helpers.loadSpriteFromResources("TheOtherRoles.Resources.PlusButton.png", 75f) : Helpers.loadSpriteFromResources("TheOtherRoles.Resources.MinusButton.png", 150f); - HudManagerStartPatch.zoomOutButton.PositionOffset = zoomOutStatus ? new Vector3(0f, 3f, 0) : new Vector3(0.4f, 2.8f, 0); + if (HudManagerStartPatch.zoomOutButton != null) { + HudManagerStartPatch.zoomOutButton.Sprite = zoomOutStatus ? Helpers.loadSpriteFromResources("TheOtherRoles.Resources.PlusButton.png", 75f) : Helpers.loadSpriteFromResources("TheOtherRoles.Resources.MinusButton.png", 150f); + HudManagerStartPatch.zoomOutButton.PositionOffset = zoomOutStatus ? new Vector3(0f, 3f, 0) : new Vector3(0.4f, 2.8f, 0); + } ResolutionManager.ResolutionChanged.Invoke((float)Screen.width / Screen.height); // This will move button positions to the correct position. } diff --git a/TheOtherRoles/Main.cs b/TheOtherRoles/Main.cs index 99a02f9..25d9afe 100644 --- a/TheOtherRoles/Main.cs +++ b/TheOtherRoles/Main.cs @@ -31,7 +31,7 @@ namespace TheOtherRoles public class TheOtherRolesPlugin : BasePlugin { public const string Id = "me.eisbison.theotherroles"; - public const string VersionString = "4.3.0"; + public const string VersionString = "4.3.1"; public static uint betaDays = 0; // amount of days for the build to be usable (0 for infinite!) public static Version Version = Version.Parse(VersionString); diff --git a/TheOtherRoles/Modules/CustomOptions.cs b/TheOtherRoles/Modules/CustomOptions.cs index 93615cc..ac0d83b 100644 --- a/TheOtherRoles/Modules/CustomOptions.cs +++ b/TheOtherRoles/Modules/CustomOptions.cs @@ -12,6 +12,7 @@ using TheOtherRoles.Utilities; using static TheOtherRoles.TheOtherRoles; using static TheOtherRoles.CustomOption; using Reactor.Utilities.Extensions; +using AmongUs.GameOptions; namespace TheOtherRoles { public class CustomOption { @@ -665,7 +666,7 @@ namespace TheOtherRoles { [HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.CoSpawnPlayer))] public class AmongUsClientOnPlayerJoinedPatch { public static void Postfix() { - if (PlayerControl.LocalPlayer != null) { + if (PlayerControl.LocalPlayer != null && AmongUsClient.Instance.AmHost) { CustomOption.ShareOptionSelections(); } } @@ -1042,7 +1043,9 @@ namespace TheOtherRoles { private static TMPro.TextMeshPro[] settingsTMPs = new TMPro.TextMeshPro[3]; private static GameObject settingsBackground; public static void OpenSettings(HudManager __instance) { - if (__instance.FullScreen == null || MapBehaviour.Instance && MapBehaviour.Instance.IsOpen /*|| AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started*/) return; + if (__instance.FullScreen == null || MapBehaviour.Instance && MapBehaviour.Instance.IsOpen + /*|| AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started*/ + || GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return; settingsBackground = GameObject.Instantiate(__instance.FullScreen.gameObject, __instance.transform); settingsBackground.SetActive(true); var renderer = settingsBackground.GetComponent(); @@ -1084,7 +1087,7 @@ namespace TheOtherRoles { toggleSettingsButton.OnClick.RemoveAllListeners(); toggleSettingsButton.OnClick.AddListener((Action)(() => ToggleSettings(__instance))); } - toggleSettingsButtonObject.SetActive(__instance.MapButton.gameObject.active && !(MapBehaviour.Instance && MapBehaviour.Instance.IsOpen)); + toggleSettingsButtonObject.SetActive(__instance.MapButton.gameObject.active && !(MapBehaviour.Instance && MapBehaviour.Instance.IsOpen) && GameOptionsManager.Instance.currentGameOptions.GameMode != GameModes.HideNSeek); toggleSettingsButtonObject.transform.localPosition = __instance.MapButton.transform.localPosition + new Vector3(0, -0.66f, -500f); } } diff --git a/TheOtherRoles/Patches/EndGamePatch.cs b/TheOtherRoles/Patches/EndGamePatch.cs index b611b9c..e95583d 100644 --- a/TheOtherRoles/Patches/EndGamePatch.cs +++ b/TheOtherRoles/Patches/EndGamePatch.cs @@ -332,7 +332,7 @@ namespace TheOtherRoles.Patches { if (TORMapOptions.showRoleSummary || HideNSeek.isHideNSeekGM) { var position = Camera.main.ViewportToWorldPoint(new Vector3(0f, 1f, Camera.main.nearClipPlane)); GameObject roleSummary = UnityEngine.Object.Instantiate(__instance.WinText.gameObject); - roleSummary.transform.position = new Vector3(__instance.Navigation.ExitButton.transform.position.x + 0.1f, position.y - 0.1f, -14f); + roleSummary.transform.position = new Vector3(__instance.Navigation.ExitButton.transform.position.x + 0.1f, position.y - 0.1f, -214f); roleSummary.transform.localScale = new Vector3(1f, 1f, 1f); var roleSummaryText = new StringBuilder(); diff --git a/TheOtherRoles/Patches/ExileControllerPatch.cs b/TheOtherRoles/Patches/ExileControllerPatch.cs index bbf07c5..6620fe2 100644 --- a/TheOtherRoles/Patches/ExileControllerPatch.cs +++ b/TheOtherRoles/Patches/ExileControllerPatch.cs @@ -137,8 +137,12 @@ namespace TheOtherRoles.Patches { } static void WrapUpPostfix(GameData.PlayerInfo exiled) { + // Prosecutor win condition + if (exiled != null && Lawyer.lawyer != null && Lawyer.target != null && Lawyer.isProsecutor && Lawyer.target.PlayerId == exiled.PlayerId && !Lawyer.lawyer.Data.IsDead) + Lawyer.triggerProsecutorWin = true; + // Mini exile lose condition - if (exiled != null && Mini.mini != null && Mini.mini.PlayerId == exiled.PlayerId && !Mini.isGrownUp() && !Mini.mini.Data.Role.IsImpostor && !RoleInfo.getRoleInfoForPlayer(Mini.mini).Any(x => x.isNeutral)) { + else if (exiled != null && Mini.mini != null && Mini.mini.PlayerId == exiled.PlayerId && !Mini.isGrownUp() && !Mini.mini.Data.Role.IsImpostor && !RoleInfo.getRoleInfoForPlayer(Mini.mini).Any(x => x.isNeutral)) { Mini.triggerMiniLose = true; } // Jester win condition @@ -149,6 +153,7 @@ namespace TheOtherRoles.Patches { else if (exiled != null && Lawyer.lawyer != null && Lawyer.target != null && Lawyer.isProsecutor && Lawyer.target.PlayerId == exiled.PlayerId && !Lawyer.lawyer.Data.IsDead) Lawyer.triggerProsecutorWin = true; + // Reset custom button timers where necessary CustomButton.MeetingEndedUpdate(); diff --git a/TheOtherRoles/Patches/IntroPatch.cs b/TheOtherRoles/Patches/IntroPatch.cs index fe0f5e0..6c98285 100644 --- a/TheOtherRoles/Patches/IntroPatch.cs +++ b/TheOtherRoles/Patches/IntroPatch.cs @@ -269,7 +269,7 @@ namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(Constants), nameof(Constants.ShouldHorseAround))] public static class ShouldAlwaysHorseAround { public static bool Prefix(ref bool __result) { - __result = false; + __result = EventUtility.isEnabled && !EventUtility.disableHorses; return false; } } diff --git a/TheOtherRoles/Patches/MapBehaviourPatch.cs b/TheOtherRoles/Patches/MapBehaviourPatch.cs index 9faed3f..8463591 100644 --- a/TheOtherRoles/Patches/MapBehaviourPatch.cs +++ b/TheOtherRoles/Patches/MapBehaviourPatch.cs @@ -1,4 +1,6 @@ using HarmonyLib; +using Reactor.Utilities.Extensions; +using System; using System.Collections.Generic; using System.Linq; using TheOtherRoles.Objects; @@ -11,7 +13,7 @@ namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(MapBehaviour))] class MapBehaviourPatch { - private static Dictionary herePoints = new Dictionary(); + public static Dictionary herePoints = new Dictionary(); [HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.FixedUpdate))] static void Postfix(MapBehaviour __instance) { @@ -35,6 +37,40 @@ namespace TheOtherRoles.Patches { UnityEngine.Object.Destroy(s.Value); herePoints.Remove(s.Key); } + } else if (Snitch.snitch != null && CachedPlayer.LocalPlayer.PlayerId == Snitch.snitch.PlayerId && !Snitch.snitch.Data.IsDead && Snitch.mode != Snitch.Mode.Chat) { + var (playerCompleted, playerTotal) = TasksHandler.taskInfo(Snitch.snitch.Data); + int numberOfTasks = playerTotal - playerCompleted; + + if (numberOfTasks == 0) { + if (MeetingHud.Instance == null) { + foreach (PlayerControl player in CachedPlayer.AllPlayers) { + if (Snitch.targets == Snitch.Targets.EvilPlayers && !Helpers.isEvil(player)) continue; + else if (Snitch.targets == Snitch.Targets.Killers && !Helpers.isKiller(player)) continue; + if (player.Data.IsDead) continue; + Vector3 v = player.transform.position; + v /= MapUtilities.CachedShipStatus.MapScale; + v.x *= Mathf.Sign(MapUtilities.CachedShipStatus.transform.localScale.x); + v.z = -1f; + if (herePoints.ContainsKey(player)) { + herePoints[player].transform.localPosition = v; + continue; + } + var herePoint = UnityEngine.Object.Instantiate(__instance.HerePoint, __instance.HerePoint.transform.parent, true); + herePoint.transform.localPosition = v; + herePoint.enabled = true; + int colorId = player.CurrentOutfit.ColorId; + player.CurrentOutfit.ColorId = 6; + player.SetPlayerMaterialColors(herePoint); + player.CurrentOutfit.ColorId = colorId; + herePoints.Add(player, herePoint); + } + } else { + foreach (var s in herePoints) { + UnityEngine.Object.Destroy(s.Value); + herePoints.Remove(s.Key); + } + } + } } HudManagerUpdate.CloseSettings(); } diff --git a/TheOtherRoles/Patches/MeetingPatch.cs b/TheOtherRoles/Patches/MeetingPatch.cs index f2e5e94..02c540a 100644 --- a/TheOtherRoles/Patches/MeetingPatch.cs +++ b/TheOtherRoles/Patches/MeetingPatch.cs @@ -224,7 +224,12 @@ namespace TheOtherRoles.Patches { } // Mini - if (!Mini.isGrowingUpInMeeting) Mini.timeOfGrowthStart = Mini.timeOfGrowthStart.Add(DateTime.UtcNow.Subtract(Mini.timeOfMeetingStart)); + if (!Mini.isGrowingUpInMeeting) Mini.timeOfGrowthStart = Mini.timeOfGrowthStart.Add(DateTime.UtcNow.Subtract(Mini.timeOfMeetingStart)).AddSeconds(10); + + // Snitch + if (Snitch.snitch != null && !Snitch.needsUpdate && Snitch.snitch.Data.IsDead && Snitch.text != null) { + UnityEngine.Object.Destroy(Snitch.text); + } } } @@ -599,10 +604,14 @@ namespace TheOtherRoles.Patches { class StartMeetingPatch { public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)]GameData.PlayerInfo meetingTarget) { RoomTracker roomTracker = FastDestroyableSingleton.Instance?.roomTracker; + byte roomId = Byte.MinValue; + if (roomTracker != null && roomTracker.LastRoom != null) { + roomId = (byte)roomTracker.LastRoom?.RoomId; + } if (Snitch.snitch != null && roomTracker != null) { MessageWriter roomWriter = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ShareRoom, Hazel.SendOption.Reliable, -1); roomWriter.Write(CachedPlayer.LocalPlayer.PlayerId); - roomWriter.Write(roomTracker.LastRoom ? (byte)roomTracker.LastRoom.RoomId : Byte.MinValue); + roomWriter.Write(roomId); AmongUsClient.Instance.FinishRpcImmediately(roomWriter); } @@ -664,15 +673,16 @@ namespace TheOtherRoles.Patches { // Add Snitch info string output = ""; - if (Snitch.snitch != null && (CachedPlayer.LocalPlayer.PlayerControl == Snitch.snitch || Helpers.shouldShowGhostInfo()) && !Snitch.snitch.Data.IsDead) { + if (Snitch.snitch != null && Snitch.mode != Snitch.Mode.Map && (CachedPlayer.LocalPlayer.PlayerControl == Snitch.snitch || Helpers.shouldShowGhostInfo()) && !Snitch.snitch.Data.IsDead) { var (playerCompleted, playerTotal) = TasksHandler.taskInfo(Snitch.snitch.Data); int numberOfTasks = playerTotal - playerCompleted; if (numberOfTasks == 0) { output = $"Bad alive roles in game: \n \n"; - FastDestroyableSingleton.Instance.StartCoroutine(Effects.Lerp(0.3f, new Action((x) => { + FastDestroyableSingleton.Instance.StartCoroutine(Effects.Lerp(0.4f, new Action((x) => { if (x == 1f) { foreach (PlayerControl p in CachedPlayer.AllPlayers) { - if (!Helpers.isNeutral(p) && !p.Data.Role.IsImpostor) continue; + if (Snitch.targets == Snitch.Targets.Killers && !Helpers.isKiller(p)) continue; + else if (Snitch.targets == Snitch.Targets.EvilPlayers && !Helpers.isEvil(p)) continue; if (!Snitch.playerRoomMap.ContainsKey(p.PlayerId)) continue; if (p.Data.IsDead) continue; var room = Snitch.playerRoomMap[p.PlayerId]; @@ -680,7 +690,7 @@ namespace TheOtherRoles.Patches { if (room != byte.MinValue) { roomName = DestroyableSingleton.Instance.GetString((SystemTypes)room); } - output += "- " + RoleInfo.GetRolesString(p, false, false, true) + ", was last seen in " + roomName + "\n"; + output += "- " + RoleInfo.GetRolesString(p, false, false, true) + ", was last seen " + roomName + "\n"; } FastDestroyableSingleton.Instance.Chat.AddChat(Snitch.snitch, $"{output}"); } diff --git a/TheOtherRoles/Patches/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs index aa1d404..6669eb1 100644 --- a/TheOtherRoles/Patches/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -12,6 +12,7 @@ using UnityEngine; using TheOtherRoles.CustomGameModes; using static UnityEngine.GraphicsBuffer; using AmongUs.GameOptions; +using Sentry.Internal.Extensions; namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))] @@ -479,9 +480,11 @@ namespace TheOtherRoles.Patches { // Colorblind Text During the round if (p.cosmetics.colorBlindText != null && p.cosmetics.showColorBlindText && p.cosmetics.colorBlindText.gameObject.active) { - p.cosmetics.colorBlindText.transform.localPosition = new Vector3(0, -1f, -0.001f); + p.cosmetics.colorBlindText.transform.localPosition = new Vector3(0, -1f, 0f); } + p.cosmetics.nameText.transform.parent.SetLocalZ(-0.0001f); // This moves both the name AND the colorblindtext behind objects (if the player is behind the object), like the rock on polus + if ((Lawyer.lawyerKnowsRole && CachedPlayer.LocalPlayer.PlayerControl == Lawyer.lawyer && p == Lawyer.target) || p == CachedPlayer.LocalPlayer.PlayerControl || CachedPlayer.LocalPlayer.Data.IsDead) { Transform playerInfoTransform = p.cosmetics.nameText.transform.parent.FindChild("Info"); TMPro.TextMeshPro playerInfo = playerInfoTransform != null ? playerInfoTransform.GetComponent() : null; @@ -594,12 +597,17 @@ namespace TheOtherRoles.Patches { static void snitchUpdate() { if (Snitch.snitch == null) return; - bool snitchIsDead = Snitch.snitch.Data.IsDead; + if (!Snitch.needsUpdate) return; + bool snitchIsDead = Snitch.snitch.Data.IsDead; var (playerCompleted, playerTotal) = TasksHandler.taskInfo(Snitch.snitch.Data); + + if (playerTotal == 0) return; + PlayerControl local = CachedPlayer.LocalPlayer.PlayerControl; + int numberOfTasks = playerTotal - playerCompleted; - if (Snitch.isRevealed && (CachedPlayer.LocalPlayer.PlayerControl.Data.Role.IsImpostor || Helpers.isNeutral(CachedPlayer.LocalPlayer.PlayerControl))) { + if (Snitch.isRevealed && ((Snitch.targets == Snitch.Targets.EvilPlayers && Helpers.isEvil(local)) || (Snitch.targets == Snitch.Targets.Killers && Helpers.isKiller(local)))) { if (Snitch.text == null) { Snitch.text = GameObject.Instantiate(FastDestroyableSingleton.Instance.KillButton.cooldownTimerText, FastDestroyableSingleton.Instance.transform); Snitch.text.enableWordWrapping = false; @@ -610,9 +618,12 @@ namespace TheOtherRoles.Patches { Snitch.text.text = $"Snitch is alive: " + playerCompleted + "/" + playerTotal; if (snitchIsDead) Snitch.text.text = $"Snitch is dead!"; } + } + if (snitchIsDead) { + if (MeetingHud.Instance == null) Snitch.needsUpdate = false; + return; } - if (snitchIsDead) return; if (numberOfTasks <= Snitch.taskCountForReveal) Snitch.isRevealed = true; } @@ -1278,6 +1289,14 @@ namespace TheOtherRoles.Patches { } } } + + // Snitch + if (Snitch.snitch != null && CachedPlayer.LocalPlayer.PlayerId == Snitch.snitch.PlayerId && MapBehaviourPatch.herePoints.Keys.Any(x => x.PlayerId == target.PlayerId)) { + foreach (var a in MapBehaviourPatch.herePoints.Where(x => x.Key.PlayerId == target.PlayerId)) { + UnityEngine.Object.Destroy(a.Value); + MapBehaviourPatch.herePoints.Remove(a.Key); + } + } } } @@ -1386,6 +1405,8 @@ namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.IsFlashlightEnabled))] public static class IsFlashlightEnabledPatch { public static bool Prefix(ref bool __result) { + if (GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) + return true; __result = false; if (!CachedPlayer.LocalPlayer.Data.IsDead && Lighter.lighter != null && Lighter.lighter.PlayerId == CachedPlayer.LocalPlayer.PlayerId) { __result = true; diff --git a/TheOtherRoles/Patches/RoleAssignmentPatch.cs b/TheOtherRoles/Patches/RoleAssignmentPatch.cs index d65bdcb..0ccd570 100644 --- a/TheOtherRoles/Patches/RoleAssignmentPatch.cs +++ b/TheOtherRoles/Patches/RoleAssignmentPatch.cs @@ -11,10 +11,10 @@ using static TheOtherRoles.TheOtherRoles; using TheOtherRoles.CustomGameModes; namespace TheOtherRoles.Patches { - [HarmonyPatch(typeof(RoleOptionsData), nameof(RoleOptionsData.GetNumPerGame))] + [HarmonyPatch(typeof(RoleOptionsCollectionV07), nameof(RoleOptionsCollectionV07.GetNumPerGame))] class RoleOptionsDataGetNumPerGamePatch{ public static void Postfix(ref int __result) { - if (CustomOptionHolder.activateRoles.getBool()) __result = 0; // Deactivate Vanilla Roles if the mod roles are active + if (CustomOptionHolder.activateRoles.getBool() && GameOptionsManager.Instance.CurrentGameOptions.GameMode == GameModes.Normal) __result = 0; // Deactivate Vanilla Roles if the mod roles are active } } diff --git a/TheOtherRoles/Patches/UpdatePatch.cs b/TheOtherRoles/Patches/UpdatePatch.cs index 6dcf225..f3bda2d 100644 --- a/TheOtherRoles/Patches/UpdatePatch.cs +++ b/TheOtherRoles/Patches/UpdatePatch.cs @@ -8,6 +8,7 @@ using System.Linq; using TheOtherRoles.Players; using TheOtherRoles.Utilities; using TheOtherRoles.CustomGameModes; +using AmongUs.GameOptions; namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] @@ -252,7 +253,7 @@ namespace TheOtherRoles.Patches { } public static void miniUpdate() { - if (Mini.mini == null || Camouflager.camouflageTimer > 0f || Mini.mini == Morphling.morphling && Morphling.morphTimer > 0f || Mini.mini == Ninja.ninja && Ninja.isInvisble) return; + if (Mini.mini == null || Camouflager.camouflageTimer > 0f || Mini.mini == Morphling.morphling && Morphling.morphTimer > 0f || Mini.mini == Ninja.ninja && Ninja.isInvisble || SurveillanceMinigamePatch.nightVisionIsActive) return; float growingProgress = Mini.growingProgress(); float scale = growingProgress * 0.35f + 0.35f; @@ -300,6 +301,7 @@ namespace TheOtherRoles.Patches { static void updateVentButton(HudManager __instance) { + if (GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return; if (Deputy.handcuffedKnows.ContainsKey(CachedPlayer.LocalPlayer.PlayerId) && Deputy.handcuffedKnows[CachedPlayer.LocalPlayer.PlayerId] > 0 || MeetingHud.Instance) __instance.ImpostorVentButton.Hide(); else if (CachedPlayer.LocalPlayer.PlayerControl.roleCanUseVents() && !__instance.ImpostorVentButton.isActiveAndEnabled) __instance.ImpostorVentButton.Show(); diff --git a/TheOtherRoles/Patches/UsablesPatch.cs b/TheOtherRoles/Patches/UsablesPatch.cs index d8a299b..5e1af9c 100644 --- a/TheOtherRoles/Patches/UsablesPatch.cs +++ b/TheOtherRoles/Patches/UsablesPatch.cs @@ -12,13 +12,15 @@ using TheOtherRoles.Utilities; using TheOtherRoles.Objects; using TheOtherRoles.CustomGameModes; using Reactor.Utilities.Extensions; +using AmongUs.GameOptions; namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(Vent), nameof(Vent.CanUse))] public static class VentCanUsePatch { - public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { + public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] ref bool canUse, [HarmonyArgument(2)] ref bool couldUse) { + if (GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return true; float num = float.MaxValue; PlayerControl @object = pc.Object; @@ -77,7 +79,7 @@ namespace TheOtherRoles.Patches { Vector3 center = @object.Collider.bounds.center; Vector3 position = __instance.transform.position; num = Vector2.Distance(center, position); - canUse &= (num <= usableDistance && !PhysicsHelpers.AnythingBetween(@object.Collider, center, position, Constants.ShipOnlyMask, false)); + canUse &= (num <= usableDistance && (!PhysicsHelpers.AnythingBetween(@object.Collider, center, position, Constants.ShipOnlyMask, false) || __instance.name.StartsWith("JackInTheBoxVent_"))); } __result = num; return false; @@ -96,6 +98,7 @@ namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(Vent), nameof(Vent.Use))] public static class VentUsePatch { public static bool Prefix(Vent __instance) { + if (GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return true; // Deputy handcuff disables the vents if (Deputy.handcuffedPlayers.Contains(CachedPlayer.LocalPlayer.PlayerId)) { Deputy.setHandcuffedKnows(); @@ -133,7 +136,7 @@ namespace TheOtherRoles.Patches { } } - [HarmonyPatch(typeof(Vent), nameof(Vent.MoveToVent))] + [HarmonyPatch(typeof(Vent), nameof(Vent.TryMoveToVent))] public static class MoveToVentPatch { public static bool Prefix(Vent otherVent) { return !Trapper.playersOnMap.Contains(CachedPlayer.LocalPlayer.PlayerControl); @@ -636,7 +639,7 @@ namespace TheOtherRoles.Patches { } // Dead Bodies foreach (DeadBody deadBody in GameObject.FindObjectsOfType()) { - SpriteRenderer component = deadBody.bodyRenderer; + SpriteRenderer component = deadBody.bodyRenderers.FirstOrDefault(); component.material.SetColor("_BackColor", Palette.ShadowColors[11]); component.material.SetColor("_BodyColor", Palette.PlayerColors[11]); } @@ -668,7 +671,7 @@ namespace TheOtherRoles.Patches { // Dead Bodies foreach (DeadBody deadBody in GameObject.FindObjectsOfType()) { var colorId = GameData.Instance.GetPlayerById(deadBody.ParentId).Object.Data.DefaultOutfit.ColorId; - SpriteRenderer component = deadBody.bodyRenderer; + SpriteRenderer component = deadBody.bodyRenderers.FirstOrDefault(); component.material.SetColor("_BackColor", Palette.ShadowColors[colorId]); component.material.SetColor("_BodyColor", Palette.PlayerColors[colorId]); } @@ -687,7 +690,7 @@ namespace TheOtherRoles.Patches { public static void Postfix(PlayerControl __instance, SpriteRenderer rend) { if (!nightVisionIsActive) return; foreach (DeadBody deadBody in GameObject.FindObjectsOfType()) { - foreach (SpriteRenderer component in new SpriteRenderer[2] { deadBody.bodyRenderer, deadBody.bloodSplatter }) { + foreach (SpriteRenderer component in new SpriteRenderer[2] { deadBody.bodyRenderers.FirstOrDefault(), deadBody.bloodSplatter }) { component.material.SetColor("_BackColor", Palette.ShadowColors[11]); component.material.SetColor("_BodyColor", Palette.PlayerColors[11]); } diff --git a/TheOtherRoles/RPC.cs b/TheOtherRoles/RPC.cs index 57f31a2..9405f5f 100644 --- a/TheOtherRoles/RPC.cs +++ b/TheOtherRoles/RPC.cs @@ -719,6 +719,7 @@ namespace TheOtherRoles if (player == Warlock.warlock) Warlock.clearAndReload(); if (player == Witch.witch) Witch.clearAndReload(); if (player == Ninja.ninja) Ninja.clearAndReload(); + if (player == Bomber.bomber) Bomber.clearAndReload(); // Other roles if (player == Jester.jester) Jester.clearAndReload(); diff --git a/TheOtherRoles/TheOtherRoles.cs b/TheOtherRoles/TheOtherRoles.cs index 512f662..fbd9a3d 100644 --- a/TheOtherRoles/TheOtherRoles.cs +++ b/TheOtherRoles/TheOtherRoles.cs @@ -635,9 +635,12 @@ namespace TheOtherRoles public static void resetCamouflage() { camouflageTimer = 0f; - foreach (PlayerControl p in CachedPlayer.AllPlayers) + foreach (PlayerControl p in CachedPlayer.AllPlayers) { + if (p == Ninja.ninja && Ninja.isInvisble) + continue; p.setDefaultLook(); } + } public static void clearAndReload() { resetCamouflage(); @@ -821,11 +824,24 @@ namespace TheOtherRoles public static class Snitch { public static PlayerControl snitch; public static Color color = new Color32(184, 251, 79, byte.MaxValue); + public enum Mode { + Chat = 0, + Map = 1, + ChatAndMap = 2 + } + public enum Targets { + EvilPlayers = 0, + Killers = 1 + } + public static Mode mode = Mode.Chat; + public static Targets targets = Targets.EvilPlayers; public static int taskCountForReveal = 1; + public static bool isRevealed = false; public static Dictionary playerRoomMap = new Dictionary(); public static TMPro.TextMeshPro text = null; + public static bool needsUpdate = true; public static void clearAndReload() { taskCountForReveal = Mathf.RoundToInt(CustomOptionHolder.snitchLeftTasksForReveal.getFloat()); @@ -834,6 +850,9 @@ namespace TheOtherRoles playerRoomMap = new Dictionary(); if (text != null) UnityEngine.Object.Destroy(text); text = null; + needsUpdate = true; + mode = (Mode) CustomOptionHolder.snitchMode.getSelection(); + targets = (Targets) CustomOptionHolder.snitchTargets.getSelection(); } } diff --git a/TheOtherRoles/TheOtherRoles.csproj b/TheOtherRoles/TheOtherRoles.csproj index 0e0b3b4..cda0696 100644 --- a/TheOtherRoles/TheOtherRoles.csproj +++ b/TheOtherRoles/TheOtherRoles.csproj @@ -1,7 +1,7 @@  net6.0 - 4.3.0 + 4.3.1 TheOtherRoles Eisbison latest @@ -15,10 +15,7 @@ - - - - + diff --git a/TheOtherRoles/Utilities/EventUtility.cs b/TheOtherRoles/Utilities/EventUtility.cs index b933486..b04f2cb 100644 --- a/TheOtherRoles/Utilities/EventUtility.cs +++ b/TheOtherRoles/Utilities/EventUtility.cs @@ -24,6 +24,7 @@ namespace TheOtherRoles.Utilities { public static readonly float[] eventDurations = {0f, 1f, 5f, 0f}; public static double[] eventProbabilities; private static bool knocked = false; + public static bool disableHorses = false; public static void Load() { if (!isEnabled) return; @@ -41,7 +42,8 @@ namespace TheOtherRoles.Utilities { public static void clearAndReload() { eventQueue = new List(); eventInvert = false; - + if (canBeEnabled && CustomOptionHolder.enableCodenameDisableHorses != null) + disableHorses = CustomOptionHolder.enableCodenameDisableHorses.getBool(); } public static void Update() { @@ -97,6 +99,10 @@ namespace TheOtherRoles.Utilities { if (!isEnabled) return; defaultHat = PlayerControl.LocalPlayer.Data.DefaultOutfit.HatId; meetingEndsUpdate(); + List relevantPlayers = CachedPlayer.AllPlayers.Where(x => !x.Data.IsDead && x != CachedPlayer.LocalPlayer).ToList(); + foreach (CachedPlayer pc in relevantPlayers) + pc.PlayerControl.MyPhysics.SetBodyType(disableHorses ? PlayerBodyTypes.Normal : PlayerBodyTypes.Horse); + } public static void gameEndsUpdate() { @@ -110,10 +116,10 @@ namespace TheOtherRoles.Utilities { switch (eventToStart) { case EventTypes.Animation: CachedPlayer animationPlayer = relevantPlayers[rnd.Next(relevantPlayers.Count)]; - animationPlayer.PlayerPhysics.SetBodyType(rnd.Next(2) > 0 ? PlayerBodyTypes.Horse : PlayerBodyTypes.Seeker); + animationPlayer.PlayerPhysics.SetBodyType(rnd.Next(2) > 0 ? (disableHorses ? PlayerBodyTypes.Horse : PlayerBodyTypes.Normal) : PlayerBodyTypes.Seeker); FastDestroyableSingleton.Instance.StartCoroutine(Effects.Lerp(eventDurations[(int)EventTypes.Animation], new Action((p) => { if (p==1) - animationPlayer.PlayerControl.MyPhysics.SetBodyType(PlayerBodyTypes.Normal); + animationPlayer.PlayerControl.MyPhysics.SetBodyType(disableHorses ? PlayerBodyTypes.Normal : PlayerBodyTypes.Horse); }))); break; case EventTypes.Communication: diff --git a/TheOtherRoles/packages.lock.json b/TheOtherRoles/packages.lock.json index eb054c7..406faf4 100644 --- a/TheOtherRoles/packages.lock.json +++ b/TheOtherRoles/packages.lock.json @@ -4,9 +4,9 @@ "net6.0": { "AmongUs.GameLibs.Steam": { "type": "Direct", - "requested": "[2023.2.28, )", - "resolved": "2023.2.28", - "contentHash": "GEcFs++dUrI+6Q+RTWvnm1a7l3Q/bUNNuCy9h8R17WISTOrV7g9QrZZmUiJka0JvVnj/J9Hygx5FaqApzFZKiQ==" + "requested": "[2023.3.28, )", + "resolved": "2023.3.28", + "contentHash": "EIaXNPlV9DMxlPfrC1yGZPXUIKbN7hAbmizYoL72gmxZVWiLLiJ8VbelM86OgyLocQ8+ma/UD7laPYIbePlrxw==" }, "BepInEx.IL2CPP.MSBuild": { "type": "Direct",