]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Version 1.8.2
authorEisbison <eisbison.creator@gmail.com>
Sat, 27 Mar 2021 19:52:30 +0000 (20:52 +0100)
committerEisbison <eisbison.creator@gmail.com>
Sat, 27 Mar 2021 19:52:30 +0000 (20:52 +0100)
14 files changed:
README.md
Source Code/Buttons.cs
Source Code/CredentialsPatch.cs
Source Code/EndGamePatch.cs
Source Code/GameOptionsPatch.cs
Source Code/Helpers.cs
Source Code/Main.cs
Source Code/MeetingPatch.cs
Source Code/PlayerControlPatch.cs
Source Code/RPC.cs
Source Code/RoleAssignmentPatch.cs
Source Code/TheOtherRoles.cs
Source Code/TheOtherRoles.csproj
Source Code/UpdatePatch.cs

index 98845498fda28f3fdb5efc386ba3bb6c7a096026..5a49153b762551d9a43df4d941740925af6ec3b9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 # Releases\r
 | Among Us - Version| Mod Version | Link |\r
 |----------|-------------|-----------------|\r
+| 2021.3.5s | v1.8.2 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.2/TheOtherRoles.zip)\r
 | 2021.3.5s | v1.8.1 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.1/TheOtherRoles.zip)\r
 | 2021.3.5s | v1.8 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8/TheOtherRoles.zip)\r
 | 2021.3.5s | v1.7 | [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.7/TheOtherRoles.zip)\r
@@ -55,6 +56,10 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 <details>\r
   <summary>Click to show the Changelog</summary>\r
 \r
+**Hotfix 1.8.2**\r
+- Add map and impostor count to lobby settings.\r
+- Fixed bugs where changing players to be the Sidekick didn't reset all the effects of their previous role. \r
+\r
 **Hotfix 1.8.1** Resolves bugs that occured when the Jackal recruited a Medic, Swapper and Tracker\\r
 \\r
 **Changes in v1.8:**\r
@@ -106,7 +111,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 </details>\r
 \r
 # Installation \r
-1. Download and unzip the newest [release](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.1/TheOtherRoles.zip)\r
+1. Download and unzip the newest [release](https://github.com/Eisbison/TheOtherRoles/releases/download/v1.8.2/TheOtherRoles.zip)\r
 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.\r
 4. Drag or extract the files from the zip into your game, at the .exe level.\r
 6. Run the game (the first launch might take a while)\r
index 3f59c9bebc28b4c3ef44c403118bd7c4f5e230f6..63181280dd6ddd64efcb8760526237ce82dd45cb 100644 (file)
@@ -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);
index 28edb415af2aa2f8071a2b83915acfd01ed80ab7..4fec516da3cac5d009009163f1c3e96534861d6a 100644 (file)
@@ -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
index 4e84313790f3ee85a4bb0cfc8942655af9fd7dea..36a12c4e40379e3937ea92f71c374d028a7fc969 100644 (file)
@@ -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<TutorialManager>.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<TutorialManager>.InstanceExists) {
                     __instance.enabled = false;
                     GameOverReason endReason;
index 1e8832070ffff9e7ca67d0ff71d0ed94dd2a3268..ef19ab3251a46242ba1d1f5729312d8ef44e8fa1 100644 (file)
@@ -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
index 0e9e96d5a2b4ad68058cd924dcf9c7b0c859b2dc..b6ad461adfce93bfe1a15e166bb8750fc5559baf 100644 (file)
@@ -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();
index 06e5e9cb8afe76a0cd0dcae5967f6e1788c24f56..51143667a69e149ec6622218d99d29d9dbca8205 100644 (file)
@@ -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();
             }
index 52eb0d0052ef675a0d2e64b0e360515de5dbbbe3..5a017852380b3512d7ad720a5dae971d2e2689ee 100644 (file)
@@ -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);
index 4eeae4a55c3bbe4a7960708a2c9fe52b5b513aff..ea8ad8db9c8cbe121b66a2d5e9786ffcd3909cd8 100644 (file)
@@ -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<DeadBody>().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();
             }
index ea20c462410c1440822d9633cbd9afe328ffd6e4..39cf9e20afcc957ba50f3b660a2a886d520b83fe 100644 (file)
@@ -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();
index 3f11320013f16c30498559b70a05281739eb0329..79a20d043f05b452a82f4eeb4c4bb92f7ac501e9 100644 (file)
@@ -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<GameData.PlayerInfo> 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);
index 4b53622da253f934dc7d45241093a98fc81bcacc..13f56d3054484750e4fff5d9d7f73b845cfdd0a0 100644 (file)
@@ -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<Arrow>();
             taskCountForImpostors = Mathf.RoundToInt(TheOtherRolesPlugin.snitchLeftTasksForImpostors.GetValue());
             snitch = null;
index efe2bc5afce06f62a5ad9985ba9b3182c0373b83..983010a24f220dc237cb2fd8502737d0d6bec3e5 100644 (file)
@@ -5,7 +5,7 @@
         <Mappings>NuclearPowered/Mappings:0.2.0</Mappings>
 
         <Description>TheOtherRoles</Description>
-        <Authors>Eibison</Authors>
+        <Authors>Eisbison</Authors>
     </PropertyGroup>
 
     <PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
index df44591b7c46d409ab4b1696d22bda342d3034af..0dfc018e5c04cb95b374ce2c1f6c1725f2c523f9 100644 (file)
@@ -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;