LifePlay-Revival/Tools/NewMod.ps1
edujiro5972 5a2829ebd9 H3d : metadonnees des mods, avertissement de version, paquet lpr_hair_pocolov (12 coiffures)
- LPModInfoSubsystem : metadonnees des .lpmod ; fenetre d'avertissement quand un mod actif
  a ete construit pour une autre version du jeu (Slate, sans Blueprint).
- NewMod/BuildMod : MODULE_VERSION, _CREATED, _LICENSE, _AUTHOR_LINK, _PRICE, _PACKAGED,
  _GAME_VERSION ; ordre des 3 premieres lignes controle ; prix et licences controles.
- lpr_hair_pocolov 1.0 : les 12 coiffures Pocolov CC BY ; lp_Revival et les 6 Pocolov
  retires du jeu de base ; mod d'essai LPHairSample retire.

Valide en jeu le 2026-10-03 (CHG-106, CHG-107).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:14:37 +02:00

78 lines
3.7 KiB
PowerShell

<#
.SYNOPSIS
Cree le squelette d'un mod d'assets (lot H3c, Docs/Modding/FullGuides/Creating_Asset_Mods.md).
.DESCRIPTION
Cree ModSources\<Nom>\ :
<Nom>.uplugin plugin de contenu (assets cuits a part du jeu)
Content\ assets du mod (a remplir dans l'editeur : Tools/EditMod.ps1)
Module\<Nom>.lpmod module LifePlay (MODULE_UNIQUEID = <Nom>, active depuis le gestionnaire de mods)
Module\CREDITS.txt credits et licences des assets
et, avec -Hairs, Tools\mods\<Nom>.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"