diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index e27db5a93..e5e326257 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -4,9 +4,6 @@ on: push: workflow_dispatch: - # schedule: - # - cron: "0 4 * * *" - permissions: contents: read pages: write @@ -75,36 +72,10 @@ jobs: bun run setup ./scripts/setup_depot_downloader.sh - - name: Download fingerprint - run: | - ./scripts/download_fingerprint.sh - - # - name: Download cached game - # uses: actions/cache@v5 - # id: game-cache - # with: - # path: temp/game - # key: ${{ runner.os }}-${{ hashFiles(format('temp/game/{0}', env.FINGERPRINT)) }} - - name: Download Steam game - # if: steps.game-cache.outputs.cache-hit != 'true' run: scripts/download_game.sh - name: Build run: bun run build-website env: BUILD_CHUNK: ${{ matrix.chunk }} - - # - name: Upload artifact - # id: upload - # uses: actions/upload-pages-artifact@v4 - # with: - # path: dist/website - - # - name: Trigger target repository - # run: | - # curl -X POST \ - # -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ - # -H "Accept: application/vnd.github.v3+json" \ - # https://github.com \ - # -d '{ "event_type": "deploy-pages", "client_payload": { "artifact_url": "${{ steps.upload.outputs.artifact_url }}" } }' diff --git a/packages/game/JSExport/GameInterface.cs b/packages/game/JSExport/GameInterface.cs index f61f77ba7..607c21555 100644 --- a/packages/game/JSExport/GameInterface.cs +++ b/packages/game/JSExport/GameInterface.cs @@ -15,6 +15,11 @@ using CUE4Parse.UE4.AssetRegistry.Objects; using CUE4Parse.UE4.Readers; using CUE4Parse.UE4.AssetRegistry.Readers; using CUE4Parse.UE4.AssetRegistry; +using CUE4Parse.UE4.Assets.Exports.Engine; +using CUE4Parse.UE4.Assets.Objects; +using CUE4Parse.UE4.Assets.Exports.StaticMesh; +using CUE4Parse_Conversion.Meshes; +using CUE4Parse_Conversion; namespace BlitzKit.Game.JSExport; @@ -102,16 +107,44 @@ public partial class GameInterface } - private readonly string[] tankPartEntries = ["DT_Chassis", "DT_Hulls", "DT_Turrets", "DT_Guns"]; + readonly Dictionary tankPartPrefixes = new() + { + {"chassis", "DT_Chassis"}, + {"hull", "DT_Hulls"}, + {"turret", "DT_Turrets"}, + {"gun", "DT_Guns"}, + }; public byte[] TankPart(string tag, string part) { var pda = provider.Discovered(tag); + UDataTable? dataTable = null; - foreach (var entry in tankPartEntries) { - pda.Get(entry); - // var icon = pda.Get("Icon"); + foreach (var (prefix, name) in tankPartPrefixes) + { + if (!part.StartsWith(prefix)) { continue; } + + dataTable = pda.Get(name); + break; } - return []; + if (dataTable == null) + { + throw new ArgumentException($"Unknown tank part: {part}"); + } + + dataTable.TryGetDataTableRow(part, StringComparison.Ordinal, out var row); + + if (row == null) + { + throw new ArgumentException($"Unknown tank part: {part}"); + } + + var visualData = row.Get("VisualData"); + var meshSettings = visualData.Get("MeshSettings"); + // var collisionMesh = meshSettings.Get("CollisionMesh"); + var mesh = meshSettings.Get("GunMesh"); + var gltf = new MonoGltf(mesh); + + return [.. gltf.Write()]; } } diff --git a/packages/game/Models/BlitzFileProvider.cs b/packages/game/Models/BlitzFileProvider.cs index 020edcaf7..89f4bb777 100644 --- a/packages/game/Models/BlitzFileProvider.cs +++ b/packages/game/Models/BlitzFileProvider.cs @@ -67,7 +67,6 @@ public partial class BlitzFileProvider : DefaultFileProvider public T Discovered(string path) where T : UObject { - Console.WriteLine(discovered[path]); return LoadPackageObject(discovered[path]); }