Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
move assets folder to mod and add folder structure of a mod
(VS 2022 add .NET desktop dev, add mod packaging, updated cli commands, VSCode extensions)
(move assets folder to mod and add folder structure of a mod)
Line 169: Line 169:
</syntaxhighlight>
</syntaxhighlight>


<br>
----
<br>
Finally in <code>mytestmod\mytestmod\modinfo.json</code>
change the <code>name</code>, <code>modid</code> , <code>authors</code> and <code>description</code> to describe your mod.


==== Updating the template package ====
==== Updating the template package ====
Line 179: Line 185:
But this should not be necessary when creating a new mod, since using the <code>dotnet new vsmod</code> will check automatically if a new version of the template is available and install it.
But this should not be necessary when creating a new mod, since using the <code>dotnet new vsmod</code> will check automatically if a new version of the template is available and install it.


</br>
==== Folder structure ====
Finally in <code>yourmod\resources\modinfo.json</code>
 
change the <code>name</code>, <code>modid</code> , <code>authors</code> and <code>description</code> to describe your mod.
Here is an overview of where what files in your mod are located.
<!--T:8-->
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
  <tr style=''>
    <th width='300' align='left'>Name</th>
    <th width='600' align='left'>Description</th>
  </tr>
  <tr>
    <td><div class="tt" data-tt-id="root">mytestmod</div></td>
    <td></td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_vscode" data-tt-parent="root">.vscode</div></td>
    <td>If you checked --IncludeVSCode this folder will contain all stuff needed to run, package and debug your mod using Visual Studio Code.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_cakebuild" data-tt-parent="root">CakeBuild</div></td>
    <td>This Project contains the code that builds mytestmod_x.x.x.zip. You can execute it by selecting the Run Configuration CakeBuild.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_mytestmod" data-tt-parent="root">mytestmod</div></td>
    <td>This is your project. It contains all your code as well as the assets and the modinfo.json</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_assets" data-tt-parent="p_mytestmod">assets</div></td>
    <td>Contains your assets. See '''[[Modding:The_Asset_System | The_Asset_System]]'''</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_modinfo" data-tt-parent="p_mytestmod">modinfo.json</div></td>
    <td>Defines your mod. Author, Dependencies, Name and much more. See '''[[Modinfo | Modinfo]]'''</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_properties" data-tt-parent="p_mytestmod">Properties</div></td>
    <td></td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_launchsettings" data-tt-parent="p_releases_properties">launchSettings.json</div></td>
    <td>This contains how to launch your mod (Visual Studio, Rider). You may want to add custom startup parameters to launch for example directly into a world when starting. Run Vintagestory.exe -h to see all options from a terminal opened in your Vintagestory install directory.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_csproj" data-tt-parent="p_mytestmod">mymod.csproj</div></td>
    <td>Your mods csproj file. Contains information like the .NET version to build against and references to the VintagestoryAPI for example.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases" data-tt-parent="root">Releases</div></td>
    <td>Contains your mod release once the CakeBuild Run Configuration was run.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_mymtestmod" data-tt-parent="p_releases">mytestmod</div></td>
    <td>Your mod files before getting packaged into a .zip file.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_releases_zip" data-tt-parent="p_releases">mytestmod_x.x.x.zip</div></td>
    <td>Ready to release mod zip.</td>
  </tr>


For a full list of available options see '''[[Modinfo | Modinfo]]'''.
</table>


=== Template Mod Project ===
=== Template Mod Project ===
Line 258: Line 318:
''When using Visual Studio Code you can also create a package by running the package task. For that got to <code>Terminal</code> > <code>Run Task...</code> and select <code>package</code>.''
''When using Visual Studio Code you can also create a package by running the package task. For that got to <code>Terminal</code> > <code>Run Task...</code> and select <code>package</code>.''


It will perform a JSON validation on your assets so they are at least parsable by Newtonsoft.Json and then build a <code>Releases/mymodid_1.0.0.zip</code>. The version is taken from the <code>resources/modinfo.json</code> file.
It will perform a JSON validation on your assets so they are at least parsable by Newtonsoft.Json and then build a <code>Releases/mymodid_1.0.0.zip</code>. The version is taken from the <code>mymod/modinfo.json</code> file.


Congratulations now you have your mod development environment set up and a ready-to-release mod package.
Congratulations now you have your mod development environment set up and a ready-to-release mod package.
Confirmedusers, editor
18

edits