//08/20/2026
class CrankModeMutator extends Mutator;

var float TextWidth, TextHeight;
var float CenterX, CenterY;
var float StartTime;
var float EndTime;
var float ElapsedTime;
var float MaxFreezeTime;

simulated function Tick(float DeltaTime)
{
    if (!bHUDMutator && Level.NetMode != NM_DedicatedServer)
        RegisterHUDMutator();
}

simulated function PostRender(Canvas C)
{
    local string Warning;
    local ChallengeHUD MyHUD;
    
    if (C.Viewport.Actor == None || C.Viewport.Actor.Inventory == None)
    {
         return;
    }
    
    if (VSize(C.Viewport.Actor.Velocity) <= 10.0)
    {
        if (StartTime == 0.0)
        {
            StartTime = C.Viewport.Actor.Level.TimeSeconds;
        }
        else
        {
            EndTime = C.Viewport.Actor.Level.TimeSeconds;
        }
        
        ElapsedTime = EndTime - StartTime;
        Warning = "You are not moving..." @ string(ElapsedTime);

        if (ElapsedTime >= MaxFreezeTime)
        {
            StartTime = 0.0;
            C.Viewport.Actor.Health = 1;
            C.Viewport.Actor.Suicide();
        }
    }
    else
    {
        StartTime = 0.0;
        Warning = "";
    }
    
    MyHUD = ChallengeHUD(C.Viewport.Actor.myHUD);
    C.Font = MyHUD.MyFonts.GetMediumFont(C.ClipX);
    C.TextSize(Warning, TextWidth, TextHeight);
    CenterX = (C.SizeX * 0.5) - (TextWidth * 0.5);
    CenterY = (C.SizeY * 0.4) - (TextHeight * 0.4);
    C.SetPos(CenterX, CenterY);
    C.DrawColor.R = 255;
    C.DrawColor.G = 255;
    C.DrawColor.B = 255;
    C.DrawText(Warning);
}

defaultproperties {
    bAlwaysRelevant=True
    bNetTemporary=True
    RemoteRole=ROLE_SimulatedProxy
    MaxFreezeTime=3.0
}
