jammerware / x2mods-dev-scripts

Powershell scripts to assist with development of XCOM 2 mods and to liberate the masses from ModBuddy.
The Unlicense
1 stars 2 forks source link

Support for multiple script packages in a mod #3

Open jammerware opened 7 years ago

jammerware commented 7 years ago

Snippet from robojumper to get started with:

# before compiling:
# the mod's packages, only those .u files will be copied to the output
[System.String[]]$thismodpackages = Get-ChildItem "$modSrcRoot/Src" 

# in the clean up when a full rebuild is not forced:

    # clean mod's compiled script
    Write-Host "Cleaning existing mod's compiled script from $sdkPath/XComGame/Script..."
    for ($i=0; $i -lt $thismodpackages.length; $i++) {
        MaybeDelete -path "$sdkPath\XComGame\Script\$thismodpackages[$i].u"
    }
    Write-Host "Cleaned."

#when copying compiled packages:
# copy compiled mod scripts to the staging area
Write-Host "Copying the compiled mod scripts to staging..."
for ($i=0; $i -lt $thismodpackages.length; $i++) {
    $name = $thismodpackages[$i]
    Copy-Item "$sdkPath/XComGame/Script/$name.u" "$stagingPath/Script" -Force -WarningAction SilentlyContinue
    Write-Host "$sdkPath/XComGame/Script/$name.u"
}
Write-Host "Copied compiled script packages."