From 33b7ada5aa874db769430d7e733c173b1da4db38 Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Fri, 21 Jan 2022 22:25:29 -0600 Subject: [PATCH 1/8] feat(Lighter): New role: Lighter --- README.md | 17 ++++- .../CrewmateRoles/CovertMod/PerformKill.cs | 3 +- .../CrewmateRoles/LighterMod/LighterUpdate.cs | 18 +++++ .../LighterMod/ManageLighterButton.cs | 46 ++++++++++++ .../CrewmateRoles/LighterMod/PerformKill.cs | 49 +++++++++++++ .../CrewmateRoles/MedicMod/StopKill.cs | 1 - source/Patches/CustomGameOptions.cs | 3 + source/Patches/CustomHats/HatLoader.cs | 1 - source/Patches/CustomOption/Generate.cs | 11 +++ source/Patches/CustomRPC.cs | 2 + source/Patches/LowLights.cs | 25 ++++++- source/Patches/RoleEnum.cs | 2 + source/Patches/Roles/Lighter.cs | 69 ++++++++++++++++++ source/Patches/RpcHandling.cs | 13 ++++ source/Resources/Lighter.png | Bin 0 -> 3645 bytes source/TownOfUs.cs | 2 + source/TownOfUs.csproj | 6 +- 17 files changed, 257 insertions(+), 11 deletions(-) create mode 100644 source/Patches/CrewmateRoles/LighterMod/LighterUpdate.cs create mode 100644 source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs create mode 100644 source/Patches/CrewmateRoles/LighterMod/PerformKill.cs create mode 100644 source/Patches/Roles/Lighter.cs create mode 100644 source/Resources/Lighter.png diff --git a/README.md b/README.md index 05909bb5d..34480f88b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ An Among Us mod that adds a bunch of roles, modifiers and game settings - [Altruist](#altruist) - [Prophet](#prophet) - [Covert](#covert) +- [Lighter](#lighter) **Neutral Roles** - [Jester](#jester) @@ -910,7 +911,21 @@ The Covert is a Crewmate that can temporarily turn invisible. Their vision is ha |----------|:-------------:|:------:|:------:| | Covert | The percentage probability of the Covert appearing | Percentage | 0% | | Covert Cooldown | The cooldown of the Covert's invisibility button | Time | 30s | -| Covert Cooldown | How long the Covert is invisible | Time | 15s | +| Covert Duration | How long the Covert is invisible | Time | 15s | + + +---------------------- +## Lighter +### **Team: Crewmates** + +The Lighter is a Crewmate that can temporarily increase their vision. While their ability is active, they will +get normal crewmate vision is lights are off and normal impostor vision if lights are on. +### Game Options +| Name | Description | Type | Default | +|----------|:-------------:|:------:|:------:| +| Lighter | The percentage probability of the Lighter appearing | Percentage | 0% | +| Lighter Cooldown | The cooldown of the Lighter's visibility | Time | 20s | +| Lighter Duration | How long the Lighter gets improved visibility invisible | Time | 5s | ----------------------- diff --git a/source/Patches/CrewmateRoles/CovertMod/PerformKill.cs b/source/Patches/CrewmateRoles/CovertMod/PerformKill.cs index 490dff64f..6760db368 100644 --- a/source/Patches/CrewmateRoles/CovertMod/PerformKill.cs +++ b/source/Patches/CrewmateRoles/CovertMod/PerformKill.cs @@ -8,7 +8,6 @@ namespace TownOfUs.CrewmateRoles.CovertMod [HarmonyPatch(typeof(KillButton), nameof(KillButton.DoClick))] public class PerformKill { - public static bool Prefix(KillButton __instance) { if (!PlayerControl.LocalPlayer.Is(RoleEnum.Covert)) @@ -48,4 +47,4 @@ public static bool Prefix(KillButton __instance) return false; } } -} \ No newline at end of file +} diff --git a/source/Patches/CrewmateRoles/LighterMod/LighterUpdate.cs b/source/Patches/CrewmateRoles/LighterMod/LighterUpdate.cs new file mode 100644 index 000000000..a819b23d4 --- /dev/null +++ b/source/Patches/CrewmateRoles/LighterMod/LighterUpdate.cs @@ -0,0 +1,18 @@ +using HarmonyLib; +using TownOfUs.Roles; + +namespace TownOfUs.Patches.CrewmateRoles.LighterMod +{ + [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] + public class LighterUpdate + { + public static void Postfix(HudManager __instance) + { + foreach (var role in Role.GetRoles(RoleEnum.Lighter)) + { + Lighter lighter = (Lighter) role; + lighter.LightTick(); + } + } + } +} diff --git a/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs b/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs new file mode 100644 index 000000000..456319a7f --- /dev/null +++ b/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs @@ -0,0 +1,46 @@ +using HarmonyLib; +using TownOfUs.Roles; +using UnityEngine; + +namespace TownOfUs.Patches.CrewmateRoles.LighterMod +{ + [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] + public class ManageLighterButton + { + private static Sprite Sprite => TownOfUs.LighterSprite; + + public static void Postfix(HudManager __instance) + { + if ( + PlayerControl.AllPlayerControls.Count <= 1 + || PlayerControl.LocalPlayer == null + || PlayerControl.LocalPlayer.Data == null + || !PlayerControl.LocalPlayer.Is(RoleEnum.Covert) + ) + { + return; + } + + Lighter role = Role.GetRole(PlayerControl.LocalPlayer); + + if (role.LighterButton == null) + { + role.LighterButton = Object.Instantiate(__instance.KillButton, HudManager.Instance.transform); + role.LighterButton.graphic.enabled = true; + } + + role.LighterButton.graphic.sprite = Sprite; + role.LighterButton.gameObject.SetActive(!PlayerControl.LocalPlayer.Data.IsDead && !MeetingHud.Instance); + + if (role.IsLighting) + { + role.LighterButton.SetCoolDown(role.LighterTimeRemaining, CustomGameOptions.CovertDuration); + return; + } + + role.LighterButton.SetCoolDown(role.CooldownTimer(), CustomGameOptions.LighterCooldown); + role.LighterButton.graphic.color = Palette.EnabledColor; + role.LighterButton.graphic.material.SetFloat("_Desat", 0f); + } + } +} diff --git a/source/Patches/CrewmateRoles/LighterMod/PerformKill.cs b/source/Patches/CrewmateRoles/LighterMod/PerformKill.cs new file mode 100644 index 000000000..bc70a318e --- /dev/null +++ b/source/Patches/CrewmateRoles/LighterMod/PerformKill.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using Hazel; +using TownOfUs.Roles; + +namespace TownOfUs.Patches.CrewmateRoles.LighterMod +{ + [HarmonyPatch(typeof(KillButton), nameof(KillButton.DoClick))] + public class PerformKill + { + public static bool Prefix(KillButton __instance) + { + if (!PlayerControl.LocalPlayer.Is(RoleEnum.Lighter)) + { + return true; + } + + if ( + !PlayerControl.LocalPlayer.CanMove + || PlayerControl.LocalPlayer.Data.IsDead + ) + { + return false; + } + + Lighter role = Role.GetRole(PlayerControl.LocalPlayer); + if (__instance != role.LighterButton) + { + return true; + } + + if ( + __instance.isCoolingDown + || !__instance.isActiveAndEnabled + || role.CooldownTimer() != 0 + ) + { + return false; + } + + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, + (byte) CustomRPC.LighterOn, SendOption.Reliable, -1); + writer.Write(PlayerControl.LocalPlayer.PlayerId); + AmongUsClient.Instance.FinishRpcImmediately(writer); + + role.LightOn(); + return false; + } + } +} diff --git a/source/Patches/CrewmateRoles/MedicMod/StopKill.cs b/source/Patches/CrewmateRoles/MedicMod/StopKill.cs index 71cf69e78..1c89dea74 100644 --- a/source/Patches/CrewmateRoles/MedicMod/StopKill.cs +++ b/source/Patches/CrewmateRoles/MedicMod/StopKill.cs @@ -1,5 +1,4 @@ using HarmonyLib; -using Hazel; using Reactor; using TownOfUs.Extensions; using TownOfUs.Roles; diff --git a/source/Patches/CustomGameOptions.cs b/source/Patches/CustomGameOptions.cs index e3a7cc7bd..c936e9d8c 100644 --- a/source/Patches/CustomGameOptions.cs +++ b/source/Patches/CustomGameOptions.cs @@ -35,6 +35,7 @@ public static class CustomGameOptions public static int AltruistOn => (int) Generate.AltruistOn.Get(); public static int ProphetOn => (int) Generate.ProphetOn.Get(); public static int CovertOn => (int) Generate.CovertOn.Get(); + public static int LighterOn => (int) Generate.LighterOn.Get(); public static int PhantomOn => (int) Generate.PhantomOn.Get(); public static int UndertakerOn => (int) Generate.UndertakerOn.Get(); public static int UnderdogOn => (int) Generate.UnderdogOn.Get(); @@ -94,6 +95,8 @@ public static class CustomGameOptions public static bool ProphetInitialReveal => Generate.ProphetInitialReveal.Get(); public static float CovertCooldown => Generate.CovertCooldown.Get(); public static float CovertDuration => Generate.CovertDuration.Get(); + public static float LighterCooldown => Generate.LighterCooldown.Get(); + public static float LighterDuration => Generate.LighterDuration.Get(); public static bool NeutralRed => Generate.NeutralRed.Get(); public static float MimicCooldown => Generate.MimicCooldownOption.Get(); public static float MimicDuration => Generate.MimicDurationOption.Get(); diff --git a/source/Patches/CustomHats/HatLoader.cs b/source/Patches/CustomHats/HatLoader.cs index b8cfb6dd9..3184ca33c 100644 --- a/source/Patches/CustomHats/HatLoader.cs +++ b/source/Patches/CustomHats/HatLoader.cs @@ -15,7 +15,6 @@ internal static class HatLoader { private const string HAT_RESOURCE_NAMESPACE = "TownOfUs.Resources.Hats"; private const string HAT_METADATA_JSON = "metadata.json"; - private const int HAT_ORDER_BASELINE = 99; private static ManualLogSource Log => PluginSingleton.Instance.Log; private static Assembly Assembly => typeof(TownOfUs).Assembly; diff --git a/source/Patches/CustomOption/Generate.cs b/source/Patches/CustomOption/Generate.cs index 307bc8a59..41cc28c95 100644 --- a/source/Patches/CustomOption/Generate.cs +++ b/source/Patches/CustomOption/Generate.cs @@ -24,6 +24,7 @@ public static class Generate public static CustomNumberOption AltruistOn; public static CustomNumberOption ProphetOn; public static CustomNumberOption CovertOn; + public static CustomNumberOption LighterOn; private static CustomHeaderOption NeutralRoles; public static CustomNumberOption JesterOn; @@ -148,6 +149,10 @@ public static class Generate public static CustomNumberOption CovertCooldown; public static CustomNumberOption CovertDuration; + private static CustomHeaderOption Lighter; + public static CustomNumberOption LighterCooldown; + public static CustomNumberOption LighterDuration; + private static CustomHeaderOption TheGlitch; public static CustomNumberOption MimicCooldownOption; public static CustomNumberOption MimicDurationOption; @@ -237,6 +242,8 @@ public static void GenerateAll() PercentFormat); CovertOn = new CustomNumberOption(true, num++, $"{RoleDetailsAttribute.GetRoleDetails(RoleEnum.Covert).GetColoredName()}", 0f, 0f, 100f, 10f, PercentFormat); + LighterOn = new CustomNumberOption(true, num++, $"{RoleDetailsAttribute.GetRoleDetails(RoleEnum.Lighter).GetColoredName()}", 0f, 0f, 100f, 10f, + PercentFormat); NeutralRoles = new CustomHeaderOption(num++, "Neutral Roles"); @@ -438,6 +445,10 @@ public static void GenerateAll() Covert = new CustomHeaderOption(num++, $"{RoleDetailsAttribute.GetRoleDetails(RoleEnum.Covert).GetColoredName()}"); CovertCooldown = new CustomNumberOption(num++, "Covert Cooldown", 30f, 10f, 120f, 2.5f, CooldownFormat); CovertDuration = new CustomNumberOption(num++, "Covert Duration", 15f, 5f, 30f, 2.5f, CooldownFormat); + + Lighter = new CustomHeaderOption(num++, $"{RoleDetailsAttribute.GetRoleDetails(RoleEnum.Lighter).GetColoredName()}"); + CovertCooldown = new CustomNumberOption(num++, "Lighter Cooldown", 20f, 5f, 60f, 2.5f, CooldownFormat); + CovertDuration = new CustomNumberOption(num++, "Lighter Duration", 5f, 1f, 10f, 2.5f, CooldownFormat); #endregion diff --git a/source/Patches/CustomRPC.cs b/source/Patches/CustomRPC.cs index c9be9beb4..3075be2e8 100644 --- a/source/Patches/CustomRPC.cs +++ b/source/Patches/CustomRPC.cs @@ -26,6 +26,7 @@ public enum CustomRPC SetAltruist, SetProphet, SetCovert, + SetLighter, SetUndertaker, SetUnderdog, SetTeleporter, @@ -89,6 +90,7 @@ public enum CustomRPC Teleport, Conceal, GoCovert, + LighterOn, FlashGrenade, SetGlitch, diff --git a/source/Patches/LowLights.cs b/source/Patches/LowLights.cs index fd889a887..f13964ae0 100644 --- a/source/Patches/LowLights.cs +++ b/source/Patches/LowLights.cs @@ -18,7 +18,13 @@ public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] GameData.P return false; } - if (player.IsImpostor() || player._object.Is(RoleEnum.Glitch)) + SwitchSystem switchSystem = __instance.Systems[SystemTypes.Electrical].Cast(); + + if ( + player.IsImpostor() + || player._object.Is(RoleEnum.Glitch) + || (IsLighterAndLit(player) && !switchSystem.IsActive) + ) { __result = __instance.MaxLightRadius * PlayerControl.GameOptions.ImpostorLightMod; if (player.Object.Is(ModifierEnum.ButtonBarry)) @@ -27,9 +33,11 @@ public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] GameData.P return false; } - SwitchSystem switchSystem = __instance.Systems[SystemTypes.Electrical].Cast(); float lightPercentage = switchSystem.Value / 255f; - if (player._object.Is(ModifierEnum.Torch)) lightPercentage = 1; + if (player._object.Is(ModifierEnum.Torch) || IsLighterAndLit(player)) + { + lightPercentage = 1; + } __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, lightPercentage) * PlayerControl.GameOptions.CrewLightMod; @@ -43,5 +51,16 @@ public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] GameData.P } return false; } + + private static bool IsLighterAndLit(GameData.PlayerInfo player) + { + if (!player._object.Is(RoleEnum.Lighter)) + { + return false; + } + + Lighter lighter = Role.GetRole(player._object); + return lighter.IsLighting; + } } } \ No newline at end of file diff --git a/source/Patches/RoleEnum.cs b/source/Patches/RoleEnum.cs index 5ac6f8176..3a59bab70 100644 --- a/source/Patches/RoleEnum.cs +++ b/source/Patches/RoleEnum.cs @@ -34,6 +34,8 @@ public enum RoleEnum Prophet, [RoleDetails("Covert", "#7B7F1A", Faction.Crewmates)] Covert, + [RoleDetails("Lighter", "#FFCCCB", Faction.Crewmates)] + Lighter, [RoleDetails("Jester", "#FFBFCCFF", Faction.Neutral)] Jester, diff --git a/source/Patches/Roles/Lighter.cs b/source/Patches/Roles/Lighter.cs new file mode 100644 index 000000000..3ae982f55 --- /dev/null +++ b/source/Patches/Roles/Lighter.cs @@ -0,0 +1,69 @@ +using UnityEngine; + +namespace TownOfUs.Roles +{ + public class Lighter : RoleWithCooldown + { + private KillButton _lighterButton; + public float LighterTimeRemaining; + public bool IsLighting { get; private set; } + + public Lighter(PlayerControl player) : base(player, RoleEnum.Covert, CustomGameOptions.CovertCooldown) + { + ImpostorText = () => "Need a light?"; + TaskText = () => "Use your lighter for extra visibility."; + } + + protected override void DoOnGameStart() + { + base.DoOnGameStart(); + LighterTimeRemaining = 0f; + } + + protected override void DoOnMeetingEnd() + { + base.DoOnMeetingEnd(); + LighterTimeRemaining = 0f; + } + + public KillButton LighterButton + { + get => _lighterButton; + set + { + _lighterButton = value; + ExtraButtons.Clear(); + ExtraButtons.Add(value); + } + } + + public void LightTick() + { + if (!IsLighting) + { + return; + } + + if (LighterTimeRemaining > 0f) + { + LighterTimeRemaining -= Time.deltaTime; + } + else + { + LightOff(); + } + } + + public void LightOn() + { + IsLighting = true; + LighterTimeRemaining = CustomGameOptions.LighterDuration; + } + + private void LightOff() + { + IsLighting = false; + ResetCooldownTimer(); + } + } +} diff --git a/source/Patches/RpcHandling.cs b/source/Patches/RpcHandling.cs index 0a56743df..38a0ee057 100644 --- a/source/Patches/RpcHandling.cs +++ b/source/Patches/RpcHandling.cs @@ -487,6 +487,13 @@ public static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1) role.GoCovert(); break; } + case CustomRPC.LighterOn: + { + PlayerControl lighter = Utils.PlayerById(reader.ReadByte()); + Lighter role = Role.GetRole(lighter); + role.LightOn(); + break; + } case CustomRPC.SetMimic: var glitchPlayer = Utils.PlayerById(reader.ReadByte()); var mimicPlayer = Utils.PlayerById(reader.ReadByte()); @@ -640,6 +647,9 @@ public static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1) case CustomRPC.SetCovert: new Covert(Utils.PlayerById(reader.ReadByte())); break; + case CustomRPC.SetLighter: + new Lighter(Utils.PlayerById(reader.ReadByte())); + break; case CustomRPC.SetBigBoi: new BigBoiModifier(Utils.PlayerById(reader.ReadByte())); break; @@ -847,6 +857,9 @@ public static void Postfix() if (Check(CustomGameOptions.CovertOn)) CrewmateRoles.Add((typeof(Covert), CustomRPC.SetCovert, CustomGameOptions.CovertOn)); + + if (Check(CustomGameOptions.LighterOn)) + CrewmateRoles.Add((typeof(Lighter), CustomRPC.SetLighter, CustomGameOptions.LighterOn)); #endregion #region Neutral Roles if (Check(CustomGameOptions.ArsonistOn)) diff --git a/source/Resources/Lighter.png b/source/Resources/Lighter.png new file mode 100644 index 0000000000000000000000000000000000000000..edda6e1022f4c4fb49e89ea36f533c425639eb53 GIT binary patch literal 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RKk9 z;xNJ=d#dV{6al z%jT)$z#rR1?#CW~nsB?|aJW0rFr-LKAvDH^7K7hsVLkZSgdK3=+O}=y1R!E3Rr(P z?cp$^8ZuiHygX0j*SzJ9S$?j;$T!JBQ=nOSbXpo!mJ_~~lW3A@;VvW&HNO6w;9H`3 zHTLXiZmn!-ymGz{eJGG%Wmx;DN?n6pi=~y5wQJ+u{pbRf_+PaFA}N@gFI^tW-8AZ* zv1A{_MeOgyTW^o-SkvpvbUDpG$#zs)FVIQIeboi8*33zM!RRZcr9S`I3BN%jZ)fOf z9AX^xauA`*I`eUf*{MeeAFfrYE6@3->aSw%w$qaGp)`3HDJ*HLtQpfo7t2PNhoL{7 ze%fM}tq#>(r&a5q?`!+EIeB$PaqrSzxODzohNh-x%dWXO@doNYSW zQl~q%f4S}Pq>Qo1wuY`Yapk;`r=#8_r|2j4mZFR5?nEx+7qNZy0hl4^+bB$tMVd+X z|B`o#EKIuRHQ0ZXsu;j0-slMN2Rx5_1w0iIb>t^t=~QmZW50Sj7}#arV%hil|ahkT_OsUNDG311ScD^CVDJ|14#3kM$^ z)E!QR_z8+ZcJ1AX);j6RMPFWj#|6!{Ac$9r7DoMWt-nsuEhLq&y_!sEK}V4n<_Jd9 z-)?la=5Caw1cXO6G|yBdDp8I3Y4F5VIzJwM(>uR5!;)?OiwCeXss{Qmb9$9SYyZ9o N13e?%YVEuC{|6$s&))z5 literal 0 HcmV?d00001 diff --git a/source/TownOfUs.cs b/source/TownOfUs.cs index 29ba40ba7..c036c8be5 100644 --- a/source/TownOfUs.cs +++ b/source/TownOfUs.cs @@ -52,6 +52,7 @@ public partial class TownOfUs : BasePlugin public static Sprite FlashSprite; public static Sprite ButtonSprite; public static Sprite TeleportSprite; + public static Sprite LighterSprite; public static Sprite PolusSprite; public static Sprite CycleSprite; @@ -103,6 +104,7 @@ public override void Load() FlashSprite = CreateSprite("TownOfUs.Resources.Flash.png"); ButtonSprite = CreateSprite("TownOfUs.Resources.Button.png"); TeleportSprite = CreateSprite("TownOfUs.Resources.Teleport.png"); + LighterSprite = CreateSprite("TownOfUs.Resources.Lighter.png"); DragSprite = CreateSprite("TownOfUs.Resources.Drag.png"); DropSprite = CreateSprite("TownOfUs.Resources.Drop.png"); PolusSprite = CreateSprite("TownOfUs.Resources.polus.gg.png"); diff --git a/source/TownOfUs.csproj b/source/TownOfUs.csproj index 58d2e6fdf..61337cf14 100644 --- a/source/TownOfUs.csproj +++ b/source/TownOfUs.csproj @@ -2,8 +2,8 @@ netstandard2.1 - 2.9.0 - 2.9.0 + 3.0.0 + 3.0.0 embedded @@ -15,7 +15,7 @@ - + From e6af27c6d50227b1aa7ad1c28adf53ed490f43bb Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Sat, 22 Jan 2022 01:09:50 -0600 Subject: [PATCH 2/8] Lighter settings weren't setting --- source/Patches/CustomOption/Generate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Patches/CustomOption/Generate.cs b/source/Patches/CustomOption/Generate.cs index 41cc28c95..6085a7557 100644 --- a/source/Patches/CustomOption/Generate.cs +++ b/source/Patches/CustomOption/Generate.cs @@ -447,8 +447,8 @@ public static void GenerateAll() CovertDuration = new CustomNumberOption(num++, "Covert Duration", 15f, 5f, 30f, 2.5f, CooldownFormat); Lighter = new CustomHeaderOption(num++, $"{RoleDetailsAttribute.GetRoleDetails(RoleEnum.Lighter).GetColoredName()}"); - CovertCooldown = new CustomNumberOption(num++, "Lighter Cooldown", 20f, 5f, 60f, 2.5f, CooldownFormat); - CovertDuration = new CustomNumberOption(num++, "Lighter Duration", 5f, 1f, 10f, 2.5f, CooldownFormat); + LighterCooldown = new CustomNumberOption(num++, "Lighter Cooldown", 20f, 5f, 60f, 2.5f, CooldownFormat); + LighterDuration = new CustomNumberOption(num++, "Lighter Duration", 5f, 1f, 10f, 2.5f, CooldownFormat); #endregion From c1cf8c78aff62401335416e6438c0fa6a2a34ba7 Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Sat, 22 Jan 2022 01:26:13 -0600 Subject: [PATCH 3/8] Tweaked the Lighter's color to be less Jester --- source/Patches/RoleEnum.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Patches/RoleEnum.cs b/source/Patches/RoleEnum.cs index 3a59bab70..7f4c8fa08 100644 --- a/source/Patches/RoleEnum.cs +++ b/source/Patches/RoleEnum.cs @@ -34,7 +34,7 @@ public enum RoleEnum Prophet, [RoleDetails("Covert", "#7B7F1A", Faction.Crewmates)] Covert, - [RoleDetails("Lighter", "#FFCCCB", Faction.Crewmates)] + [RoleDetails("Lighter", "#DE876D", Faction.Crewmates)] Lighter, [RoleDetails("Jester", "#FFBFCCFF", Faction.Neutral)] From a163d3cb0c3cda7c0711e6da3de79c4d9459242f Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Thu, 27 Jan 2022 14:23:59 -0600 Subject: [PATCH 4/8] fix(Lighter): Can be assassinated --- source/Patches/CustomGameOptions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Patches/CustomGameOptions.cs b/source/Patches/CustomGameOptions.cs index c936e9d8c..a54c0138f 100644 --- a/source/Patches/CustomGameOptions.cs +++ b/source/Patches/CustomGameOptions.cs @@ -164,6 +164,7 @@ public static List GetEnabledRoles(params Faction[] factions) if (On(AltruistOn)) enabledRoles.Add(RoleEnum.Altruist); if (On(ProphetOn)) enabledRoles.Add(RoleEnum.Prophet); if (On(CovertOn)) enabledRoles.Add(RoleEnum.Covert); + if (On(LighterOn)) enabledRoles.Add(RoleEnum.Lighter); } else if (faction == Faction.Neutral) { From aec9ec1f90e13bfcea41306a8bd018f952d1f334 Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Tue, 15 Mar 2022 19:07:07 -0500 Subject: [PATCH 5/8] fix(lighter): Some erroneous uses of Covert --- .../Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs | 4 ++-- source/Patches/Roles/Lighter.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs b/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs index 456319a7f..bd8ede9fe 100644 --- a/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs +++ b/source/Patches/CrewmateRoles/LighterMod/ManageLighterButton.cs @@ -15,7 +15,7 @@ public static void Postfix(HudManager __instance) PlayerControl.AllPlayerControls.Count <= 1 || PlayerControl.LocalPlayer == null || PlayerControl.LocalPlayer.Data == null - || !PlayerControl.LocalPlayer.Is(RoleEnum.Covert) + || !PlayerControl.LocalPlayer.Is(RoleEnum.Lighter) ) { return; @@ -34,7 +34,7 @@ public static void Postfix(HudManager __instance) if (role.IsLighting) { - role.LighterButton.SetCoolDown(role.LighterTimeRemaining, CustomGameOptions.CovertDuration); + role.LighterButton.SetCoolDown(role.LighterTimeRemaining, CustomGameOptions.LighterDuration); return; } diff --git a/source/Patches/Roles/Lighter.cs b/source/Patches/Roles/Lighter.cs index 3ae982f55..9582b2ec4 100644 --- a/source/Patches/Roles/Lighter.cs +++ b/source/Patches/Roles/Lighter.cs @@ -8,7 +8,7 @@ public class Lighter : RoleWithCooldown public float LighterTimeRemaining; public bool IsLighting { get; private set; } - public Lighter(PlayerControl player) : base(player, RoleEnum.Covert, CustomGameOptions.CovertCooldown) + public Lighter(PlayerControl player) : base(player, RoleEnum.Lighter, CustomGameOptions.LighterCooldown) { ImpostorText = () => "Need a light?"; TaskText = () => "Use your lighter for extra visibility."; From db158df10c0f13e9655760d71938c78c2ab0e367 Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Tue, 15 Mar 2022 19:12:44 -0500 Subject: [PATCH 6/8] v3.1.0 --- README.md | 10 ++++++++++ source/TownOfUs.csproj | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66443919a..2db0014f7 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,16 @@ An Among Us mod that adds a bunch of roles, modifiers and game settings Changelog
    +
  • +
    + v3.1.0 +
      +
    • Added new role: Lighter.
    • +
    • Modifiers now more visible on role assignment screen.
    • +
    +
    +
  • +
  • v3.0.0 diff --git a/source/TownOfUs.csproj b/source/TownOfUs.csproj index 61337cf14..07da14834 100644 --- a/source/TownOfUs.csproj +++ b/source/TownOfUs.csproj @@ -2,8 +2,8 @@ netstandard2.1 - 3.0.0 - 3.0.0 + 3.1.0 + embedded From 6432fb26c58a43930fe9445bc5c2fe737099094c Mon Sep 17 00:00:00 2001 From: ItsTheNumberH Date: Sun, 20 Feb 2022 14:34:26 +0000 Subject: [PATCH 7/8] Lover dissappears after meeting when other lover is voted out --- source/Patches/CrewmateRoles/LoversMod/Die.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Patches/CrewmateRoles/LoversMod/Die.cs b/source/Patches/CrewmateRoles/LoversMod/Die.cs index 9549a1e28..c1411714e 100644 --- a/source/Patches/CrewmateRoles/LoversMod/Die.cs +++ b/source/Patches/CrewmateRoles/LoversMod/Die.cs @@ -17,9 +17,10 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] DeathRe var otherLover = Role.GetRole(__instance).OtherLover.Player; if (otherLover.Data.IsDead) return true; - if (reason == DeathReason.Exile) KillButtonTarget.DontRevive = __instance.PlayerId; - - if (AmongUsClient.Instance.AmHost) Utils.RpcMurderPlayer(otherLover, otherLover); + if (reason == DeathReason.Exile) { + KillButtonTarget.DontRevive = __instance.PlayerId; + otherLover.Exiled(); + } else if (AmongUsClient.Instance.AmHost) Utils.RpcMurderPlayer(otherLover, otherLover); return true; } From 66d9a65cb4283d450060c8b025218aac3037e4cd Mon Sep 17 00:00:00 2001 From: Kevin Binswanger Date: Tue, 15 Mar 2022 19:55:57 -0500 Subject: [PATCH 8/8] v3.1.1 --- README.md | 9 +++++++++ source/TownOfUs.csproj | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2db0014f7..602014ff7 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,15 @@ An Among Us mod that adds a bunch of roles, modifiers and game settings Changelog
      +
    • +
      + v3.1.1 +
        +
      • If the Lover dies because the other Lover is voted out, they will not leave a body behind. Thanks ItsTheNumberH.
      • +
      +
      +
    • +
    • v3.1.0 diff --git a/source/TownOfUs.csproj b/source/TownOfUs.csproj index 07da14834..85bf3c436 100644 --- a/source/TownOfUs.csproj +++ b/source/TownOfUs.csproj @@ -2,7 +2,7 @@ netstandard2.1 - 3.1.0 + 3.1.1 embedded