From 3704a1e3ab4707d22ada9a4bdc4253766841661c Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 9 Oct 2025 19:05:42 +0200 Subject: [PATCH 1/5] Fix wheel support for Valheim v0.220.3 https://github.com/virtuaCode/valheim-mods/issues/34#issuecomment-3233156997 --- EquipWheel/Patcher.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/EquipWheel/Patcher.cs b/EquipWheel/Patcher.cs index a70d3a6..9237a6f 100644 --- a/EquipWheel/Patcher.cs +++ b/EquipWheel/Patcher.cs @@ -25,7 +25,7 @@ namespace EquipWheelFour public class Patcher { - /* Patches */ + /* Patches */ #if EQUIPWHEEL_ONE [HarmonyPatch(typeof(InventoryGui), "IsVisible")] @@ -158,23 +158,22 @@ public static bool Prefix(Player __instance) - [HarmonyPatch(typeof(Player), "Awake")] + [HarmonyPatch(typeof(Hud), "Awake")] [HarmonyPostfix] - public static void Awake_Postfix() + public static void Hud_Awake_Postfix(Hud __instance) { var objectName = "EquipGui (" + Assembly.GetExecutingAssembly().GetName().Name + ")"; - if (Menu.instance == null || GameObject.Find(objectName)) + if (GameObject.Find(objectName)) return; - GameObject g = new GameObject(objectName); - var gui = g.AddComponent(); + var g = new GameObject(objectName); - EquipWheel.Gui = gui; - - g.transform.SetParent(Menu.instance.transform.parent, false); + EquipWheel.Gui = g.AddComponent(); - EquipWheel.Log("Spawned EquipGui!"); + g.transform.SetParent(__instance.transform, false); + + EquipWheel.Log("Spawned EquipGui under HUD!"); } From 199960788938a7cf00ae429d79966c3ab6745e17 Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 9 Oct 2025 19:20:51 +0200 Subject: [PATCH 2/5] Fix submodule UnityWav url --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 319bb14..75674f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "TrashItems/UnityWav"] path = TrashItems/UnityWav - url = https://github.com/96andrei/UnityWav.git + url = https://github.com/deadlyfingers/UnityWav.git From 73c5975226d237c24ad138461a951aae766fb7f2 Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 9 Oct 2025 20:57:35 +0200 Subject: [PATCH 3/5] Workflow: update, replace and refactor deprecated actions --- .github/workflows/main.yml | 383 +++++++++++++++++-------------------- 1 file changed, 171 insertions(+), 212 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0aed2f3..f214a80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,212 +1,171 @@ -name: Publish - -on: - push: - tags: - - 'v*' - -jobs: - publish: - runs-on: ubuntu-latest - outputs: - release_url: ${{steps.share_release_url.outputs.url}} - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-dotnet@v1 - - - name: Install mono and xbuild - run: | - sudo apt-get update - sudo apt-get install -y git mono-complete mono-xbuild nuget - - - name: Install NexusUploader - run: dotnet tool install -g NexusUploader - - - name: Get the Release version tag and mod name - id: vars - run: | - echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat) - echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat) - - - name: Update const string BepinEx version field - run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' ${{steps.vars.outputs.mod}}/${{steps.vars.outputs.mod}}.cs - - - name: Check file existence - id: check_files - run: echo ::set-output name=exists::$((test -f ${{steps.vars.outputs.mod}}/manifest.json && echo true) || echo false) - - - name: Update manifest/json version field - run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' ${{steps.vars.outputs.mod}}/manifest.json - if: steps.check_files.outputs.exists == 'true' - - - name: Build and Create the package - run: xbuild ValheimMod.sln /t:${{steps.vars.outputs.mod}} /p:Configuration=Release /p:Version=${{steps.vars.outputs.tag}} /p:OutputPath=.. - - # Package for Thunderstore - - uses: papeloto/action-zip@v1 - with: - files: ${{steps.vars.outputs.mod}}.dll ${{steps.vars.outputs.mod}}/icon.png ${{steps.vars.outputs.mod}}/manifest.json ${{steps.vars.outputs.mod}}/README.md - dest: ${{steps.vars.outputs.mod}}.zip - if: steps.check_files.outputs.exists == 'true' - - # Package for Nexus Mods - - uses: papeloto/action-zip@v1 - with: - files: ${{steps.vars.outputs.mod}}.dll - dest: ${{steps.vars.outputs.mod}}_nexusmods.zip - - - name: Change Log - id: changelog - run: | - git fetch --tags --force # Retrieve annotated tags. THIS TRICK REALLY HELPS - echo 'CHANGELOG<> $GITHUB_ENV - git tag -l ${GITHUB_REF:10} --format='%(contents:body)' >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - body: | - Change Log - ${{ env.CHANGELOG }} - tag_name: ${{ github.ref }} - release_name: Release ${{steps.vars.outputs.mod}} ${{steps.vars.outputs.tag}} - draft: false - prerelease: false - - - name: Share release url - id: share_release_url - run: echo "::set-output name=url::${{ steps.create_release.outputs.upload_url }}" - - - name: Upload Release Asset - id: upload-thunderstore-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./${{steps.vars.outputs.mod}}.zip - asset_name: ${{steps.vars.outputs.mod}}_thunderstore.zip - asset_content_type: application/zip - if: steps.check_files.outputs.exists == 'true' - - - name: Upload Release Asset - id: upload-nexusmod-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./${{steps.vars.outputs.mod}}_nexusmods.zip - asset_name: ${{steps.vars.outputs.mod}}_nexusmods.zip - asset_content_type: application/zip - #- name: Upload - # run: | - # unex upload 504 ValheimLib_release.zip -v ${{ steps.vars.outputs.tag }} - # env: - # UNEX_APIKEY: ${{ secrets.NEXUS_API_KEY }} - # UNEX_COOKIES: ${{ secrets.NEXUS_COOKIES }} - # UNEX_DEBUG: true - # UNEX_FILENAME: ValheimLib - # UNEX_GAME: valheim - - variants: - if: endsWith(github.ref, 'EquipWheel') - strategy: - matrix: - mod: [EquipWheelTwo, EquipWheelThree, EquipWheelFour] - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-dotnet@v1 - - - name: Install mono and xbuild - run: | - sudo apt-get update - sudo apt-get install -y git mono-complete mono-xbuild nuget - - - name: Get the Release version tag and mod name - id: vars - run: | - echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat) - echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat) - - - name: Update const string BepinEx version field - run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' EquipWheel/EquipWheel.cs - - - name: Build and Create the package - run: xbuild ValheimMod.sln /t:${{matrix.mod}} /p:Configuration=Release /p:Version=${{steps.vars.outputs.tag}} /p:OutputPath=.. - - - uses: actions/upload-artifact@v3 - with: - name: more-equipwheels - path: ${{matrix.mod}}.dll - - bundle-variants: - if: endsWith(github.ref, 'EquipWheel') - runs-on: ubuntu-latest - needs: - - publish - - variants - - steps: - - uses: actions/checkout@v3 - - - name: Get the Release version tag and mod name - id: vars - run: | - echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat) - echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat) - - - name: Update const string version field (1/2) - run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json - - - name: Update const string version field (2/2) - run: sed -i 's/"virtuaCode-EquipWheel-0.0.1"/"virtuaCode-EquipWheel-${{steps.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json - - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: more-equipwheels - - - uses: papeloto/action-zip@v1 - with: - files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll MoreEquipWheels/icon.png MoreEquipWheels/manifest.json MoreEquipWheels/README.md - dest: More_EquipWheels_thunderstore.zip - - - uses: papeloto/action-zip@v1 - with: - files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll - dest: More_EquipWheels_nexusmods.zip - - - name: Upload Release Asset - id: upload-nexusmod-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.publish.outputs.release_url }} - asset_path: ./More_EquipWheels_nexusmods.zip - asset_name: More_EquipWheels_nexusmods.zip - asset_content_type: application/zip - - - name: Upload Release Asset - id: upload-thunderstore-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.publish.outputs.release_url }} - asset_path: ./More_EquipWheels_thunderstore.zip - asset_name: More_EquipWheels_thunderstore.zip - asset_content_type: application/zip - - - +name: Publish + +on: + push: + tags: + - 'v*' + +jobs: + vars: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.vars.outputs.tag }} + mod: ${{ steps.vars.outputs.mod }} + steps: + - name: Get the Release version tag and mod name + id: vars + # Fail this and dependant jobs on invalid tag name + run: |- + if [[ "$GITHUB_REF_NAME" =~ ^v([0-9\.]+)-(.+)$ ]]; then + echo "tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT + echo "mod=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT + else + echo '::error::invalid release tag "${{ github.ref }}", required schema: v1.0.0-ModName' + exit 1 + fi + + publish: + needs: vars + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + submodules: recursive + - uses: actions/setup-dotnet@v5 + - name: Install mono and xbuild + run: |- + sudo apt-get update + sudo apt-get install -y git mono-complete mono-xbuild + + - name: Update const string BepinEx version field + run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' ${{needs.vars.outputs.mod}}/${{needs.vars.outputs.mod}}.cs + + - name: Check file existence + id: check_files + run: echo "exists=$((test -f ${{needs.vars.outputs.mod}}/manifest.json && echo true) || echo false)" >> $GITHUB_OUTPUT + + - name: Update manifest/json version field + run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' ${{needs.vars.outputs.mod}}/manifest.json + if: steps.check_files.outputs.exists == 'true' + + - name: Build and Create the package + run: xbuild ValheimMod.sln /t:${{needs.vars.outputs.mod}} /p:Configuration=Release /p:Version=${{needs.vars.outputs.tag}} /p:OutputPath=.. + + # Package for Thunderstore + - uses: papeloto/action-zip@v1 + with: + files: ${{needs.vars.outputs.mod}}.dll ${{needs.vars.outputs.mod}}/icon.png ${{needs.vars.outputs.mod}}/manifest.json ${{needs.vars.outputs.mod}}/README.md + dest: ${{needs.vars.outputs.mod}}_thunderstore.zip + if: steps.check_files.outputs.exists == 'true' + + # Package for Nexus Mods + - uses: papeloto/action-zip@v1 + with: + files: ${{needs.vars.outputs.mod}}.dll + dest: ${{needs.vars.outputs.mod}}_nexusmods.zip + + - name: Change Log + id: changelog + run: | + git fetch --tags --force # Retrieve annotated tags. THIS TRICK REALLY HELPS + echo 'CHANGELOG<> $GITHUB_ENV + git tag -l ${GITHUB_REF:10} --format='%(contents:body)' >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + body: | + Change Log + ${{ env.CHANGELOG }} + name: Release ${{needs.vars.outputs.mod}} ${{needs.vars.outputs.tag}} + draft: false + prerelease: false + files: |- + ${{needs.vars.outputs.mod}}*.zip + + # - name: Install NexusUploader + # run: dotnet tool install -g NexusUploader + # + #- name: Upload + # run: | + # unex upload 504 ValheimLib_release.zip -v ${{ needs.vars.outputs.tag }} + # env: + # UNEX_APIKEY: ${{ secrets.NEXUS_API_KEY }} + # UNEX_COOKIES: ${{ secrets.NEXUS_COOKIES }} + # UNEX_DEBUG: true + # UNEX_FILENAME: ValheimLib + # UNEX_GAME: valheim + + variants: + if: endsWith(github.ref, 'EquipWheel') + needs: vars + strategy: + matrix: + mod: [EquipWheelTwo, EquipWheelThree, EquipWheelFour] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-dotnet@v5 + + - name: Install mono and xbuild + run: |- + sudo apt-get update + sudo apt-get install -y git mono-complete mono-xbuild + + - name: Update const string BepinEx version field + run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' EquipWheel/EquipWheel.cs + + - name: Build and Create the package + run: xbuild ValheimMod.sln /t:${{matrix.mod}} /p:Configuration=Release /p:Version=${{needs.vars.outputs.tag}} /p:OutputPath=.. + + - uses: actions/upload-artifact@v4 + with: + name: more-equipwheels-${{matrix.mod}} + path: ${{matrix.mod}}.dll + + bundle-variants: + if: endsWith(github.ref, 'EquipWheel') + runs-on: ubuntu-latest + needs: + - vars + - publish + - variants + + steps: + - uses: actions/checkout@v5 + + - name: Update const string version field (1/2) + run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json + + - name: Update const string version field (2/2) + run: sed -i 's/"virtuaCode-EquipWheel-0.0.1"/"virtuaCode-EquipWheel-${{needs.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json + + - name: Download artifacts + uses: actions/download-artifact@v5 + with: + pattern: more-equipwheels-* + merge-multiple: true + + - uses: papeloto/action-zip@v1 + with: + files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll MoreEquipWheels/icon.png MoreEquipWheels/manifest.json MoreEquipWheels/README.md + dest: More_EquipWheels_thunderstore.zip + + - uses: papeloto/action-zip@v1 + with: + files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll + dest: More_EquipWheels_nexusmods.zip + + - name: Upload Release Asset + id: upload-asset + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: |- + More_EquipWheels*.zip From 1f0228c2eed7f38048a9e7e86dbdf12a0dcbbeae Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 9 Oct 2025 22:34:41 +0200 Subject: [PATCH 4/5] Workflow: cache apt packages --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f214a80..29f5084 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,9 +33,9 @@ jobs: submodules: recursive - uses: actions/setup-dotnet@v5 - name: Install mono and xbuild - run: |- - sudo apt-get update - sudo apt-get install -y git mono-complete mono-xbuild + uses: awalsh128/cache-apt-pkgs-action@v1 + with: + packages: git mono-complete mono-xbuild - name: Update const string BepinEx version field run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' ${{needs.vars.outputs.mod}}/${{needs.vars.outputs.mod}}.cs @@ -113,9 +113,9 @@ jobs: - uses: actions/setup-dotnet@v5 - name: Install mono and xbuild - run: |- - sudo apt-get update - sudo apt-get install -y git mono-complete mono-xbuild + uses: awalsh128/cache-apt-pkgs-action@v1 + with: + packages: git mono-complete mono-xbuild - name: Update const string BepinEx version field run: sed -i 's/"0.0.1"/"${{needs.vars.outputs.tag}}"/g' EquipWheel/EquipWheel.cs From e1f096aac3ceb1c48408b75c5b8692f60819e0c4 Mon Sep 17 00:00:00 2001 From: Zash Date: Thu, 9 Oct 2025 22:37:21 +0200 Subject: [PATCH 5/5] Workflow: add version to release artifacts --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 29f5084..4e89c00 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,14 +55,14 @@ jobs: - uses: papeloto/action-zip@v1 with: files: ${{needs.vars.outputs.mod}}.dll ${{needs.vars.outputs.mod}}/icon.png ${{needs.vars.outputs.mod}}/manifest.json ${{needs.vars.outputs.mod}}/README.md - dest: ${{needs.vars.outputs.mod}}_thunderstore.zip + dest: ${{needs.vars.outputs.mod}}_${{needs.vars.outputs.tag}}_thunderstore.zip if: steps.check_files.outputs.exists == 'true' # Package for Nexus Mods - uses: papeloto/action-zip@v1 with: files: ${{needs.vars.outputs.mod}}.dll - dest: ${{needs.vars.outputs.mod}}_nexusmods.zip + dest: ${{needs.vars.outputs.mod}}_${{ needs.vars.outputs.tag }}_nexusmods.zip - name: Change Log id: changelog @@ -154,12 +154,12 @@ jobs: - uses: papeloto/action-zip@v1 with: files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll MoreEquipWheels/icon.png MoreEquipWheels/manifest.json MoreEquipWheels/README.md - dest: More_EquipWheels_thunderstore.zip + dest: More_EquipWheels_${{ needs.vars.outputs.tag }}_thunderstore.zip - uses: papeloto/action-zip@v1 with: files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll - dest: More_EquipWheels_nexusmods.zip + dest: More_EquipWheels_${{ needs.vars.outputs.tag }}_nexusmods.zip - name: Upload Release Asset id: upload-asset