public static void bendTimeUpdate() { if (TimeMaster.isRewinding) { if (localPlayerPositions.Count > 0) { // Set position var next = localPlayerPositions[0]; if (!PlayerControl.LocalPlayer.inVent) { PlayerControl.LocalPlayer.transform.position = next.Item1; } localPlayerPositions.RemoveAt(0); if (localPlayerPositions.Count > 0) { localPlayerPositions.RemoveAt(0); // Skip every second position to rewinde in half the time } // Try reviving LOCAL player 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); write.Write(PlayerControl.LocalPlayer.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(write); RPCProcedure.timeMasterRevive(PlayerControl.LocalPlayer.PlayerId); } } } else { TimeMaster.isRewinding = false; PlayerControl.LocalPlayer.moveable = true; HudManager.Instance.FullScreen.enabled = false; } } else { while (localPlayerPositions.Count >= Mathf.Round(TimeMaster.rewindTime / Time.fixedDeltaTime)) { localPlayerPositions.RemoveAt(localPlayerPositions.Count - 1); } localPlayerPositions.Insert(0, new Tuple <Vector3, DateTime>(PlayerControl.LocalPlayer.transform.position, DateTime.UtcNow)); } }
static void Postfix(byte ACCJCEHMKLN, MessageReader HFPCBBHJIPJ) { byte packetId = ACCJCEHMKLN; MessageReader reader = HFPCBBHJIPJ; switch (packetId) { // Main Controls case (byte)CustomRPC.ResetVaribles: RPCProcedure.resetVariables(); break; case (byte)CustomRPC.ForceEnd: RPCProcedure.forceEnd(); break; case (byte)CustomRPC.SetRole: byte roleId = HFPCBBHJIPJ.ReadByte(); byte playerId = HFPCBBHJIPJ.ReadByte(); RPCProcedure.setRole(roleId, playerId); break; // Role functionality case (byte)CustomRPC.JesterWin: RPCProcedure.jesterWin(); break; case (byte)CustomRPC.EngineerFixLights: RPCProcedure.engineerFixLights(); break; case (byte)CustomRPC.EngineerUsedRepair: RPCProcedure.engineerUsedRepair(); break; case (byte)CustomRPC.JanitorClean: RPCProcedure.janitorClean(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.SheriffKill: RPCProcedure.sheriffKill(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.TimeMasterRewindTime: RPCProcedure.timeMasterRewindTime(); break; case (byte)CustomRPC.MedicSetShielded: RPCProcedure.medicSetShielded(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.ShieldedMurderAttempt: RPCProcedure.shieldedMurderAttempt(); break; case (byte)CustomRPC.TimeMasterRevive: RPCProcedure.timeMasterRevive(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.ShifterShift: RPCProcedure.shifterShift(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.SwapperSwap: byte playerId1 = HFPCBBHJIPJ.ReadByte(); byte playerId2 = HFPCBBHJIPJ.ReadByte(); RPCProcedure.swapperSwap(playerId1, playerId2); break; case (byte)CustomRPC.SeerReveal: RPCProcedure.seerReveal(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.MorphlingMorph: RPCProcedure.morphlingMorph(HFPCBBHJIPJ.ReadByte()); break; case (byte)CustomRPC.CamouflagerCamouflage: RPCProcedure.camouflagerCamouflage(); break; case (byte)CustomRPC.ChildDied: RPCProcedure.childDied(); break; case (byte)CustomRPC.LoverSuicide: RPCProcedure.loverSuicide(HFPCBBHJIPJ.ReadByte()); break; } }