# Enable/disable modlets for vanilla 7 Days to Die testing # Copies modlets to/from the Steam Mods folder param( [Parameter(Mandatory=$true)] [ValidateSet("enable", "disable", "status", "sync")] [string]$Action ) $steamModsPath = "C:\Steam\steamapps\common\7 Days To Die\Mods" $repoModsPath = "C:\Users\lynda\Git\lyndas_mod\mods" if (-not (Test-Path $steamModsPath)) { Write-Error "Steam Mods folder not found: $steamModsPath" exit 1 } if (-not (Test-Path $repoModsPath)) { Write-Error "Repo mods folder not found: $repoModsPath" exit 1 } function Get-Modlets { Get-ChildItem -Path $repoModsPath -Directory | Where-Object { $_.Name -ne "README.md" } } function Enable-Modlets { $modlets = Get-Modlets if ($modlets.Count -eq 0) { Write-Host "No modlets found in $repoModsPath" return } foreach ($modlet in $modlets) { $targetPath = Join-Path $steamModsPath $modlet.Name $sourcePath = $modlet.FullName if (Test-Path $targetPath) { Write-Warning "Already exists (skipping): $targetPath" continue } Copy-Item -Path $sourcePath -Destination $targetPath -Recurse -Force Write-Host "Enabled: $($modlet.Name)" } } function Disable-Modlets { $modlets = Get-Modlets if ($modlets.Count -eq 0) { Write-Host "No modlets found in $repoModsPath" return } foreach ($modlet in $modlets) { $targetPath = Join-Path $steamModsPath $modlet.Name if (-not (Test-Path $targetPath)) { Write-Warning "Not found (skipping): $targetPath" continue } Remove-Item -LiteralPath $targetPath -Recurse -Force Write-Host "Disabled: $($modlet.Name)" } } function Sync-Modlets { $modlets = Get-Modlets if ($modlets.Count -eq 0) { Write-Host "No modlets found in $repoModsPath" return } foreach ($modlet in $modlets) { $targetPath = Join-Path $steamModsPath $modlet.Name $sourcePath = $modlet.FullName if (-not (Test-Path $targetPath)) { Write-Host "Not enabled, skipping: $($modlet.Name)" continue } Copy-Item -Path $sourcePath -Destination $targetPath -Recurse -Force Write-Host "Synced: $($modlet.Name)" } } function Show-Status { $modlets = Get-Modlets if ($modlets.Count -eq 0) { Write-Host "No modlets found in $repoModsPath" return } Write-Host "`nModlet Status:" Write-Host "--------------" foreach ($modlet in $modlets) { $targetPath = Join-Path $steamModsPath $modlet.Name $status = if (Test-Path $targetPath) { "ENABLED" } else { "disabled" } Write-Host "$($modlet.Name): $status" } Write-Host "" } switch ($Action) { "enable" { Enable-Modlets } "disable" { Disable-Modlets } "status" { Show-Status } "sync" { Sync-Modlets } }