<# .SYNOPSIS Cree le squelette d'un mod d'assets (lot H3c, Docs/Modding/FullGuides/Creating_Asset_Mods.md). .DESCRIPTION Cree ModSources\\ : .uplugin plugin de contenu (assets cuits a part du jeu) Content\ assets du mod (a remplir dans l'editeur : Tools/EditMod.ps1) Module\.lpmod module LifePlay (MODULE_UNIQUEID = , active depuis le gestionnaire de mods) Module\CREDITS.txt credits et licences des assets et, avec -Hairs, Tools\mods\.json (configuration de Tools/HairPipeline.ps1, liste de coiffures vide). Refuse un nom deja pris (sources, module du jeu ou plugin). .EXAMPLE .\Tools\NewMod.ps1 -Name MyHairPack -Title "My Hair Pack" -Author "Me" -License "CC BY 4.0" -AuthorLink https://example.org -Hairs #> param( [Parameter(Mandatory)] [ValidatePattern('^[A-Za-z][A-Za-z0-9_]{2,40}$')] [string] $Name, [Parameter(Mandatory)] [string] $Title, [Parameter(Mandatory)] [string] $Author, [string] $Description = '', [string] $Link = '', [string] $ModVersion = '1.0', [string] $License = '', [string] $AuthorLink = '', [string] $Price = 'Free', [switch] $Hairs ) $ErrorActionPreference = 'Stop' $Root = Split-Path $PSScriptRoot -Parent $src = Join-Path $Root "ModSources\$Name" foreach ($taken in $src, (Join-Path $Root "Mods\$Name"), (Join-Path $Root "Content\Modules\$Name"), (Join-Path $Root "Plugins\$Name")) { if (Test-Path $taken) { throw "Nom deja pris : $taken" } } $utf8 = New-Object Text.UTF8Encoding $false New-Item -ItemType Directory -Force (Join-Path $src 'Content'), (Join-Path $src 'Module') | Out-Null $plugin = [ordered]@{ FileVersion = 3; Version = 1; VersionName = $ModVersion FriendlyName = $Title Description = $(if ($Description) { $Description } else { "LifePlay mod: $Title" }) Category = 'LifePlay Mods'; CreatedBy = $Author CanContainContent = $true; IsBetaVersion = $false; Installed = $false } if ($AuthorLink) { $plugin.CreatedByURL = $AuthorLink } [IO.File]::WriteAllText((Join-Path $src "$Name.uplugin"), ($plugin | ConvertTo-Json) + "`r`n", $utf8) $lpmod = @( "MODULE_UNIQUEID: $Name", "MODULE_NAME: $Title", "MODULE_AUTHOR: $Author", "MODULE_LINK: $Link", "MODULE_DESCRIPTION: $(if ($Description) { $Description } else { $Title })", 'MODULE_REQUIREMENTS: vin_Base', # Metadonnees (H3d) ; MODULE_PACKAGED et MODULE_GAME_VERSION sont ecrites par BuildMod.ps1 dans la copie livree. "MODULE_VERSION: $ModVersion", "MODULE_CREATED: $(Get-Date -Format 'yyyy-MM-dd')", "MODULE_LICENSE: $License", "MODULE_AUTHOR_LINK: $AuthorLink", "MODULE_PRICE: $Price") [IO.File]::WriteAllText((Join-Path $src "Module\$Name.lpmod"), ($lpmod -join "`r`n") + "`r`n", $utf8) [IO.File]::WriteAllText((Join-Path $src 'Module\CREDITS.txt'), "Credits and licenses of the assets in $Title (one line per asset: title, author, license, source URL, changes).`r`n", $utf8) if ($Hairs) { $cfgPath = Join-Path $Root "Tools\mods\$Name.json" if (Test-Path $cfgPath) { throw "$cfgPath existe deja" } $cfg = [ordered]@{ mod = $Name; module = $Name; folder = "/$Name/Hairs" backup = "D:/Game/LifePlay_Backup_5.5/mods/$Name" hairs = @() } New-Item -ItemType Directory -Force (Split-Path $cfgPath -Parent) | Out-Null [IO.File]::WriteAllText($cfgPath, ($cfg | ConvertTo-Json -Depth 4) + "`r`n", $utf8) Write-Host "Configuration des coiffures : $cfgPath (ajouter les entrees de 'hairs', voir Tools/mods/lpr_hair_pocolov.json)" } Write-Host "Mod cree : $src" Write-Host "Suite : .\Tools\EditMod.ps1 -Name $Name (assets dans l'editeur), puis .\Tools\BuildMod.ps1 -Name $Name"