Initial Brogether prototype

This commit is contained in:
Kroonk
2026-05-23 00:38:59 +02:00
commit 536cbff829
9 changed files with 866 additions and 0 deletions

41
scripts/install-local.ps1 Normal file
View File

@@ -0,0 +1,41 @@
param(
[string]$BrotatoDir = "C:\Program Files (x86)\Steam\steamapps\common\Brotato",
[string]$WorkshopItemId = "",
[string]$Version = "0.1.0"
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$packageScript = Join-Path $PSScriptRoot "package.ps1"
$zipPath = Join-Path $root "dist\Brogether-Brogether-$Version.zip"
$legacyModsDir = Join-Path $BrotatoDir "mods"
$steamAppsDir = Split-Path -Parent (Split-Path -Parent $BrotatoDir)
$workshopContentDir = Join-Path $steamAppsDir "workshop\content\1942280"
& $packageScript -Version $Version
if (-not (Test-Path $workshopContentDir)) {
throw "Workshop content folder not found: $workshopContentDir"
}
if ([string]::IsNullOrWhiteSpace($WorkshopItemId)) {
$workshopItem = Get-ChildItem -Path $workshopContentDir -Directory |
Where-Object { $_.Name -match '^\d+$' } |
Select-Object -First 1
if ($null -eq $workshopItem) {
throw "No subscribed Brotato workshop folder found in $workshopContentDir. Subscribe to any Brotato workshop mod once, then rerun this script."
}
} else {
$workshopItem = Get-Item -LiteralPath (Join-Path $workshopContentDir $WorkshopItemId) -ErrorAction Stop
}
Get-ChildItem -Path $workshopContentDir -Recurse -Filter "Brogether-Brogether-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path $workshopContentDir -Recurse -Filter "PotatoConnect-PotatoConnect-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path $legacyModsDir -Filter "Brogether-Brogether-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem -Path $legacyModsDir -Filter "PotatoConnect-PotatoConnect-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
Copy-Item -LiteralPath $zipPath -Destination (Join-Path $workshopItem.FullName (Split-Path -Leaf $zipPath)) -Force
Write-Host "Installed to workshop item folder $($workshopItem.FullName)"
Write-Host "Start Brotato from Steam, then use F6 on host and F7 on client."

40
scripts/package.ps1 Normal file
View File

@@ -0,0 +1,40 @@
param(
[string]$Version = "0.1.0"
)
$ErrorActionPreference = "Stop"
Add-Type -AssemblyName System.IO.Compression
Add-Type -AssemblyName System.IO.Compression.FileSystem
$root = Split-Path -Parent $PSScriptRoot
$source = Join-Path $root "src"
$dist = Join-Path $root "dist"
$zipPath = Join-Path $dist "Brogether-Brogether-$Version.zip"
if (-not (Test-Path $source)) {
throw "Missing source folder: $source"
}
New-Item -ItemType Directory -Force -Path $dist | Out-Null
if (Test-Path $zipPath) {
Remove-Item -LiteralPath $zipPath -Force
}
$archive = [System.IO.Compression.ZipFile]::Open($zipPath, [System.IO.Compression.ZipArchiveMode]::Create)
try {
$sourceRoot = (Resolve-Path $source).Path.TrimEnd('\', '/')
Get-ChildItem -Path $sourceRoot -Recurse -File | ForEach-Object {
$relativePath = $_.FullName.Substring($sourceRoot.Length + 1).Replace('\', '/')
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
$archive,
$_.FullName,
$relativePath,
[System.IO.Compression.CompressionLevel]::Optimal
) | Out-Null
}
}
finally {
$archive.Dispose()
}
Write-Host "Created $zipPath"