Files
gregCore/scripts/New-StreamingAssetModPack.ps1

75 lines
2.1 KiB
PowerShell

param(
[Parameter(Mandatory = $true)]
[string]$GamePath,
[Parameter(Mandatory = $true)]
[string]$ModName,
[switch]$Force
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$streamingRoot = Join-Path $GamePath "Data Center_Data\StreamingAssets"
$modsRoot = Join-Path $streamingRoot "Mods"
$packRoot = Join-Path $modsRoot $ModName
if (-not (Test-Path $streamingRoot)) {
throw "StreamingAssets not found: $streamingRoot"
}
New-Item -ItemType Directory -Path $modsRoot -Force | Out-Null
if ((Test-Path $packRoot) -and -not $Force) {
throw "Mod pack already exists: $packRoot (use -Force to overwrite files)"
}
New-Item -ItemType Directory -Path $packRoot -Force | Out-Null
$configPath = Join-Path $packRoot "config.json"
$modelObjPath = Join-Path $packRoot "model.obj"
$modelMtlPath = Join-Path $packRoot "model.mtl"
$texturePath = Join-Path $packRoot "texture.png"
$iconPath = Join-Path $packRoot "icon.png"
$config = @"
{
"id": "$ModName",
"name": "$ModName",
"description": "Custom object pack scaffold generated by gregCore",
"category": "server",
"enabled": true,
"model": "model.obj",
"material": "model.mtl",
"texture": "texture.png",
"icon": "icon.png",
"notes": "Align keys with latest ExampleMod schema for your game version"
}
"@
Set-Content -Path $configPath -Value $config -Encoding UTF8
if (-not (Test-Path $modelObjPath) -or $Force) {
Set-Content -Path $modelObjPath -Value "# TODO: Place your OBJ mesh here" -Encoding UTF8
}
if (-not (Test-Path $modelMtlPath) -or $Force) {
Set-Content -Path $modelMtlPath -Value "# TODO: Place your MTL material here" -Encoding UTF8
}
if (-not (Test-Path $texturePath) -or $Force) {
Set-Content -Path $texturePath -Value "PNG_PLACEHOLDER" -Encoding UTF8
}
if (-not (Test-Path $iconPath) -or $Force) {
Set-Content -Path $iconPath -Value "PNG_PLACEHOLDER" -Encoding UTF8
}
Write-Host "Created mod pack scaffold: $packRoot"
Write-Host "Next steps:"
Write-Host " 1) Replace model.obj/model.mtl/texture.png/icon.png with real assets"
Write-Host " 2) Align config.json to current ExampleMod schema"
Write-Host " 3) Start game and verify object appears in shop"