Update paths, dont use environment variables

This commit is contained in:
zontreck 2024-12-11 21:33:02 -07:00
parent 27a9e3f8cb
commit 591f82c2d3
10 changed files with 58 additions and 23 deletions

2
.gitignore vendored
View file

@ -13,6 +13,8 @@
*.user
*.userosscache
*.sln.docstates
game
Releases
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

13
.idea/.idea.VintageStorage/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/projectSettingsUpdater.xml
/.idea.VintageStorage.iml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

16
.vscode/launch.json vendored
View file

@ -8,12 +8,12 @@
"name": "Launch Client (Debug)",
"type": "coreclr",
"request": "launch",
"program": "${env:VINTAGE_STORY}/Vintagestory.exe",
"program": "game/Vintagestory.exe",
"linux": {
"program": "${env:VINTAGE_STORY}/Vintagestory"
"program": "game/Vintagestory"
},
"osx": {
"program": "${env:VINTAGE_STORY}/Vintagestory"
"program": "game/Vintagestory"
},
"preLaunchTask": "build",
"args": [
@ -21,7 +21,7 @@
// "--openWorld" , "modding test world",
"--tracelog",
"--addModPath",
"${workspaceFolder}/ModTemplate/bin/Debug/Mods"
"${workspaceFolder}/VintageStorage/bin/Debug/Mods"
],
"console": "internalConsole",
"stopAtEntry": false
@ -30,18 +30,18 @@
"name": "Launch Server",
"type": "coreclr",
"request": "launch",
"program": "${env:VINTAGE_STORY}/VintagestoryServer.exe",
"program": "game/VintagestoryServer.exe",
"linux": {
"program": "${env:VINTAGE_STORY}/VintagestoryServer"
"program": "game/VintagestoryServer"
},
"osx": {
"program": "${env:VINTAGE_STORY}/VintagestoryServer"
"program": "game/VintagestoryServer"
},
"preLaunchTask": "build",
"args": [
"--tracelog",
"--addModPath",
"${workspaceFolder}/ModTemplate/bin/Debug/Mods"
"${workspaceFolder}/VintageStorage/bin/Debug/Mods"
],
"console": "internalConsole",
"stopAtEntry": false

View file

@ -13,7 +13,7 @@
<ItemGroup>
<Reference Include="VintagestoryAPI">
<HintPath>$(VINTAGE_STORY)/VintagestoryAPI.dll</HintPath>
<HintPath>game/VintagestoryAPI.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View file

@ -2,34 +2,41 @@
This repository contains a configured .NET 7 mod for Visual Studio, Visual Studio Code and Rider that let's you start Vintage Story and add your own code to it. Supports logging and as well as debugging.
## Setup
- Link your vintage story game location to the `game` folder. By default, this is `~/.local/share/vintagestory`. If on Windows, or another platform, copy your game install to the game folder before proceeding.
## Usage
- Get a copy of this template by either using the "Use this Template" on github or cloning it or downloading a .zip file.
- Open the Project with your preferred IDE
- Run the template
The template uses the Cake build system to produce a mod ready to release for you.
You can create a release with one of the following methods:
- In Visual Studio and Rider Select to run the CakeBuilder Project.
- In Visual Studio Code click on "Terminal" > "Run Task" > "package"
- run the build.ps1 or build.sh
This will then produce the `mymodid_1.0.0.zip` inside the `Release` folder in the project root folder.
## Linux / Mac
## Linux / Mac
This sample is preconfigured for Windows if you want to use it on Linux or Mac you need to change the path for the Vintage Story (Server) binaries since those are now platform dependent with .NET 7.
This sample is preconfigured for Windows if you want to use it on Linux or Mac you need to change the path for the Vintage Story (Server) binaries since those are now platform dependent with .NET 7.
### Rider
If you use Rider on Linux or Mac you will need to change in
`modtemplate/Properties/launchSettings.json`
```
"executablePath": "$(VINTAGE_STORY)/Vintagestory.exe",
"executablePath": "$(VINTAGE_STORY)/VintagestoryServer.exe",
```
to
to
```
"executablePath": "$(VINTAGE_STORY)/Vintagestory",
"executablePath": "$(VINTAGE_STORY)/VintagestoryServer",
@ -59,7 +66,6 @@ It is also used in the games repo to build the game for each platform (Windows x
But that is not all cake can do for us.
Since we use the `Cake Frosting` setup which essentially adds another Project to our solution where we can write C# code to define our build and package procedure. Further we added a Json Validation step to it so before a build is made it will verify that all json files are at least parsable by `Newtonsoft.Json` to avoid simple mistakes. And if you want to use any Testing library you can also add it to the Cake build system to run your test when you create a mod.zip for release.
## Migrating Mods to .NET 7
To migrate your mod to .NET 7 we would recommend you to create a new project with our new template (checkout our updated [wiki page](https://wiki.vintagestory.at/index.php/Modding:Setting_up_your_Development_Environment) for that) and copy over your old code. Additionally you may need to add any special references you need for your mod.
@ -67,4 +73,3 @@ To migrate your mod to .NET 7 we would recommend you to create a new project wit
Then you may have to make some code changes so your mod works with the .NET 7 version of the game. For most mods this should be just minor changes.
Once that is done it should be ready to be started within you preferred IDE. So you can also benefit from new C# 11 language features as well as the cake build system.

View file

@ -8,23 +8,23 @@
<ItemGroup>
<Reference Include="VintagestoryAPI">
<HintPath>$(VINTAGE_STORY)/VintagestoryAPI.dll</HintPath>
<HintPath>game/VintagestoryAPI.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="VSSurvivalMod">
<HintPath>$(VINTAGE_STORY)/Mods/VSSurvivalMod.dll</HintPath>
<HintPath>game/Mods/VSSurvivalMod.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VSEssentials">
<HintPath>$(VINTAGE_STORY)/Mods/VSEssentials.dll</HintPath>
<HintPath>game/Mods/VSEssentials.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VSCreativeMod">
<HintPath>$(VINTAGE_STORY)/Mods/VSCreativeMod.dll</HintPath>
<HintPath>game/Mods/VSCreativeMod.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(VINTAGE_STORY)/Lib/Newtonsoft.Json.dll</HintPath>
<HintPath>game/Lib/Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

View file

@ -1,4 +1 @@
#!/bin/bash
echo $VINTAGE_STORY is where VintageStoryAPI.dll is located
dotnet run --project ./CakeBuild/CakeBuild.csproj -- "$@"