Modding:Creating A Code Mod: Difference between revisions

From Vintage Story Wiki
m
no edit summary
mNo edit summary
mNo edit summary
Line 7: Line 7:
Before creating a code mod, you need to have completed the [[Modding:Preparing For Code Mods|Preparing For Code Mods]] tutorial. This will show you how to setup your development environment, install dotnet, and install the modding template. If you have done that, you can carry on with this tutorial.
Before creating a code mod, you need to have completed the [[Modding:Preparing For Code Mods|Preparing For Code Mods]] tutorial. This will show you how to setup your development environment, install dotnet, and install the modding template. If you have done that, you can carry on with this tutorial.


'''This tutorial is suitable for modders using Visual Studio. If you have chose to use a different IDE, please refer to the older [[Modding:Setting up your Development Environment|Setting up your Development Environment]] tutorial.'''
'''This tutorial is suitable for modders using Visual Studio. If you have chosen to use a different IDE, please refer to the older [[Modding:Setting up your Development Environment|Setting up your Development Environment]] tutorial.'''


=== Updating the Templates ===
=== Updating the Templates ===
Line 21: Line 21:


== Creating a New Mod ==
== Creating a New Mod ==
To create a new code mod, launch Visual Studio, and select 'Create a new project'. In the create menu, select Vintage Story from the dropdown furthest to the right. This will filter the list of templates, to only show ones with the "Vintage Story" project type.
To create a new code mod, launch Visual Studio, and select '''Create a new project''<nowiki/>'. In the create menu, select Vintage Story from the dropdown furthest to the right. This will filter the list of templates, to only show ones with the "''Vintage Story''" project type.
[[File:VisualStudioVSBasicTemplateSelect.png|center|frameless|558x558px]]
[[File:VisualStudioVSBasicTemplateSelect.png|center|frameless|558x558px]]
Select the 'Vintage Story Basic Mod Template' and click next. This will load a new menu asking for a project name, location, and solution name.  
Select the '''Vintage Story Basic Mod Template''<nowiki/>' and click next. This will load a new menu asking for a project name, location, and solution name.  


Your project name should follow these requirements:
Your project name should follow these requirements:
Line 30: Line 30:
* Be formatted in ''[https://www.theserverside.com/definition/Pascal-case PascalCase].''
* Be formatted in ''[https://www.theserverside.com/definition/Pascal-case PascalCase].''
* Not be abbreviated (Use ''MyFirstMod'' instead of ''MFM'').
* Not be abbreviated (Use ''MyFirstMod'' instead of ''MFM'').
* Be unique to any other mod on the VS Mod DB.


Your project name will also determine your Mod ID, however this ''can'' be altered later.   
Your project name will also determine your Mod ID, however this ''can'' be altered later.   


Your project can be created anywhere, and it is recommended to check the "''Place solution and project in the same directory"'' checkbox. 
[[File:VSBasicModTemplateCreationScreenFilledIn.png|center|frameless|642x642px]]
When you have entered your details, click '''Create''<nowiki/>'. Your project will be created and Visual Studio will open. 
== Project Setup ==
[[File:VSModTemplateSolutionExplorer.png|border|right|frameless]]
=== Solution Explorer ===
When your project loads, you should see the Solution Explorer on the right-hand-side of Visual Studio. If not, you can open the Solution Explorer by clicking ''View'' and ''Solution Explorer'' from the top Visual Studio menu bar.
The Solution Explorer is a list of every file for your mod, and this is how you will create, open, and delete mod files. You can double left-click any file or folder to open it. Right clicking a file or folder will give you options to rename, delete, copy, and other file management tasks.
Note that any reference to '''MyFirstMod''<nowiki/>' will be replaced with whatever your project name is, and 'myfirstmod' will be your lowercase project name.
=== Mod Info ===
Double click on the ''modinfo.json'' file to open it, and you will see the following JSON code:<syntaxhighlight lang="json">
{
    "type": "code",
    "modid": "myfirstmod",
    "name": "MyFirstMod",
    "authors": [
        "Unknown"
    ],
    "description": "To be added",
    "version": "1.0.0",
    "dependencies": {
        "game": ""
    }
}
</syntaxhighlight>
</translate>
</translate>
{{Navbox/codemodding}}
{{Navbox/codemodding}}
Confirmedusers
711

edits