From e2f34157f262ed3cca8920a273cfad5376b64847 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Tue, 17 Nov 2026 09:26:34 +0100 Subject: [PATCH] actually a ghost role --- CustomRoles.cs | 1 + Main.cs | 1 + Patches/LobbyViewSettingsPanePatch.cs | 1 + Patches/PlayerControlPatch.cs | 16 ++++++++------ Resources/Lang/en_US.json | 3 +++ Roles/Standard/Ghost/Influencer.cs | 31 +++++++++++++++++++++++++++ 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 Roles/Standard/Ghost/Influencer.cs diff --git a/CustomRoles.cs b/CustomRoles.cs index 92f74deea..180947932 100644 --- a/CustomRoles.cs +++ b/CustomRoles.cs @@ -588,6 +588,7 @@ public enum CustomRoles Haste, Haunter, // Ghost role Hidden, + Influencer, // SpiritGuide - Ghost role Insane, Introvert, Knighted, diff --git a/Main.cs b/Main.cs index 52ab5cef2..7c96d896a 100644 --- a/Main.cs +++ b/Main.cs @@ -785,6 +785,7 @@ public class Main : BaseUnityPlugin { CustomRoles.Haunter, "#d1b1de" }, { CustomRoles.Bloodmoon, "#ff1313" }, { CustomRoles.GA, "#8cffff" }, + { CustomRoles.Influencer, "#D8E3E6" }, { CustomRoles.Facilitator, CovenColor }, { CustomRoles.Shade, "#060270" }, { CustomRoles.MeetingAngel, "#a7e8b5" }, diff --git a/Patches/LobbyViewSettingsPanePatch.cs b/Patches/LobbyViewSettingsPanePatch.cs index 6d8ca0eb1..bc27c18d3 100644 --- a/Patches/LobbyViewSettingsPanePatch.cs +++ b/Patches/LobbyViewSettingsPanePatch.cs @@ -889,6 +889,7 @@ public static class LobbyViewSettingsPanePatch viewSettingsInfoPanelRoleVariant.transform.localPosition = new Vector3(xPos, yPos, -2f); if (role.ToString().Contains("GuardianAngel")) role = CustomRoles.GA; + if (role.ToString().Contains("Influencer")) role = CustomRoles.Influencer; titleName = titleName.RemoveHtmlTags(); diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 83b8d43ef..d61f4c1ee 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -2537,7 +2537,7 @@ static class PlayerControlRevivePatch var sender = CustomRpcSender.Create($"LIReviveSync:{__instance.GetRealName()}", SendOption.Reliable); var hasValue = sender.SyncGeneralOptions(__instance); sender.SendMessage(dispose: !hasValue); - __instance.TP(FastVector2.TryGetClosest(__instance.Pos(), Main.EnumerateAlivePlayerControls().Without(__instance).Select(x => x.Pos()).Concat(ShipStatus.Instance.AllVents.Select(x => new Vector2(x.transform.position.x, x.transform.position.y + 0.3636f))), out Vector2 closest) ? closest : Vector2.zero); + __instance.TP(FastVector2.TryGetClosest(__instance.Pos(), Main.CachedAlivePlayerControls().Without(__instance).Select(x => x.Pos()).Concat(ShipStatus.Instance.AllVents.Select(x => new Vector2(x.transform.position.x, x.transform.position.y + 0.3636f))), out Vector2 closest) ? closest : Vector2.zero); } }, 0.2f); } @@ -2560,17 +2560,21 @@ public static class PlayerControlCheckUseZiplinePatch { Logger.Info($"{__instance.GetNameWithRole()}, target: {target.GetNameWithRole()}, {(fromTop ? $"from Top, travel time: {ziplineBehaviour.downTravelTime}s" : $"from Bottom, travel time: {ziplineBehaviour.upTravelTime}s")}", "Zipline Use"); - if (Options.CurrentGameMode == CustomGameMode.Deathrace) return true; + CustomGameMode currentGameMode = Options.CurrentGameMode; + if (currentGameMode == CustomGameMode.Deathrace) return true; if (AmongUsClient.Instance.AmHost) { if (Options.DisableZiplineFromTop.GetBool() && fromTop) return false; if (Options.DisableZiplineFromUnder.GetBool() && !fromTop) return false; - if (__instance.Is(CustomRoleTypes.Coven) && Options.DisableZiplineForCoven.GetBool()) return false; - if (__instance.IsImpostor() && Options.DisableZiplineForImps.GetBool()) return false; - if (__instance.GetCustomRole().IsNeutral() && Options.DisableZiplineForNeutrals.GetBool()) return false; - if (__instance.IsCrewmate() && Options.DisableZiplineForCrew.GetBool()) return false; + if (currentGameMode == CustomGameMode.Standard) + { + if (__instance.Is(CustomRoleTypes.Coven) && Options.DisableZiplineForCoven.GetBool()) return false; + if (__instance.IsImpostor() && Options.DisableZiplineForImps.GetBool()) return false; + if (__instance.GetCustomRole().IsNeutral() && Options.DisableZiplineForNeutrals.GetBool()) return false; + if (__instance.IsCrewmate() && Options.DisableZiplineForCrew.GetBool()) return false; + } } return true; diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 40ab2f4b5..6ad2b49d7 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -639,6 +639,9 @@ "SpiritGuideEHR": "Influencer", "SpiritGuideEHRInfo": "Send messages to living Crewmates.", "SpiritGuideEHRInfoLong": "(Crewmate Ghost):\\nSend messages to living Crewmates.", + "Influencer": "Influencer", + "InfluencerInfo": "Send messages to living Crewmates.", + "InfluencerInfoLong": "(Crewmate Ghost):\\nSend messages to living Crewmates.", "SpiritGuideCooldown": "Message Cooldown", "Detour": "Detour", "DetourInfo": "Pass Kills Onto Nearest Player", diff --git a/Roles/Standard/Ghost/Influencer.cs b/Roles/Standard/Ghost/Influencer.cs new file mode 100644 index 000000000..2494e3140 --- /dev/null +++ b/Roles/Standard/Ghost/Influencer.cs @@ -0,0 +1,31 @@ +using AmongUs.GameOptions; + +namespace EHR.Roles; + +public class Influencer : IGhostRole +{ + private static OptionItem CD; + + public Team Team => Team.Crewmate; + public RoleTypes RoleTypes => RoleTypes.SpiritGuide; + public int Cooldown => CD.GetInt(); + + public void SetupCustomOption() + { + Options.SetupRoleOptions(647000, TabGroup.OtherRoles, CustomRoles.Influencer); + + CD = new IntegerOptionItem(647002, "SpiritGuideCooldown", new(0, 120, 1), 30, TabGroup.OtherRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Influencer]) + .SetValueFormat(OptionFormat.Seconds); + } + + public void OnProtect(PlayerControl pc, PlayerControl target) + { + + } + + public void OnAssign(PlayerControl pc) + { + + } +} \ No newline at end of file