param(
    [string]$GameRoot = "D:\SteamLibrary\steamapps\common\ProjectZomboid"
)

$ErrorActionPreference = "Stop"

$targetClass = Join-Path $GameRoot "zombie\vehicles\BaseVehicle.class"
$backupClass = "$targetClass.landtrain.original"

if (Test-Path $backupClass) {
    Copy-Item $backupClass $targetClass -Force
    Write-Output "Restored BaseVehicle.class from $backupClass"
} elseif (Test-Path $targetClass) {
    Remove-Item $targetClass -Force
    Write-Output "Removed override class at $targetClass (game will use class from projectzomboid.jar)"
} else {
    Write-Output "No override or backup found. Nothing to restore."
}
