Нерабочий коммит

This commit is contained in:
2025-08-11 21:21:21 +07:00
parent 54c6762afe
commit a2d3d7625d
5 changed files with 95 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
ruinship_tournament_mods/

View File

@@ -1 +1,3 @@
# Установщик турнира RuinShip для RimWorld # Установщик турнира RuinShip для RimWorld
<span style="color: red;">Данный репозиторий никак не относится к администрации турнира и является по большей части независимым, фанатским проектом</span>

2
setup.bat Normal file
View File

@@ -0,0 +1,2 @@
@echo off
powershell -ExecutionPolicy Bypass -File "%~dp0setup.ps1"

33
setup.ps1 Normal file
View File

@@ -0,0 +1,33 @@
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$rimworldModsPath = Resolve-Path (Join-Path $scriptDir "..")
$tmpHtml = "$env:TEMP\ruinship_tournament_gd.html"
$ModsFilesId = "13im-l6X2j-s5scZZlBvt2DCjYBbk2qI8"
$OutFile = "$env:TEMP\ruinship_tournament_mods.zip"
Invoke-WebRequest -Uri "https://drive.google.com/uc?export=download&id=$ModsFilesId" -OutFile $tmpHtml -SessionVariable session
$htmlContent = Get-Content $tmpHtml -Raw
if ($htmlContent -match 'confirm=([0-9A-Za-z_]+)') {
$confirmToken = $matches[1]
if ($htmlContent -match 'name="uuid" value="([0-9a-f-]+)"') {
$uuid = $matches[1]
} else {
$uuid = ""
}
Write-Host "Found confirm-token: $confirmToken"
Write-Host "Found uuid: $uuid"
$downloadUrl = "https://drive.google.com/uc?export=download&confirm=$confirmToken&id=$ModsFilesId"
if ($uuid) {
$downloadUrl += "&uuid=$uuid"
}
Write-Host "Downloading from URL: $downloadUrl"
Invoke-WebRequest -Uri $downloadUrl -WebSession $session -OutFile $OutFile
} else {
Write-Host "No confirm token found, downloading directly..."
Invoke-WebRequest -Uri "https://drive.google.com/uc?export=download&id=$ModsFilesId" -WebSession $session -OutFile $OutFile
}
Write-Host "Extracting archive..."
Expand-Archive -Path $OutFile -DestinationPath $rimworldModsPath -Force

57
шаблон.ps1 Normal file
View File

@@ -0,0 +1,57 @@
# Указываем ссылки и пути
$repoUrl = "https://github.com/HypoxiE/rimworld-add-my-music-mod/archive/refs/heads/main.zip"
$zipPath = "$env:TEMP\custom_music.zip"
$extractPath = "$env:TEMP\custom_music_temp"
# Путь к папке Mods
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$steamappsPath = Resolve-Path (Join-Path $scriptDir "..\..\..\..")
if (-not($steamappsPath -like "*steamapps")){
Write-Host "[ERROR] The download is not possible because the mod is not located in the steamapps\workshop\content\294100\3523549667 folder" -ForegroundColor Red
Write-Host "[INFO] You can download the mod manually from the page https://github.com/HypoxiE/rimworld-add-my-music-mod if you are using an unlicensed version of the game"
Pause
exit
}
$rimworldMods = Join-Path $steamappsPath "common\RimWorld\Mods"
if (-not(Test-Path $rimworldMods)) {
Write-Host "[ERROR] The download is not possible because the game is not detected on the steamapps\common\RimWorld path" -ForegroundColor Red
Write-Host "[INFO] You can download the mod manually from the page https://github.com/HypoxiE/rimworld-add-my-music-mod if you are using an unlicensed version of the game"
Pause
exit
}
$instalationPath = Join-Path $rimworldMods "add_my_music_mod"
Write-Host "[DEBUG] Detected Steamapps: $steamappsPath"
Write-Host "[DEBUG] RimWorld Mods folder: $rimworldMods"
# Скачиваем и распаковываем архив
Write-Host "[INFO] Downloading mod from GitHub..."
Invoke-WebRequest -Uri $repoUrl -OutFile $zipPath
Write-Host "[INFO] Extracting..."
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
# Удаляем старую папку мода, если есть
if (Test-Path $instalationPath) {
Write-Host "[INFO] Removing old mod files..."
Remove-Item -Recurse -Force $instalationPath
}
# Переносим файлы в Mods
Write-Host "[INFO] Installing mod..."
$sourceFolder = Get-ChildItem $extractPath | Select-Object -First 1
Move-Item -Path $sourceFolder.FullName -Destination $instalationPath
# Создаём нужные папки
New-Item -ItemType Directory -Path (Join-Path $instalationPath "Defs\SongDefs") -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $instalationPath "Sounds\Gameplay") -Force | Out-Null
# Удаляем временные файлы
Write-Host "[INFO] Cleaning up..."
Remove-Item $zipPath
Remove-Item $extractPath -Recurse -Force
Write-Host "[INFO] Done! Mod installed to $instalationPath"
Write-Host "The installation is complete and the window can be closed. If you want to copy the path to the mod folder, press Enter" -ForegroundColor Green
Pause
Set-Clipboard -Value "$instalationPath"
Write-Host "[INFO] The path is copied"
Pause