Modding:Setting up your Linux Development Environment: Difference between revisions

From Vintage Story Wiki
(Marked this version for translation)
(The Linux directions are out of date. Mono doesn't work with .net 7. So turn this into a redirect to the general directions, which already cover Linux.)
Tag: New redirect
 
Line 1: Line 1:
<languages/>
#REDIRECT [[Modding:Setting_up_your_Development_Environment]]
<translate>
<!--T:1-->
This tutorial is about advanced modding. It should teach you how to setup your development environment and should introduce you into the basics of Mono Develop, this tutorial was written for Linux, if you use Windows you may want to use [[Advanced_Modding|Visual Studio]].
 
== Install VintageStory == <!--T:2-->
First of all download VintageStory and make sure you have installed the newest version of the game, otherwise errors may occur.
 
== Install FlatPak == <!--T:3-->
We will use FlatPak to install MonoDevelop so if you already have FlatPak then you can skip this step. FlatPak have their own guides for many distrobutions [http://flatpak.org/getting.html here].
 
== Install MonoDevelop == <!--T:4-->
Now it is time to install MonoDevelop and with FlatPak it is only one command.
Simply open up a terminal and run the following command.
<br />
<code>flatpak install --user --from https://download.mono-project.com/repo/monodevelop.flatpakref</code>
<br />
This might take a few minutes depending on your internet connection. (The latest version at the time of writing was around 275MB.)
 
<!--T:5-->
To open up MonoDevelop run <code>flatpak run com.xamarin.MonoDevelop</code> in the terminal.
 
== API Overview == <!--T:6-->
The API interface is mostly documented, but if you feel a need for a reference documentation is is available at [http://apidocs.vintagestory.at]
 
<!--T:7-->
Example mods are available on Github: [https://github.com/tyronx/vsmodexamples]
 
== Creating a solution (project group) == <!--T:8-->
* Open up MonoDevelop and and create a new solution with: '''File -> New Solution...''' (in the top left corner).
* Choose '''.NET -> Library''' as a template.
[[File:mono_new_library.png|800px]]
* Click Next.
* Set your '''Project Name''', see example below, do not change the path if you want to follow along, leave it alone.
[[File:mono_new_library_2.png|800px]]
* Click Create. You should now get a screen that looks somewhat like this:
[[File:mono_new_cs_file.png|800px]]
* Right click on the project (the one highlighted below) and click '''Options'''.
[[File:mono_project_menu.png]]
* Click on '''Run -> Configurations -> Default''' (highlighted below).
[[File:mono_run_config_menu.png]]
* Set the values so they look like below but replace 'cynthia' with your username and 'MyCoolMod' with the name of your project, and click on '''OK'''.
[[File:mono_run_config.png]]
* Right click on the project again and click on '''Add -> New File...'''
* Click on '''Misc -> Empty Text File''' and set ''launchmod.sh'' as the name, click on '''New'''.
[[File:mono_new_file.png]]
* Paste the content from the '''launchmod.sh''' section of this page into the new ''launchmod.sh'' file and save it.
* Right click on '''References''' and click on '''Edit References...'''.
* Click on the '''.Net Assembly''' tab and click on '''Browse...'''.
* Navigate to your Vintage Story installation path (<code>/home/yourusernamehere/ApplicationData/vintagestory</code>) and click on the <code>VintagestoryAPI.dll</code> file.
* Click on '''Open'''.
* Click on '''OK'''.
 
=== Testing === <!--T:9-->
* Click on '''Run -> Start Without Debugging''' or press '''CTRL + F5'''.
* Vintage Story should now start.
 
=== launchmod.sh === <!--T:10-->
<code>
<nowiki>#!/bin/bash</nowiki><br />
<nowiki>VINTAGE_PATH="${HOME}/ApplicationData/vintagestory/"</nowiki><br />
<nowiki>MOD_PATH="${VINTAGE_PATH}Mods/"</nowiki><br />
<nowiki>cd ${VINTAGE_PATH}</nowiki><br />
<nowiki>mono Vintagestory.exe -oTestworld -pcreativebuilding</nowiki><br />
</code>
 
== Hook up logging == <!--T:11-->
If you want to you can download [[File:RedirectLogs.cs]] and add it to your project, which will allow to see the log of Vintagestory in MonoDevelop. Once you have downloaded the file you can just add it to the project by right clicking on the project and clicking on '''Add -> Add Files...''' then navigating to the file and click '''Open''' then '''Copy the file to the directory.''' and '''OK'''.
 
== Additional command line arguments when debugging == <!--T:12-->
* -oFoobar open a world named "foobar", if it doesn't exists it will create a new one
* -pcreativebuilding new worlds are created with given playstyle ("surviveandbuild" or "creativebuilding" by default)
* --rndWorld always creates a new world with an incrementing file name
 
</translate>
{{Navbox/modding|Vintage Story}}

Latest revision as of 18:09, 10 October 2023