Esempio n. 1
0
        static bool Prefix()
        {
            if (Multiplayer.Client == null)
            {
                return(true);
            }
            if (LongEventHandler.currentEvent != null)
            {
                return(false);
            }
            if (Multiplayer.session.desynced)
            {
                return(false);
            }

            double delta    = Time.deltaTime * 60.0;
            int    maxDelta = MultiplayerMod.settings.aggressiveTicking ? 6 : 3;

            if (delta > maxDelta)
            {
                delta = maxDelta;
            }

            accumulator += delta;

            float okDelta = MultiplayerMod.settings.aggressiveTicking ? 2.5f : 1.7f;

            if (Timer >= tickUntil)
            {
                accumulator = 0;
            }
            else if (!Multiplayer.IsReplay && delta < okDelta && tickUntil - Timer > 6)
            {
                accumulator += Math.Min(60, tickUntil - Timer - 6);
            }

            if (Multiplayer.IsReplay && replayTimeSpeed == TimeSpeed.Paused)
            {
                accumulator = 0;
            }

            if (skipToTickUntil)
            {
                skipTo = tickUntil;
            }

            CheckFinishSkipping();

            SimpleProfiler.Start();
            updateTimer.Restart();
            Tick();
            lastUpdateTook = updateTimer.ElapsedMillisDouble();
            SimpleProfiler.Pause();

            CheckFinishSkipping();

            return(false);
        }
Esempio n. 2
0
        static bool Prefix()
        {
            if (Multiplayer.Client == null)
            {
                return(true);
            }
            if (LongEventHandler.currentEvent != null)
            {
                return(false);
            }
            if (Multiplayer.session.desynced)
            {
                return(false);
            }

            double delta = Time.deltaTime * 60.0;

            if (delta > 3)
            {
                delta = 3;
            }

            accumulator += delta;

            if (Timer >= tickUntil)
            {
                accumulator = 0;
            }
            else if (!Multiplayer.IsReplay && delta < 1.5 && tickUntil - Timer > 6)
            {
                accumulator += Math.Min(100, tickUntil - Timer - 6);
            }

            if (Multiplayer.IsReplay && replayTimeSpeed == TimeSpeed.Paused)
            {
                accumulator = 0;
            }

            if (skipToTickUntil)
            {
                skipTo = tickUntil;
            }

            if (skipTo >= 0 && Timer >= skipTo)
            {
                afterSkip?.Invoke();
                ClearSkipping();
            }

            SimpleProfiler.Start();
            Tick();
            SimpleProfiler.Pause();

            return(false);
        }