From 98ea411011386167d9d24b98f408f82df97e7645 Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Thu, 4 Apr 2024 21:36:32 +0200 Subject: [PATCH] feat: apply things learned in better autocasting mod --- .config/dotnet-tools.json | 12 ++++++++ .vscode/build.sh | 4 ++- .vscode/fmt.sh | 0 .vscode/launch.sh | 2 +- .vscode/mod.csproj | 19 ++++++++---- .vscode/roslynator.sh | 9 ++++++ .vscode/settings.json | 31 +++++++++++--------- .vscode/setup.sh | 14 +++++++-- .vscode/tasks.json | 56 ++++++++++++++++++++++++++++++------ 1.4/Assemblies/Template.dll | Bin 4608 -> 4096 bytes About/About.xml | 2 +- LICENSE | 2 +- README | 11 +++++++ Source/TemplateDefOf.cs | 2 +- flake.lock | 30 +++++++++---------- flake.nix | 1 - 16 files changed, 143 insertions(+), 52 deletions(-) create mode 100644 .config/dotnet-tools.json mode change 100644 => 100755 .vscode/fmt.sh create mode 100755 .vscode/roslynator.sh create mode 100644 README 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 15331437a1d77ca93be76f900222beecb088034f..0885e6866f8fa2382af3f8d815fe906831e4542e 100644 GIT binary patch delta 566 zcmZ8c-%C?b9RGaJxtr{6=$3QWQOIpGxmippM2cQ=4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/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