Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.lnk
/*.code-workspace
BuildCache/
24 changes: 24 additions & 0 deletions .scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ $common = Join-Path -Path $ScriptDirectory "X2ModBuildCommon\build_common.ps1"
Write-Host "Sourcing $common"
. ($common)

# Controls automatic project verification powered by Xymanek's X2ProjectGenerator.
# In order for this to have any effect, X2ProjectGenerator.exe must be in your PATH.
# To enable, set this flag to $true. To disable, set it back to $false.
$useX2PG = $false

if ($useX2PG -and $null -ne (Get-Command "X2ProjectGenerator.exe" -ErrorAction SilentlyContinue)) {
Write-Host "Verifying project file..."
&"X2ProjectGenerator.exe" "$srcDirectory\YOUR_MOD_NAME_HERE" "--exclude-contents" "--verify-only"
if ($LASTEXITCODE -ne 0) {
ThrowFailure "Errors in project file."
}
}
else {
Write-Host "Skipping verification of project file."
}

$builder = [BuildProject]::new("$ModSafeName$", $srcDirectory, $sdkPath, $gamePath)

# Building against Highlander option 1:
Expand All @@ -23,9 +39,17 @@ $builder = [BuildProject]::new("$ModSafeName$", $srcDirectory, $sdkPath, $gamePa
# and uncomment the line:
# $builder.IncludeSrc("C:\Users\Iridar\Documents\Firaxis ModBuddy\X2WOTCCommunityHighlander\X2WOTCCommunityHighlander\Src")

# Building against Highlander option 3:
# Create an X2EMPT_HIGHLANDER_FOLDER environment variable (if it does not already exist)
# containing the path to your local Highlander repository or the Highlander's mod folder,
# then uncomment the line:
# $builder.IncludeSrc($env:X2EMPT_HIGHLANDER_FOLDER)

# Uncomment to use additional global Custom Src to build against.
# $builder.IncludeSrc("C:\Users\Iridar\Documents\Firaxis ModBuddy\CustomSrc")

# PLACEHOLDER_CUSTOMSRC: Used by SETUP.bat to configure custom source folders.

switch ($config)
{
"debug" {
Expand Down
8 changes: 7 additions & 1 deletion EnhancedModProjectTemplate.vstemplate
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@
<ProjectItem>.scripts\X2ModBuildCommon\XCOM2.targets</ProjectItem>

<ProjectItem>.gitignore</ProjectItem>
<ProjectItem ReplaceParameters="true">RUN_THIS.bat</ProjectItem>
<ProjectItem ReplaceParameters="true">SETUP_LEGACY.bat</ProjectItem>
<ProjectItem ReplaceParameters="true">SETUP.bat</ProjectItem>
<ProjectItem ReplaceParameters="true">build.bat</ProjectItem>
<ProjectItem ReplaceParameters="true">clean.bat</ProjectItem>
<ProjectItem>build_debug.bat</ProjectItem>
<ProjectItem>build_default.bat</ProjectItem>
<ProjectItem>replace_text.exe</ProjectItem>
<ProjectItem>vscode.code-workspace.default</ProjectItem>

<ProjectItem ReplaceParameters="true">Config\Base\XComEditor.ini</ProjectItem>
<ProjectItem ReplaceParameters="true">Config\Base\XComEngine.ini</ProjectItem>
Expand Down
8 changes: 7 additions & 1 deletion ProjectTemplate.x2proj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
<Content Include=".scripts\X2ModBuildCommon\XCOM2.targets" />
<Content Include=".gitignore" />
<Content Include="replace_text.exe" />
<Content Include="RUN_THIS.bat" />
<Content Include="SETUP.bat" />
<Content Include="SETUP_LEGACY.bat" />
<Content Include="build.bat" />
<Content Include="build_debug.bat" />
<Content Include="build_default.bat" />
<Content Include="clean.bat" />
<Content Include="vscode.code-workspace.default" />
<Content Include="ReadMe.txt" />
<Content Include="ModPreview.jpg"/>
<Content Include="ContentOptions.json"/>
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
![EMPT-Logo](https://github.com/Iridar/EnhancedModProjectTemplate/blob/master/ModPreview.jpg)

# Enhanced Mod Project Template
# Enhanced Mod Project Template

Enhanced Mod Project Template (EMPT) is an XCOM 2 War of the Chosen mod project template. It can be used to create new mods quickly, without spending time and effort on menial tasks, like setting up [X2ModBuildCommon](https://github.com/X2CommunityCore/X2ModBuildCommon) manually.
Enhanced Mod Project Template (EMPT) is an XCOM 2 War of the Chosen mod project template. It can be used to create new mods quickly, without spending time and effort on menial tasks, like manually setting up [X2ModBuildCommon](https://github.com/X2CommunityCore/X2ModBuildCommon).

It also contains Config Engine, and some commonly used or referenced snippets of Unreal Script, and some global macros.
It also contains Config Engine, some commonly used or referenced snippets of Unreal Script, and some global macros.

## Installation

Follow these instructions if you have not used EMPT previously.

1. Download the .zip archive with the [latest release](https://github.com/Iridar/EnhancedModProjectTemplate/releases/latest).
2. Put it here: `..\steamapps\common\XCOM 2 War of the Chosen SDK\Binaries\Win32\ModBuddy\Extensions\Application\ProjectTemplates\XCOM2Mod\1033`
3. Done. The next time you create a new mod project with modbuddy, select the Enhanced Mod project template.
3. Done. The next time you create a new mod project with ModBuddy, select the Enhanced Mod project template.

## Updating

Follow these instructions if you have already installed and used EMPT. Modbuddy caches the previously used Mod Project templates, so just replacing the file is not enough for the update to take effect.
Follow these instructions if you have already installed and used EMPT. ModBuddy caches the previously used Mod Project templates, so just replacing the file is not enough for the update to take effect.

1. Download the .zip archive with the [latest release](https://github.com/Iridar/EnhancedModProjectTemplate/releases/latest).
2. Move all files out of this folder: `..\steamapps\common\XCOM 2 War of the Chosen SDK\Binaries\Win32\ModBuddy\Extensions\Application\ProjectTemplates\XCOM2Mod\1033`
3. Start Modbuddy and click to create a new mod project. You should see only the Blank Project template.
4. Cancel the dialog and close Modbuddy.
3. Start ModBuddy and click to create a new mod project. You should see only the Blank Project template.
4. Cancel the dialog and close ModBuddy.
5. Move files back into the mentioned folder.
6. Put the updated EMPT .zip archive there as well, replacing the old file.
7. Done. The next time you create a new mod project with Modbuddy, the updated Enhanced Mod project template will be available.
7. Done. The next time you create a new mod project with ModBuddy, the updated Enhanced Mod project template will be available.

## Usage

1) Use Modbuddy to create the mod project using Enhanced Mod project template.
1) Use ModBuddy to create the mod project using the Enhanced Mod project template.

**Note:** when creating mod projects using this project template, it is **extremely important** that project Name, Solution name and Title match **exactly**. Otherwise there will be issues during first time setup and the mod project will become broken.
**Note:** when creating mod projects using this project template, it is **extremely important** that Project Name, Solution name, and Title match **exactly**. Otherwise, there will be issues during first-time setup, and the mod project will be broken.

2) Perform once-per-project setup by running the "RUN_THIS.bat" batch file inside the created mod project directory. The file will automatically delete itself afterwards.
2) Perform once-per-project setup by running the `SETUP.bat` batch file inside the created mod project directory. The file will automatically delete itself afterwards. If you wish to skip the guided setup and only use the pre-1.5 setup, you can run `SETUP_LEGACY.bat` instead.

3) Enjoy. If your mod project doesn't require some of the files and folders created by EMPT, feel free to delete them.

4) As with any other mod project that uses X2MobBuildCommon, you have to use [Alternative Mod Uploader](https://steamcommunity.com/sharedfiles/filedetails/?id=1134322341) to upload it to workshop.
4) As with any other mod project that uses X2ModBuildCommon, you have to use [Alternative Mod Uploader](https://steamcommunity.com/sharedfiles/filedetails/?id=1134322341) to upload it to the Steam Workshop.

## X2ModBuildCommon

EMPT includes [X2ModBuildCommon](https://github.com/X2CommunityCore/X2ModBuildCommon) of version 1.2.1.
EMPT includes version 1.2.1 of [X2ModBuildCommon](https://github.com/X2CommunityCore/X2ModBuildCommon).

### Localization

The localization files shipped with the mod project use UTF-8 encoding, so changes to them can be previewed by Git and other version control systems. Modbuddy creates UTF-16 localization files by default, so if you need more localization files, it is preferable to copy the existing ones, rather than create new ones.
The localization files shipped with the mod project use UTF-8 encoding, so changes to them can be previewed by Git and other version control systems. ModBuddy creates UTF-16 localization files by default, so if you need more localization files, it is preferable to copy the existing ones, rather than create new ones.

### Cooking

To enable cooking with X2MBC, open `.scripts\build.ps1` file and uncomment the `$builder.SetContentOptionsJsonFilename("ContentOptions.json")` line by removing the `#` at the start.
To enable cooking with X2MBC (if you have not already used `SETUP.bat` to do so), open the `.scripts\build.ps1` file and uncomment the `$builder.SetContentOptionsJsonFilename("ContentOptions.json")` line by removing the `#` at the start.

You can find some basic instructions for [cooking here](https://www.reddit.com/r/xcom2mods/wiki/index/cooking_for_dummies).

Expand All @@ -66,12 +66,12 @@ Help.uc is an Unreal Script helper class with Unreal Script snippets of commonly

## Building against Highlander

To build your mod against Highlander, run this command in Git terminal:
To build your mod against the Highlander (if you have not already configured X2MBC to do so), run this command in a Git terminal:

`git submodule add https://github.com/X2CommunityCore/X2WOTCCommunityHighlander.git`

Then open `.scripts\build.ps1` and uncomment the `$builder.IncludeSrc("$srcDirectory\X2WOTCCommunityHighlander\X2WOTCCommunityHighlander\Src")` line by removing the `#` at the start.
Then open `.scripts\build.ps1`, and uncomment the `$builder.IncludeSrc("$srcDirectory\X2WOTCCommunityHighlander\X2WOTCCommunityHighlander\Src")` line by removing the `#` at the start.

# Credits

[Find And Replace Text](http://fart-it.sourceforge.net/) command line tool (replace_text.exe) by by Lionello Lunesu
[Find And Replace Text](http://fart-it.sourceforge.net/) command line tool (replace_text.exe) by Lionello Lunesu
66 changes: 0 additions & 66 deletions RUN_THIS.bat

This file was deleted.

23 changes: 20 additions & 3 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

You must perform once-per-mod setup before you can begin working on your mod.

To do so, run "RUN_THIS.bat" in the mod project folder.
To do so, run either "SETUP.bat" or "SETUP_LEGACY.bat" in the mod project folder. "SETUP.bat" has the advantage of guiding you through a few common configuration steps, but these may not be relevant to your mod.

If you did not close Modbuddy, you will get a popup message about files being modified outside the source editor. Click "Yes to All".
If you did not close ModBuddy, you will get a popup message about files being modified outside the source editor. Click "Yes to All".

That is all.

Expand All @@ -13,12 +13,29 @@ IMPORTANT!!!
When you create the mod project, project Name, Solution name and Title must match *exactly*. Otherwise the first time setup will fail.


Enhanced Mod Project Template v1.4
Enhanced Mod Project Template v1.5

Get news and updates here:

https://github.com/Iridar/EnhancedModProjectTemplate

v1.5

Simplified X2PG setup to a Boolean flag in X2MBC. (Doesn't do anything if X2PG is unavailable, though.)
Added new guided setup script, which guides the user through:
- Finding the SDK and game folders
- Setting up a Git repository (does nothing if Git is unavailable)
- Enabling building against the Highlander, from any of the following:
- GitHub
- Project-specific path to a local copy of the Highlander
- Environment variable pointing to a local copy of the Highlander
- Toggling the X2PG flag in X2MBC
- Enabling cooking
- Enabling building against any number of extra dependencies
Deprecated old setup script. The new setup uses it under the hood, but you probably don't want to use it directly anymore.
Added VSCode workspace, which is automatically set up to include the SDK and any dependencies for IntelliSense.
Added build automation scripts, shamelessly stolen and tweaked from Long War of the Chosen.

v1.4

Filled X2DLCInfo and XComGame.int with examples.
Expand Down
Loading