diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..e666e8b --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "roslynator.dotnet.cli": { + "version": "0.8.4", + "commands": [ + "roslynator" + ] + } + } +} \ No newline at end of file diff --git a/.vscode/build.sh b/.vscode/build.sh index 74b8817..7c13278 100755 --- a/.vscode/build.sh +++ b/.vscode/build.sh @@ -4,9 +4,11 @@ script_dir=$(dirname $(readlink -f $0)) mod_dir=$(dirname $script_dir) pushd $script_dir +configuration=${1:-Debug} + # build dll rm -f ../1.4/Assemblies/* -dotnet build mod.csproj +dotnet build mod.csproj -c ${configuration} # generate About.xml rm -f ../About/About.xml diff --git a/.vscode/fmt.sh b/.vscode/fmt.sh old mode 100644 new mode 100755 diff --git a/.vscode/launch.sh b/.vscode/launch.sh index 2caaa50..5e5c6d9 100755 --- a/.vscode/launch.sh +++ b/.vscode/launch.sh @@ -4,6 +4,6 @@ script_dir=$(dirname $(readlink -f $0)) mod_dir=$(dirname $script_dir) pushd $script_dir -LC_ALL=C steam-run ~/.steam/steam/steamapps/common/RimWorld/RimWorldLinux -logfile $mod_dir/log/rimworld.log -popupwindow $@ +SDL_VIDEODRIVER=X11 LC_ALL=C steam-run ~/.local/share/Steam/steamapps/common/RimWorld/RimWorldLinux -logfile $mod_dir/log/rimworld.log -popupwindow $@ popd \ No newline at end of file diff --git a/.vscode/mod.csproj b/.vscode/mod.csproj index 957c351..fff177f 100644 --- a/.vscode/mod.csproj +++ b/.vscode/mod.csproj @@ -13,6 +13,7 @@ none false false + enable @@ -28,7 +29,7 @@ - + https://git.tobot.dev/toby/rimworld-mod-template - + - + + - \ No newline at end of file + diff --git a/.vscode/roslynator.sh b/.vscode/roslynator.sh new file mode 100755 index 0000000..bcf9d04 --- /dev/null +++ b/.vscode/roslynator.sh @@ -0,0 +1,9 @@ +set -e + +script_dir=$(dirname $(readlink -f $0)) +mod_dir=$(dirname $script_dir) +pushd $mod_dir + +dotnet roslynator analyze $script_dir/mod.csproj + +popd \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 6520729..98061ba 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,22 +3,25 @@ "files.exclude": { ".direnv": true, ".vscode/obj": true, - "1.4/Assemblies/": true, - "About/": true, + "*/Assemblies/": true, }, "files.readonlyInclude": { "log/rimworld.log": true, + "About/About.xml": true, }, - "csharp.inlayHints.parameters.enabled": true, - "csharp.inlayHints.parameters.forIndexerParameters": true, - "csharp.inlayHints.parameters.forLiteralParameters": true, - "csharp.inlayHints.parameters.forObjectCreationParameters": true, - "csharp.inlayHints.parameters.forOtherParameters": true, - "csharp.inlayHints.parameters.suppressForParametersThatDifferOnlyBySuffix": true, - "csharp.inlayHints.parameters.suppressForParametersThatMatchArgumentName": true, - "csharp.inlayHints.parameters.suppressForParametersThatMatchMethodIntent": true, - "csharp.inlayHints.types.enabled": true, - "csharp.inlayHints.types.forImplicitObjectCreation": true, - "csharp.inlayHints.types.forImplicitVariableTypes": true, - "csharp.inlayHints.types.forLambdaParameterTypes": true + "omnisharp.organizeImportsOnFormat": true, + "dotnet.inlayHints.enableInlayHintsForParameters": true, + "dotnet.inlayHints.enableInlayHintsForLiteralParameters": true, + "dotnet.inlayHints.enableInlayHintsForIndexerParameters": true, + "dotnet.inlayHints.enableInlayHintsForObjectCreationParameters": true, + "dotnet.inlayHints.enableInlayHintsForOtherParameters": true, + "dotnet.inlayHints.suppressInlayHintsForParametersThatDifferOnlyBySuffix": true, + "dotnet.inlayHints.suppressInlayHintsForParametersThatMatchMethodIntent": true, + "dotnet.inlayHints.suppressInlayHintsForParametersThatMatchArgumentName": true, + "csharp.inlayHints.enableInlayHintsForTypes": true, + "csharp.inlayHints.enableInlayHintsForImplicitVariableTypes": true, + "csharp.inlayHints.enableInlayHintsForLambdaParameterTypes": true, + "csharp.inlayHints.enableInlayHintsForImplicitObjectCreation": true, + "dotnet.server.useOmnisharp": true, + "omnisharp.enableLspDriver": false } \ No newline at end of file diff --git a/.vscode/setup.sh b/.vscode/setup.sh index 2fcf8ad..93c2d0d 100755 --- a/.vscode/setup.sh +++ b/.vscode/setup.sh @@ -1,12 +1,20 @@ set -e +set -x script_dir=$(dirname $(readlink -f $0)) mod_dir=$(dirname $script_dir) pushd $script_dir mod_name="${mod_dir##*/}" +target_dir=$(readlink -f ~/.local/share/Steam/steamapps/common/RimWorld/Mods/)/$mod_name -# Try to create symlink in RimWorld mod directory -ln -s $mod_dir -t "$(readlink -f ~/.steam/steam/steamapps/common/RimWorld/Mods)" -v || echo "Target directory already exists. This is expected on re-runs" +dotnet tool restore -popd \ No newline at end of file +if [ "$target_dir" = "$mod_dir" ]; then + echo "Target directory is the same as the mod directory. Cloned in RimWorld/Mods. Skipping setup" +else + mkdir -p $target_dir + rsync -av --exclude '$mod_dir/*' --delete $mod_dir/1.4 $mod_dir/About $mod_dir/README $mod_dir/LICENSE $target_dir +fi + +popd diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cc2c417..fbd4115 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,6 +1,13 @@ { "version": "2.0.0", "tasks": [ + { + "label": "analyze", + "type": "shell", + "group": "none", + "command": ".vscode/roslynator.sh", + "problemMatcher": [] + }, { "label": "format", "type": "shell", @@ -9,7 +16,7 @@ "problemMatcher": [] }, { - "label": "build mod", + "label": "build mod (Debug)", "type": "shell", "group": { "kind": "build", @@ -18,10 +25,24 @@ "command": ".vscode/build.sh", "problemMatcher": [ "$msCompile" - ] + ], + "dependsOn": [] }, { - "label": "run game", + "label": "build mod (Release)", + "type": "shell", + "group": { + "kind": "build", + "isDefault": true + }, + "command": ".vscode/build.sh Release", + "problemMatcher": [ + "$msCompile" + ], + "dependsOn": [] + }, + { + "label": "run game (Debug)", "type": "shell", "group": { "kind": "none", @@ -29,13 +50,29 @@ }, "command": ".vscode/launch.sh", "problemMatcher": [], + "dependsOrder": "sequence", "dependsOn": [ - "link mod directory", - "build mod" + "build mod (Debug)", + "set up mod directory" ] }, { - "label": "run game (quicktest)", + "label": "run game (Release)", + "type": "shell", + "group": { + "kind": "none", + "isDefault": true + }, + "command": ".vscode/launch.sh", + "problemMatcher": [], + "dependsOrder": "sequence", + "dependsOn": [ + "build mod (Release)", + "set up mod directory" + ] + }, + { + "label": "run game (Debug + quicktest)", "type": "shell", "group": { "kind": "none", @@ -43,13 +80,14 @@ }, "command": ".vscode/launch.sh -quicktest", "problemMatcher": [], + "dependsOrder": "sequence", "dependsOn": [ - "link mod directory", - "build mod" + "build mod (Debug)", + "set up mod directory" ] }, { - "label": "link mod directory", + "label": "set up mod directory", "type": "shell", "group": { "kind": "none" diff --git a/1.4/Assemblies/Template.dll b/1.4/Assemblies/Template.dll index 1533143..0885e68 100644 Binary files a/1.4/Assemblies/Template.dll and b/1.4/Assemblies/Template.dll differ diff --git a/About/About.xml b/About/About.xml index 678af5a..85d892c 100644 --- a/About/About.xml +++ b/About/About.xml @@ -10,7 +10,7 @@
  • 1.4
  • 0.1.0.0 - + https://git.tobot.dev/toby/rimworld-mod-template