Beispiel #1
0
        public static void Postfix()
        {
            if (rewinding)
            {
                Rewind();
            }
            else
            {
                Record();
            }

            if (rewinding)
            {
                foreach (var role in Role.GetRoles(RoleEnum.TimeLord))
                {
                    var timeLord = (TimeLord)role;
                    if (timeLord.IsRewinding)
                    {
                        timeLord.TimeRemaining -= Time.deltaTime;
                    }
                    else
                    {
                        StartStop.StopRewind(timeLord);
                    }
                }
            }
        }
        public static void Postfix()
        {
            if (rewinding)
            {
                Rewind();
            }
            else
            {
                Record();
            }

            foreach (var role in Role.GetRoles(RoleEnum.TimeLord))
            {
                var TimeLord = (TimeLord)role;
                if ((DateTime.UtcNow - TimeLord.StartRewind).TotalMilliseconds >
                    CustomGameOptions.RewindDuration * 1000f && TimeLord.FinishRewind < TimeLord.StartRewind)
                {
                    StartStop.StopRewind(TimeLord);
                }
            }
        }
Beispiel #3
0
        public static bool Prefix(KillButtonManager __instance)
        {
            if (__instance != DestroyableSingleton <HudManager> .Instance.KillButton)
            {
                return(true);
            }
            var flag = PlayerControl.LocalPlayer.Is(RoleEnum.TimeLord);

            if (!flag)
            {
                return(true);
            }
            var role = Role.GetRole <TimeLord>(PlayerControl.LocalPlayer);

            if (!PlayerControl.LocalPlayer.CanMove)
            {
                return(false);
            }
            if (PlayerControl.LocalPlayer.Data.IsDead)
            {
                return(false);
            }
            var flag2 = (role.CooldownTimer() == 0f) & !RecordRewind.rewinding;

            if (!flag2)
            {
                return(false);
            }
            if (!__instance.enabled)
            {
                return(false);
            }
            StartStop.StartRewind(role);
            var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                    (byte)CustomRPC.Rewind, SendOption.Reliable, -1);

            writer.Write(PlayerControl.LocalPlayer.PlayerId);
            AmongUsClient.Instance.FinishRpcImmediately(writer);
            return(false);
        }
Beispiel #4
0
        private static void Rewind()
        {
            if (Minigame.Instance)
            {
                try
                {
                    Minigame.Instance.Close();
                }
                catch
                {
                }
            }
            //System.Console.WriteLine("Rewinding...");
            //System.Console.Write(points.Count);

            if (points.Count > 2)
            {
                points.RemoveAt(0);
                points.RemoveAt(0);
                if (PlayerControl.LocalPlayer.inVent)
                {
                    PlayerControl.LocalPlayer.MyPhysics.RpcExitVent(Vent.currentVent.Id);
                    PlayerControl.LocalPlayer.MyPhysics.ExitAllVents();
                }

                if (!PlayerControl.LocalPlayer.inVent)
                {
                    if (!PlayerControl.LocalPlayer.Collider.enabled)
                    {
                        PlayerControl.LocalPlayer.MyPhysics.ResetMoveState();
                        PlayerControl.LocalPlayer.Collider.enabled     = true;
                        PlayerControl.LocalPlayer.NetTransform.enabled = true;


                        var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                                (byte)CustomRPC.FixAnimation, SendOption.Reliable, -1);
                        writer.Write(PlayerControl.LocalPlayer.PlayerId);
                        AmongUsClient.Instance.FinishRpcImmediately(writer);
                    }


                    var currentPoint = points[0];

                    PlayerControl.LocalPlayer.transform.position = currentPoint.position;
                    PlayerControl.LocalPlayer.gameObject.GetComponent <Rigidbody2D>().velocity =
                        currentPoint.velocity * 3;

                    if (isDead && currentPoint.unix < deadTime && PlayerControl.LocalPlayer.Data.IsDead &&
                        CustomGameOptions.RewindRevive)
                    {
                        var player = PlayerControl.LocalPlayer;

                        ReviveBody(player);
                        player.myTasks.RemoveAt(0);

                        deadTime = 0;
                        isDead   = false;

                        var write = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,
                                                                               (byte)CustomRPC.RewindRevive, SendOption.Reliable, -1);
                        write.Write(PlayerControl.LocalPlayer.PlayerId);
                        AmongUsClient.Instance.FinishRpcImmediately(write);
                    }
                }

                points.RemoveAt(0);
            }

            else
            {
                StartStop.StopRewind(whoIsRewinding);
            }
        }