From a61555fcdb2d6e2186c321c3a0d007d92ef341d7 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Wed, 26 Aug 2026 10:33:18 +0200 Subject: [PATCH] quick fixes --- .github/workflows/release.yml | 53 ++++++++++++++++++++++++++++- Main.cs | 4 +-- Modules/Camouflage.cs | 2 +- Modules/Utils.cs | 64 +++++++++++++++++------------------ Patches/ChatCommandPatch.cs | 4 +++ Patches/MeetingHudPatch.cs | 46 +++++++++++++++++++++++++ 6 files changed, 137 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aba08ebb4..2e2cc573f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -223,7 +223,58 @@ jobs: path: ./EHR*.zip # --------------------------------------------------------- - # 5) Create GitHub Release + # 5) Upload releases to CurseForge + # --------------------------------------------------------- + publish-curseforge: + runs-on: ubuntu-latest + needs: [package] + + steps: + - uses: actions/checkout@v4 + + - name: Download packaged ZIPs + uses: actions/download-artifact@v4 + with: + name: final-zips + path: release-artifacts + + - name: Read changelog + id: changelog + run: | + { + echo 'content<> "$GITHUB_OUTPUT" + + - name: Upload Epic / Microsoft Store build to CurseForge + uses: itsmeow/curseforge-upload@v3 + with: + token: ${{ secrets.CURSEFORGE_API_TOKEN }} + project_id: ${{ secrets.CURSEFORGE_PROJECT_ID }} + game_endpoint: among-us + file_path: release-artifacts/EHR.v${{ github.event.inputs.version }}_Epic-Games_Microsoft-Store.zip + display_name: EHR v${{ github.event.inputs.version }} (x64 - Epic/MS Store) + release_type: release + changelog_type: markdown + changelog: ${{ steps.changelog.outputs.content }} + game_versions: "18.0.0" + + - name: Upload Steam build to CurseForge + uses: itsmeow/curseforge-upload@v3 + with: + token: ${{ secrets.CURSEFORGE_API_TOKEN }} + project_id: ${{ secrets.CURSEFORGE_PROJECT_ID }} + game_endpoint: among-us + file_path: release-artifacts/EHR.v${{ github.event.inputs.version }}_Steam.zip + display_name: EHR v${{ github.event.inputs.version }} (x86 - Steam) + release_type: release + changelog_type: markdown + changelog: ${{ steps.changelog.outputs.content }} + game_versions: "18.0.0" + + # --------------------------------------------------------- + # 6) Create GitHub Release # --------------------------------------------------------- release: runs-on: ubuntu-latest diff --git a/Main.cs b/Main.cs index 113354396..4f227f103 100644 --- a/Main.cs +++ b/Main.cs @@ -41,8 +41,8 @@ public class Main : BasePlugin private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d"; private const string DebugKeySalt = "59687b"; public const string PluginGuid = "com.gurge44.endlesshostroles"; - public const string PluginVersion = "8.0.0"; - public const string PluginDisplayVersion = "8.0.0"; + public const string PluginVersion = "8.0.1"; + public const string PluginDisplayVersion = "8.0.1"; public const int TestBuildNumber = 0; // 0 = Release public const string NeutralColor = "#ffab1b"; diff --git a/Modules/Camouflage.cs b/Modules/Camouflage.cs index 174ffb88e..bcb5a8f61 100644 --- a/Modules/Camouflage.cs +++ b/Modules/Camouflage.cs @@ -209,7 +209,7 @@ public static class Camouflage } // if the current Outfit is the same, return - if (newOutfit.Compare(target.Data.DefaultOutfit)) + if (IsCamouflage && newOutfit.Compare(target.Data.DefaultOutfit)) { Logger.Info("Outfit is the same, returning", "Camouflage.RpcSetSkin"); return; diff --git a/Modules/Utils.cs b/Modules/Utils.cs index caee7725a..e150e6927 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -280,46 +280,46 @@ public static class Utils switch (type) { case SystemTypes.Electrical: - { - if (mapId == 5) return false; - return ShipStatusSystem.SwitchSystem != null && ShipStatusSystem.SwitchSystem.IsActive; - } + { + if (mapId == 5) return false; + return ShipStatusSystem.SwitchSystem != null && ShipStatusSystem.SwitchSystem.IsActive; + } case SystemTypes.Reactor: + { + return mapId switch { - return mapId switch - { - 2 => false, - 4 => ShipStatusSystem.HeliSabotageSystem && ShipStatusSystem.HeliSabotageSystem.IsActive, - _ => ShipStatusSystem.ReactorSystemType != null && ShipStatusSystem.ReactorSystemType.IsActive - }; - } + 2 => false, + 4 => ShipStatusSystem.HeliSabotageSystem && ShipStatusSystem.HeliSabotageSystem.IsActive, + _ => ShipStatusSystem.ReactorSystemType != null && ShipStatusSystem.ReactorSystemType.IsActive + }; + } case SystemTypes.Laboratory: - { - if (mapId != 2) return false; - return ShipStatusSystem.ReactorSystemType != null && ShipStatusSystem.ReactorSystemType.IsActive; - } + { + if (mapId != 2) return false; + return ShipStatusSystem.ReactorSystemType != null && ShipStatusSystem.ReactorSystemType.IsActive; + } case SystemTypes.LifeSupp: - { - if (mapId is 2 or 4 or 5) return false; - return ShipStatusSystem.LifeSuppSystemType != null && ShipStatusSystem.LifeSuppSystemType.IsActive; - } + { + if (mapId is 2 or 4 or 5) return false; + return ShipStatusSystem.LifeSuppSystemType != null && ShipStatusSystem.LifeSuppSystemType.IsActive; + } case SystemTypes.Comms: - { - if (mapId is 1 or 5) - return ShipStatusSystem.HqHudSystemType != null && ShipStatusSystem.HqHudSystemType.IsActive; + { + if (mapId is 1 or 5) + return ShipStatusSystem.HqHudSystemType != null && ShipStatusSystem.HqHudSystemType.IsActive; - return ShipStatusSystem.HudOverrideSystemType != null && ShipStatusSystem.HudOverrideSystemType.IsActive; - } + return ShipStatusSystem.HudOverrideSystemType != null && ShipStatusSystem.HudOverrideSystemType.IsActive; + } case SystemTypes.HeliSabotage: - { - if (mapId != 4) return false; - return ShipStatusSystem.HeliSabotageSystem && ShipStatusSystem.HeliSabotageSystem.IsActive; - } + { + if (mapId != 4) return false; + return ShipStatusSystem.HeliSabotageSystem && ShipStatusSystem.HeliSabotageSystem.IsActive; + } case SystemTypes.MushroomMixupSabotage: - { - if (mapId != 5) return false; - return ShipStatusSystem.MushroomMixupSabotageSystem && ShipStatusSystem.MushroomMixupSabotageSystem.IsActive; - } + { + if (mapId != 5) return false; + return ShipStatusSystem.MushroomMixupSabotageSystem && ShipStatusSystem.MushroomMixupSabotageSystem.IsActive; + } default: return false; } diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 4dce53387..b5d6c1438 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -1321,10 +1321,14 @@ internal static class ChatCommands if (pc == null) return; if (ForcedSpectators.Remove(targetId)) + { Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("SpectateCommand.RemovedForcedSpectator"), targetId.ColoredPlayerName())); + return; + } if (ForcedSpectators.Add(targetId)) Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("SpectateCommand.ForcedSpectator"), targetId.ColoredPlayerName())); + return; } diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index 8a154a707..d754a6ec5 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -22,6 +22,7 @@ internal static class CheckForEndVotingPatch public static string EjectionText = string.Empty; public static NetworkedPlayerInfo TempExiledPlayer; public static bool ShouldSkip; + public static bool CommsWasCalled; private static readonly List StatesList = []; private static MeetingHud.VoterState[] States = []; @@ -1074,6 +1075,13 @@ internal static class MeetingHudStartPatch { if (!MeetingHud.Instance || MeetingHud.Instance.state is MeetingHud.MeetingStates.Results or MeetingHud.MeetingStates.Proceeding) return; + if (Utils.IsActive(SystemTypes.Comms)) + { + CheckForEndVotingPatch.CommsWasCalled = true; + if (Main.NormalOptions.MapId is 1 or 5) ShipStatus.Instance.UpdateSystem(SystemTypes.Comms, PlayerControl.LocalPlayer, 17); + ShipStatus.Instance.UpdateSystem(SystemTypes.Comms, PlayerControl.LocalPlayer, 16); + } + Main.EnumerateAlivePlayerControls().DoIf(x => x.UsesJudgeAbilityAsTrigger(), x => x.RpcSetRoleDesync(RoleTypes.Judge, x.OwnerId)); }, 1f, "Set Shapeshifter Role For Meeting Use"); } @@ -1381,6 +1389,16 @@ internal static class MeetingHudOnDestroyPatch pc.RpcMakeInvisible(); } catch (Exception e) { Utils.ThrowException(e); } + + try + { + if (CheckForEndVotingPatch.CommsWasCalled) + { + CheckForEndVotingPatch.CommsWasCalled = false; + ShipStatus.Instance.UpdateSystem(SystemTypes.Comms, PlayerControl.LocalPlayer, 128); + } + } + catch (Exception e) { Utils.ThrowException(e); } bool meetingSS = Options.UseMeetingShapeshift.GetBool(); bool meetingSSForGuessing = Options.UseMeetingShapeshiftForGuessing.GetBool(); @@ -1593,6 +1611,34 @@ static class MeetingHud_Start } } +[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.CmdQueueOverruleVotes))] +static class MeetingHudCmdQueueOverruleVotesPatch +{ + public static bool Prefix(MeetingHud __instance, [HarmonyArgument(1)] PlayerId targetPlayerId) + { + if (!AmongUsClient.Instance.AmHost) return true; + + PlayerControl target = targetPlayerId.Value.GetPlayer(); + + if (target && PlayerControl.LocalPlayer.UsesJudgeAbilityAsTrigger() && Main.PlayerStates.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out PlayerState state)) + { + state.Role.OnJudge(PlayerControl.LocalPlayer, target); + + if (__instance.playerStates.FindFirst(x => x.PlayerId == PlayerControl.LocalPlayer.PlayerId, out PlayerVoteArea pva)) + { + pva.UnsetVote(); + __instance.RpcClearVote(pva.PlayerId); + __instance.UpdateForeground(); + pva.VotedForId = byte.MaxValue; + } + + return false; + } + + return true; + } +} + // All below are from: https://github.com/EnhancedNetwork/TownofHost-Enhanced (with some modifications) [HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.RpcClose))]