Skip to content

Commit

Permalink
Fixed Janitor Fires, Fixed Object Desync
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Dec 22, 2024
1 parent 66c51ea commit 98ef530
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Patches/Patch_GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ private static bool ServerFirePlayer_Prefix(
{
// Get LobbyPlayer
LobbyPlayer player = __0.GetComponent<LobbyPlayer>();
if (player == null)
return true;
if ((player == null)
|| player.WasCollected
|| player.IsGhost())
return false;

if (player.NetworkisFired
&& (player.NetworkplayerRole != PlayerRole.Janitor))
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions Security/CollectibleSecurity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ private static IEnumerator SpawnAndPlaceCoroutine<T, Z>(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<T>();
holder.CmdPlaceCollectible(obj.netIdentity, obj.Networklabel);

Expand Down

0 comments on commit 98ef530

Please sign in to comment.