From 98ef5306a610c364e3087f7d252b2de7d282cc36 Mon Sep 17 00:00:00 2001 From: Herp Derpinstine Date: Sun, 22 Dec 2024 04:51:51 -0600 Subject: [PATCH] Fixed Janitor Fires, Fixed Object Desync --- Patches/Patch_GameManager.cs | 25 ++++++++++++++----------- Security/CollectibleSecurity.cs | 3 +++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Patches/Patch_GameManager.cs b/Patches/Patch_GameManager.cs index 1430af1..cd8b3c5 100644 --- a/Patches/Patch_GameManager.cs +++ b/Patches/Patch_GameManager.cs @@ -137,8 +137,10 @@ private static bool ServerFirePlayer_Prefix( { // Get LobbyPlayer LobbyPlayer player = __0.GetComponent(); - if (player == null) - return true; + if ((player == null) + || player.WasCollected + || player.IsGhost()) + return false; if (player.NetworkisFired && (player.NetworkplayerRole != PlayerRole.Janitor)) @@ -156,11 +158,17 @@ private static bool ServerFirePlayer_Prefix( // Get Janitor Count var janitorList = LobbyManager.instance.GetJanitorPlayers(); - bool flag = !player.NetworkisFired - && (player.NetworkplayerRole != PlayerRole.Janitor) + bool flag = !player.IsJanitor() && (__instance.NetworkjanitorAmount > 0) && (janitorList.Count < __instance.NetworkjanitorAmount); + // Reset Termination Timer + __instance.RpcResetTerminationTimer(__instance.terminationMaxTime); + + // End Meeting + if (!__1) + __instance.ServerFinnishMeeting(); + // Reset Workstation if (__2) player.ServerSetWorkStation(null, player.NetworkplayerRole, true); @@ -171,6 +179,8 @@ private static bool ServerFirePlayer_Prefix( // Assign Janitor Role if (flag) player.ServerSetPlayerRole(PlayerRole.Janitor); + else + player.ServerSetPlayerRole(PlayerRole.None); // Apply Fired State player.NetworkisFired = true; @@ -179,13 +189,6 @@ private static bool ServerFirePlayer_Prefix( if (__instance.isServer) VoteBoxController.instance.ServerResetVote(); - // Reset Termination Timer - __instance.RpcResetTerminationTimer(__instance.terminationMaxTime); - - // End Meeting - if (!__1) - __instance.ServerFinnishMeeting(); - // End Match if Winner is Found if (!__1 && (InteractionSecurity.GetWinner(__instance) != PlayerRole.None)) diff --git a/Security/CollectibleSecurity.cs b/Security/CollectibleSecurity.cs index 36eaf10..b5e8acd 100644 --- a/Security/CollectibleSecurity.cs +++ b/Security/CollectibleSecurity.cs @@ -180,6 +180,9 @@ private static IEnumerator SpawnAndPlaceCoroutine(GameObject prefab, Z hol yield return new WaitForSeconds(1f); + gameObject.transform.position = holder.transform.position; + gameObject.transform.rotation = holder.transform.rotation; + T obj = gameObject.GetComponent(); holder.CmdPlaceCollectible(obj.netIdentity, obj.Networklabel);