From f9cebecd3f135b8ae23a338043eb99184db4f87b Mon Sep 17 00:00:00 2001 From: Eisbison Date: Sat, 27 Mar 2021 20:52:30 +0100 Subject: [PATCH] Version 1.8.2 --- README.md | 7 ++++- Source Code/Buttons.cs | 41 +++++++++++++++--------------- Source Code/CredentialsPatch.cs | 2 +- Source Code/EndGamePatch.cs | 4 +-- Source Code/GameOptionsPatch.cs | 7 +++++ Source Code/Helpers.cs | 2 +- Source Code/Main.cs | 2 +- Source Code/MeetingPatch.cs | 4 +-- Source Code/PlayerControlPatch.cs | 20 +++++++-------- Source Code/RPC.cs | 5 +--- Source Code/RoleAssignmentPatch.cs | 6 ++--- Source Code/TheOtherRoles.cs | 37 ++++++++++++++++++++++++++- Source Code/TheOtherRoles.csproj | 2 +- Source Code/UpdatePatch.cs | 33 +++++------------------- 14 files changed, 97 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 9884549..5a49153 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein # Releases | Among Us - Version| Mod Version | Link | |----------|-------------|-----------------| +| 2021.3.5s | v1.8.2 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.2/TheOtherRoles.zip) | 2021.3.5s | v1.8.1 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.1/TheOtherRoles.zip) | 2021.3.5s | v1.8 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8/TheOtherRoles.zip) | 2021.3.5s | v1.7 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.7/TheOtherRoles.zip) @@ -55,6 +56,10 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
Click to show the Changelog +**Hotfix 1.8.2** +- Add map and impostor count to lobby settings. +- Fixed bugs where changing players to be the Sidekick didn't reset all the effects of their previous role. + **Hotfix 1.8.1** Resolves bugs that occured when the Jackal recruited a Medic, Swapper and Tracker\ \ **Changes in v1.8:** @@ -106,7 +111,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
# Installation -1. Download and unzip the newest [release](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.1/TheOtherRoles.zip) +1. Download and unzip the newest [release](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.2/TheOtherRoles.zip) 2. Find the folder of your game, for steams players you can right click in steam, on the game, a menu will appear proposing you to go to the folders.3. Make a copy of your game, it's not obligatory but advise, put it where you want. 4. Drag or extract the files from the zip into your game, at the .exe level. 6. Run the game (the first launch might take a while) diff --git a/Source Code/Buttons.cs b/Source Code/Buttons.cs index 3f59c9b..6318128 100644 --- a/Source Code/Buttons.cs +++ b/Source Code/Buttons.cs @@ -46,13 +46,12 @@ namespace TheOtherRoles vampireKillButton.MaxTimer = Vampire.cooldown; trackerButton.MaxTimer = 0f; garlicButton.MaxTimer = 0f; - - spyButton.EffectDuration = Spy.duration; - vampireKillButton.EffectDuration= Vampire.delay; - jackalKillButton.MaxTimer = Jackal.cooldown; sidekickKillButton.MaxTimer = Sidekick.cooldown; jackalSidekickButton.MaxTimer = Jackal.createSidekickCooldown; + + spyButton.EffectDuration = Spy.duration; + vampireKillButton.EffectDuration= Vampire.delay; } public static void Postfix(HudManager __instance) @@ -62,13 +61,13 @@ namespace TheOtherRoles () => { engineerRepairButton.Timer = 0f; - MessageWriter usedRepairWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.EngineerUsedRepair, Hazel.SendOption.None, -1); + MessageWriter usedRepairWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.EngineerUsedRepair, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(usedRepairWriter); RPCProcedure.engineerUsedRepair(); foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixLights) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.EngineerFixLights, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.EngineerFixLights, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.engineerFixLights(); } else if (task.TaskType == TaskTypes.RestoreOxy) { @@ -113,7 +112,7 @@ namespace TheOtherRoles { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JanitorClean, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JanitorClean, Hazel.SendOption.Reliable, -1); writer.Write(playerInfo.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.janitorClean(playerInfo.PlayerId); @@ -137,7 +136,7 @@ namespace TheOtherRoles sheriffKillButton = new CustomButton( () => { if (Medic.shielded != null && Medic.shielded == Sheriff.currentTarget) { - MessageWriter attemptWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShieldedMurderAttempt, Hazel.SendOption.None, -1); + MessageWriter attemptWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShieldedMurderAttempt, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(attemptWriter); RPCProcedure.shieldedMurderAttempt(); return; @@ -153,7 +152,7 @@ namespace TheOtherRoles else { targetId = PlayerControl.LocalPlayer.PlayerId; } - MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SheriffKill, Hazel.SendOption.None, -1); + MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SheriffKill, Hazel.SendOption.Reliable, -1); killWriter.Write(targetId); AmongUsClient.Instance.FinishRpcImmediately(killWriter); RPCProcedure.sheriffKill(targetId); @@ -172,7 +171,7 @@ namespace TheOtherRoles // Time Master Rewind Time timeMasterRewindTimeButton = new CustomButton( () => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.TimeMasterRewindTime, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.TimeMasterRewindTime, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.timeMasterRewindTime(); timeMasterRewindTimeButton.Timer = timeMasterRewindTimeButton.MaxTimer; @@ -190,7 +189,7 @@ namespace TheOtherRoles () => { medicShieldButton.Timer = 0f; - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MedicSetShielded, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MedicSetShielded, Hazel.SendOption.Reliable, -1); writer.Write(Medic.currentTarget.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.medicSetShielded(Medic.currentTarget.PlayerId); @@ -209,7 +208,7 @@ namespace TheOtherRoles () => { shifterShiftButton.Timer = shifterShiftButton.MaxTimer; - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterShift, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterShift, Hazel.SendOption.Reliable, -1); writer.Write(Shifter.currentTarget.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -238,7 +237,7 @@ namespace TheOtherRoles targetOrMistake = players[index]; } - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SeerReveal, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SeerReveal, Hazel.SendOption.Reliable, -1); writer.Write(Seer.currentTarget.PlayerId); writer.Write(targetOrMistake.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -257,7 +256,7 @@ namespace TheOtherRoles morphlingButton = new CustomButton( () => { if (Morphling.sampledTarget != null) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MorphlingMorph, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MorphlingMorph, Hazel.SendOption.Reliable, -1); writer.Write(Morphling.sampledTarget.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.morphlingMorph(Morphling.sampledTarget.PlayerId); @@ -292,7 +291,7 @@ namespace TheOtherRoles // Camouflager camouflage camouflagerButton = new CustomButton( () => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.CamouflagerCamouflage, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.CamouflagerCamouflage, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.camouflagerCamouflage(); }, @@ -336,7 +335,7 @@ namespace TheOtherRoles // Tracker button trackerButton = new CustomButton( () => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.TrackerUsedTracker, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.TrackerUsedTracker, Hazel.SendOption.Reliable, -1); writer.Write(Tracker.currentTarget.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.trackerUsedTracker(Tracker.currentTarget.PlayerId); @@ -359,7 +358,7 @@ namespace TheOtherRoles } else { Vampire.bitten = Vampire.currentTarget; Reactor.Coroutines.Start(Vampire.killWithDelay()); - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireBiteNotification, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireBiteNotification, Hazel.SendOption.Reliable, -1); writer.Write(Vampire.bitten.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.vampireBiteNotification(Vampire.bitten.PlayerId); @@ -400,7 +399,7 @@ namespace TheOtherRoles Buffer.BlockCopy(BitConverter.GetBytes(pos.x), 0, buff, 0*sizeof(float), sizeof(float)); Buffer.BlockCopy(BitConverter.GetBytes(pos.y), 0, buff, 1*sizeof(float), sizeof(float)); - MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PlaceGarlic, Hazel.SendOption.None); + MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PlaceGarlic, Hazel.SendOption.Reliable); writer.WriteBytesAndSize(buff); writer.EndMessage(); RPCProcedure.placeGarlic(buff); @@ -418,7 +417,7 @@ namespace TheOtherRoles // Jackal Sidekick Button jackalSidekickButton = new CustomButton( () => { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JackalCreatesSidekick, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JackalCreatesSidekick, Hazel.SendOption.Reliable, -1); writer.Write(Jackal.currentTarget.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.jackalCreatesSidekick(Jackal.currentTarget.PlayerId); @@ -436,7 +435,7 @@ namespace TheOtherRoles () => { if (!Helpers.handleMurderAttempt(Jackal.currentTarget)) return; byte targetId = Jackal.currentTarget.PlayerId; - MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JackalKill, Hazel.SendOption.None, -1); + MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JackalKill, Hazel.SendOption.Reliable, -1); killWriter.Write(targetId); AmongUsClient.Instance.FinishRpcImmediately(killWriter); RPCProcedure.jackalKill(targetId); @@ -456,7 +455,7 @@ namespace TheOtherRoles () => { if (!Helpers.handleMurderAttempt(Sidekick.currentTarget)) return; byte targetId = Sidekick.currentTarget.PlayerId; - MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickKill, Hazel.SendOption.None, -1); + MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickKill, Hazel.SendOption.Reliable, -1); killWriter.Write(targetId); AmongUsClient.Instance.FinishRpcImmediately(killWriter); RPCProcedure.sidekickKill(targetId); diff --git a/Source Code/CredentialsPatch.cs b/Source Code/CredentialsPatch.cs index 28edb41..4fec516 100644 --- a/Source Code/CredentialsPatch.cs +++ b/Source Code/CredentialsPatch.cs @@ -12,7 +12,7 @@ namespace TheOtherRoles { static void Postfix(VersionShower __instance) { string spacer = new String('\n', 15); - string text = "[FCCE03FF]TheOtherRoles[] v1.8.1:\n- Modded by [FCCE03FF]Eisbison[] and [FFEB91FF]Thunderstorm584[]\n- Balanced with [FFEB91FF]Dhalucard"; + string text = "[FCCE03FF]TheOtherRoles[] v1.8.2:\n- Modded by [FCCE03FF]Eisbison[] and [FFEB91FF]Thunderstorm584[]\n- Balanced with [FFEB91FF]Dhalucard"; if (__instance.text.Text.Contains(spacer)) __instance.text.Text += "\n" + text; else diff --git a/Source Code/EndGamePatch.cs b/Source Code/EndGamePatch.cs index 4e84313..36a12c4 100644 --- a/Source Code/EndGamePatch.cs +++ b/Source Code/EndGamePatch.cs @@ -280,7 +280,7 @@ namespace TheOtherRoles { } private static bool CheckAndEndGameForJackalWin(ShipStatus __instance, PlayerStatistics statistics) { - if (statistics.TeamJackalAlive >= statistics.TotalAlive - statistics.TeamJackalAlive && statistics.TeamImpostorsAlive == 0 && !(statistics.TeamJackalHasAliveLover)) { + if (statistics.TeamJackalAlive >= statistics.TotalAlive - statistics.TeamJackalAlive && statistics.TeamImpostorsAlive == 0 && !(statistics.TeamJackalHasAliveLover && statistics.TeamLoversAlive == 2)) { if (!DestroyableSingleton.InstanceExists) { __instance.enabled = false; @@ -295,7 +295,7 @@ namespace TheOtherRoles { } private static bool CheckAndEndGameForImpostorWin(ShipStatus __instance, PlayerStatistics statistics) { - if (statistics.TeamImpostorsAlive >= statistics.TotalAlive - statistics.TeamImpostorsAlive && statistics.TeamJackalAlive == 0 && !(statistics.TeamImpostorHasAliveLover)) { + if (statistics.TeamImpostorsAlive >= statistics.TotalAlive - statistics.TeamImpostorsAlive && statistics.TeamJackalAlive == 0 && !(statistics.TeamImpostorHasAliveLover && statistics.TeamLoversAlive == 2)) { if (!DestroyableSingleton.InstanceExists) { __instance.enabled = false; GameOverReason endReason; diff --git a/Source Code/GameOptionsPatch.cs b/Source Code/GameOptionsPatch.cs index 1e88320..ef19ab3 100644 --- a/Source Code/GameOptionsPatch.cs +++ b/Source Code/GameOptionsPatch.cs @@ -75,4 +75,11 @@ namespace TheOtherRoles __result = hudString; } } + + [HarmonyPatch(typeof(GameSettingMenu), "OnEnable")] + class GameSettingMenuPatch { + public static void Prefix(GameSettingMenu __instance) { + __instance.HideForOnline = new Transform[]{}; + } + } } \ No newline at end of file diff --git a/Source Code/Helpers.cs b/Source Code/Helpers.cs index 0e9e96d..b6ad461 100644 --- a/Source Code/Helpers.cs +++ b/Source Code/Helpers.cs @@ -114,7 +114,7 @@ namespace TheOtherRoles { // Block impostor shielded kill if (Medic.shielded != null && Medic.shielded == target) { if (notifyOthers) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShieldedMurderAttempt, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShieldedMurderAttempt, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); } RPCProcedure.shieldedMurderAttempt(); diff --git a/Source Code/Main.cs b/Source Code/Main.cs index 06e5e9c..5114366 100644 --- a/Source Code/Main.cs +++ b/Source Code/Main.cs @@ -250,7 +250,7 @@ namespace TheOtherRoles // Terminate round if(Input.GetKeyDown(KeyCode.L)) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ForceEnd, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.forceEnd(); } diff --git a/Source Code/MeetingPatch.cs b/Source Code/MeetingPatch.cs index 52eb0d0..5a01785 100644 --- a/Source Code/MeetingPatch.cs +++ b/Source Code/MeetingPatch.cs @@ -199,7 +199,7 @@ namespace TheOtherRoles } if (firstPlayer != null && secondPlayer != null) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SwapperSwap, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SwapperSwap, Hazel.SendOption.Reliable, -1); writer.Write((byte)firstPlayer.TargetPlayerId); writer.Write((byte)secondPlayer.TargetPlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -287,7 +287,7 @@ namespace TheOtherRoles if (ExileController.Instance.exiled != null) { byte exiledId = ExileController.Instance.exiled.PlayerId; if ((Jester.jester != null && Jester.jester.PlayerId == exiledId) || (BountyHunter.bountyHunter != null && !BountyHunter.bountyHunter.Data.IsDead && BountyHunter.target != null && BountyHunter.target.PlayerId == exiledId)) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JesterBountyHunterWin, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JesterBountyHunterWin, Hazel.SendOption.Reliable, -1); writer.Write(exiledId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.jesterBountyHunterWin(exiledId); diff --git a/Source Code/PlayerControlPatch.cs b/Source Code/PlayerControlPatch.cs index 4eeae4a..ea8ad8d 100644 --- a/Source Code/PlayerControlPatch.cs +++ b/Source Code/PlayerControlPatch.cs @@ -27,7 +27,7 @@ namespace TheOtherRoles { if (TimeMaster.reviveDuringRewind && PlayerControl.LocalPlayer.Data.IsDead) { DeadPlayer deadPlayer = deadPlayers.Where(x => x.player == PlayerControl.LocalPlayer).FirstOrDefault(); if (deadPlayer != null && next.Item2 < deadPlayer.timeOfDeath) { - MessageWriter write = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte) CustomRPC.TimeMasterRevive, SendOption.None, -1); + MessageWriter write = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte) CustomRPC.TimeMasterRevive, Hazel.SendOption.Reliable, -1); write.Write(PlayerControl.LocalPlayer.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(write); RPCProcedure.timeMasterRevive(PlayerControl.LocalPlayer.PlayerId); @@ -158,10 +158,10 @@ namespace TheOtherRoles { } static void engineerUpdate() { - if (PlayerControl.LocalPlayer.Data.IsImpostor && Engineer.engineer != null) { + if (PlayerControl.LocalPlayer.Data.IsImpostor) { foreach (Vent vent in ShipStatus.Instance.AllVents) { if (vent.Field_7?.material != null) { - if (Engineer.engineer.inVent) { + if (Engineer.engineer != null && Engineer.engineer.inVent) { vent.Field_7.material.SetFloat("_Outline", 1f); vent.Field_7.material.SetColor("_OutlineColor", Engineer.color); } else if (vent.Field_7.material.GetColor("_AddColor") != Color.red) { @@ -173,26 +173,24 @@ namespace TheOtherRoles { } static void trackerUpdate() { - if (Tracker.tracker == null || Tracker.tracked == null) return; + if (Tracker.arrow?.arrow == null) return; - if (Tracker.arrow?.arrow != null && PlayerControl.LocalPlayer != Tracker.tracker) { + if (Tracker.tracker == null || PlayerControl.LocalPlayer != Tracker.tracker) { Tracker.arrow.arrow.SetActive(false); return; } - if (Tracker.arrow?.arrow != null && Tracker.tracked != null) { + if (Tracker.tracker != null && Tracker.tracked != null && PlayerControl.LocalPlayer == Tracker.tracker && !Tracker.tracker.Data.IsDead) { Tracker.timeUntilUpdate -= Time.fixedDeltaTime; if (Tracker.timeUntilUpdate <= 0f) { bool trackedOnMap = !Tracker.tracked.Data.IsDead; - System.Console.WriteLine("Update"); Vector3 position = Tracker.tracked.transform.position; if (!trackedOnMap) { // Check for dead body DeadBody body = UnityEngine.Object.FindObjectsOfType().FirstOrDefault(b => b.ParentId == Tracker.tracked.PlayerId); if (body != null) { trackedOnMap = true; position = body.transform.position; - System.Console.WriteLine("DeadBody"); } } @@ -348,7 +346,7 @@ namespace TheOtherRoles { if ((Lovers.lover1 != null && PAIBDFDMIGK == Lovers.lover1) || (Lovers.lover2 != null && PAIBDFDMIGK == Lovers.lover2)) { PlayerControl otherLover = PAIBDFDMIGK == Lovers.lover1 ? Lovers.lover2 : Lovers.lover1; if (PlayerControl.LocalPlayer == PAIBDFDMIGK && otherLover != null && !otherLover.Data.IsDead && Lovers.bothDie) { // Only the dead lover sends the rpc - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.LoverSuicide, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.LoverSuicide, Hazel.SendOption.Reliable, -1); writer.Write(otherLover.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.loverSuicide(otherLover.PlayerId); @@ -357,7 +355,7 @@ namespace TheOtherRoles { // Sidekick promotion trigger on murder if (Sidekick.promotesToJackal && Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead && PAIBDFDMIGK == Jackal.jackal) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickPromotes, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickPromotes, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.sidekickPromotes(); } @@ -390,7 +388,7 @@ namespace TheOtherRoles { // Sidekick promotion trigger on exile if (Sidekick.promotesToJackal && Sidekick.sidekick != null && !Sidekick.sidekick.Data.IsDead && __instance == Jackal.jackal) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickPromotes, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SidekickPromotes, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.sidekickPromotes(); } diff --git a/Source Code/RPC.cs b/Source Code/RPC.cs index ea20c46..39cf9e2 100644 --- a/Source Code/RPC.cs +++ b/Source Code/RPC.cs @@ -530,10 +530,7 @@ namespace TheOtherRoles if(player == Lighter.lighter) Lighter.clearAndReload(); if(player == Detective.detective) Detective.clearAndReload(); if(player == TimeMaster.timeMaster) TimeMaster.clearAndReload(); - if(player == Medic.medic) { - if (Medic.shielded != null) Medic.shielded.myRend.material.SetFloat("_Outline", 0f); - Medic.clearAndReload(); - } + if(player == Medic.medic) Medic.clearAndReload(); if(player == Shifter.shifter) Shifter.clearAndReload(); if(player == Seer.seer) Seer.clearAndReload(); if(player == Spy.spy) Spy.clearAndReload(); diff --git a/Source Code/RoleAssignmentPatch.cs b/Source Code/RoleAssignmentPatch.cs index 3f11320..79a20d0 100644 --- a/Source Code/RoleAssignmentPatch.cs +++ b/Source Code/RoleAssignmentPatch.cs @@ -22,7 +22,7 @@ namespace TheOtherRoles } private static void setRoleToPlayer(byte roleId, byte playerId) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRole, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetRole, Hazel.SendOption.Reliable, -1); writer.Write(roleId); writer.Write(playerId); AmongUsClient.Instance.FinishRpcImmediately(writer); @@ -31,7 +31,7 @@ namespace TheOtherRoles public static void Postfix(Il2CppReferenceArray FMAOEJEHPAO) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ResetVaribles, Hazel.SendOption.None, -1); + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ResetVaribles, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.resetVariables(); @@ -155,7 +155,7 @@ namespace TheOtherRoles // byte targetId = availableTargets[rnd.Next(0, availableTargets.Count)].PlayerId; // crewmates.RemoveAt(bountyHunterIndex); // setRoleToPlayer((byte)RoleId.BountyHunter, bountyHunterId); - // writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBountyHunterTarget, Hazel.SendOption.None, -1); + // writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBountyHunterTarget, Hazel.SendOption.Reliable, -1); // writer.Write(targetId); // AmongUsClient.Instance.FinishRpcImmediately(writer); // RPCProcedure.setBountyHunterTarget(targetId); diff --git a/Source Code/TheOtherRoles.cs b/Source Code/TheOtherRoles.cs index 4b53622..13f56d3 100644 --- a/Source Code/TheOtherRoles.cs +++ b/Source Code/TheOtherRoles.cs @@ -221,6 +221,7 @@ namespace TheOtherRoles public static void clearAndReload() { medic = null; + if (shielded?.myRend?.material != null) shielded.myRend.material.SetFloat("_Outline", 0f); shielded = null; currentTarget = null; usedShield = false; @@ -342,8 +343,20 @@ namespace TheOtherRoles public static PlayerControl morphTarget; public static float morphTimer = 0f; + public static void resetMorph() { + morphTarget = null; + morphTimer = 0f; + if (morphling == null) return; + morphling.SetName(morphling.Data.PlayerName); + morphling.SetHat(morphling.Data.HatId, (int)morphling.Data.ColorId); + Helpers.setSkinWithAnim(morphling.MyPhysics, morphling.Data.SkinId); + morphling.SetPet(morphling.Data.PetId); + morphling.CurrentPet.Visible = morphling.Visible; + morphling.SetColor(morphling.Data.ColorId); + } public static void clearAndReload() { + resetMorph(); morphling = null; currentTarget = null; sampledTarget = null; @@ -379,7 +392,23 @@ namespace TheOtherRoles return buttonSprite; } + public static void resetCamouflage() { + camouflageTimer = 0f; + foreach (PlayerControl p in PlayerControl.AllPlayerControls) { + if (p == null) continue; + if (Morphling.morphling == null || Morphling.morphling != p) { + p.SetName(p.Data.PlayerName); + p.SetHat(p.Data.HatId, (int)p.Data.ColorId); + Helpers.setSkinWithAnim(p.MyPhysics, p.Data.SkinId); + p.SetPet(p.Data.PetId); + p.CurrentPet.Visible = p.Visible; + p.SetColor(p.Data.ColorId); + } + } + } + public static void clearAndReload() { + resetCamouflage(); camouflager = null; camouflageTimer = 0f; cooldown = TheOtherRolesPlugin.camouflagerCooldown.GetValue(); @@ -482,6 +511,7 @@ namespace TheOtherRoles usedTracker = false; timeUntilUpdate = 0f; updateIntervall = TheOtherRolesPlugin.trackerUpdateIntervall.GetValue(); + if (arrow?.arrow != null) UnityEngine.Object.Destroy(arrow.arrow); arrow = new Arrow(Color.blue); if (arrow.arrow != null) arrow.arrow.SetActive(false); } @@ -517,7 +547,7 @@ namespace TheOtherRoles public static IEnumerator killWithDelay() { yield return new WaitForSeconds(delay); - MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireTryKill, Hazel.SendOption.None, -1); + MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireTryKill, Hazel.SendOption.Reliable, -1); AmongUsClient.Instance.FinishRpcImmediately(killWriter); RPCProcedure.vampireTryKill(); } @@ -543,6 +573,11 @@ namespace TheOtherRoles public static int taskCountForImpostors = 1; public static void clearAndReload() { + if (localArrows != null) { + foreach (Arrow arrow in localArrows) + if (arrow?.arrow != null) + UnityEngine.Object.Destroy(arrow.arrow); + } localArrows = new List(); taskCountForImpostors = Mathf.RoundToInt(TheOtherRolesPlugin.snitchLeftTasksForImpostors.GetValue()); snitch = null; diff --git a/Source Code/TheOtherRoles.csproj b/Source Code/TheOtherRoles.csproj index efe2bc5..983010a 100644 --- a/Source Code/TheOtherRoles.csproj +++ b/Source Code/TheOtherRoles.csproj @@ -5,7 +5,7 @@ NuclearPowered/Mappings:0.2.0 TheOtherRoles - Eibison + Eisbison diff --git a/Source Code/UpdatePatch.cs b/Source Code/UpdatePatch.cs index df44591..0dfc018 100644 --- a/Source Code/UpdatePatch.cs +++ b/Source Code/UpdatePatch.cs @@ -280,40 +280,20 @@ namespace TheOtherRoles // Everyone but morphling reset if (oldCamouflageTimer > 0f && Camouflager.camouflageTimer <= 0f) { - foreach (PlayerControl p in PlayerControl.AllPlayerControls) { - if (Morphling.morphling == null || Morphling.morphling != p) { - if (Seer.seer == null || Seer.seer != PlayerControl.LocalPlayer) - p.SetName(p.Data.PlayerName); - p.SetHat(p.Data.HatId, (int)p.Data.ColorId); - Helpers.setSkinWithAnim(p.MyPhysics, p.Data.SkinId); - p.SetPet(p.Data.PetId); - p.CurrentPet.Visible = p.Visible; - p.SetColor(p.Data.ColorId); - } - } + Camouflager.resetCamouflage(); } // Morphling reset if ((oldMorphTimer > 0f || oldCamouflageTimer > 0f) && Camouflager.camouflageTimer <= 0f && Morphling.morphTimer <= 0f && Morphling.morphling != null) { - Morphling.morphTarget = null; - if (Seer.seer == null || Seer.seer != PlayerControl.LocalPlayer) - Morphling.morphling.SetName(Morphling.morphling.Data.PlayerName); - Morphling.morphling.SetHat(Morphling.morphling.Data.HatId, (int)Morphling.morphling.Data.ColorId); - Helpers.setSkinWithAnim(Morphling.morphling.MyPhysics, Morphling.morphling.Data.SkinId); - Morphling.morphling.SetPet(Morphling.morphling.Data.PetId); - Morphling.morphling.CurrentPet.Visible = Morphling.morphling.Visible; - Morphling.morphling.SetColor(Morphling.morphling.Data.ColorId); + Morphling.resetMorph(); } } public static void childUpdate() { foreach (PlayerControl p in PlayerControl.AllPlayerControls) { if (p == null) continue; - - if (Child.child == null) { - p.transform.localScale = new Vector3(0.7f, 0.7f, 1f); - return; - } + p.transform.localScale = new Vector3(0.7f, 0.7f, 1f); + if (Child.child == null) continue; float growingProgress = Child.growingProgress(); float scale = growingProgress * 0.35f + 0.35f; @@ -361,10 +341,11 @@ namespace TheOtherRoles } static void snitchUpdate() { - if (Snitch.snitch == null) return; + if (Snitch.localArrows == null) return; foreach (Arrow arrow in Snitch.localArrows) arrow.arrow.SetActive(false); - if (Snitch.snitch.Data.IsDead) return; + + if (Snitch.snitch == null || Snitch.snitch.Data.IsDead) return; int numberOfTasks = 0; GameData.PlayerInfo playerInfo = Snitch.snitch.Data; -- 2.39.5