mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-17 12:57:57 -04:00
### Problem
NavMesh baking needed to store raw binary data in external files (`.navdata`) that should be tracked and packaged, but aren't native compiled resources.
### Solution
Reused the existing `RegisterAdditionalRelatedFile_Game` native infrastructure to track raw files similar to how `RegisterAdditionalRelatedFile_Content` is used to track content sources (.fbx, .tga...). `RegisterAdditionalRelatedFile_Game` was not used anywhere in the codebase, so it's safe to repurpose. This avoids changing the asset file format.
### Changes
**C# Asset System:**
- Split `GetAdditionalRelatedFiles()` into:
- `GetAdditionalContentFiles()` - content-side files (.fbx, .lxo, .rect, etc.) filtered by `ASSET_LOCATION_CONTENT`
- `GetAdditionalGameFiles()` - game-side data files (.navdata, etc.) filtered by `ASSET_LOCATION_GAME`
**Resource Compilation:**
- Added `FileReference` struct for JSON serialization with `{ "$reference_type: "filereference", "path": "..." }` pattern
- Added `AddGameFileReference()` to `ResourceCompileContext` which calls `RegisterAdditionalRelatedFile_Game()`
**Packaging:**
- `PackageManifest` now additionally collects game/rawfiles files for publishing (content files are still only included when publishing source)