Skip to content

Map icons: RustMaps monument art via RustMapsApi.Assets (runtime SVG raster) - #46

Merged
HandyS11 merged 7 commits into
developfrom
feat/rustmaps-monument-icons
Jul 11, 2026
Merged

Map icons: RustMaps monument art via RustMapsApi.Assets (runtime SVG raster)#46
HandyS11 merged 7 commits into
developfrom
feat/rustmaps-monument-icons

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Summary

Replaces the 35 vendored monument PNGs with SVG artwork from RustMapsApi.Assets 1.0.0-beta.3, rasterized at runtime by Svg.Skia and cached. Monument icons on #map now match the RustMaps red-badge style used by the #info static map, and coverage extends to every monument token Rust+ is known to broadcast.

What changed

  • MonumentTokenMap (new): 37 exact Rust+ token → MonumentType entries plus prefix rules for swamp* / underwater_lab* (Rust+ sends prefab names for those). Sources: previous map + rustplusplus + rustplus.py. Adds previously-missing monuments: radtown, jungle ziggurat, tunnel entrances/links, underwater labs, arctic base B.
  • MonumentIconSource (new DI singleton): resolves token → package SVG → Svg.Skia raster at draw size → Image<Rgba32>, cached per (type, size) in a Lazy-wrapped ConcurrentDictionary (exactly-once rasterization, race-safe). Serves monuments and the rig strip (same asset family; active red ring unchanged).
  • Logging contract: when a monument has no icon (unmapped token, or mapped type without package art) an Information log fires once per unique token per process carrying the raw token — grep No monument icon for token to find gaps. Raster failures log Warning once per (type, size). appsettings.json gains a Serilog override so these Info lines reach production logs despite the global Warning floor.
  • Cleanup: MonumentIconMap + 35 monument PNGs deleted; MapIcons keeps only the vendored non-monument art (cargo, ch47, patrol, player, vendor). MapRenderer takes MonumentIconSource via constructor injection.
  • Packages: RustMapsApi 1.0.0-beta.2 → beta.3 (zero public-API diff, verified), + RustMapsApi.Assets 1.0.0-beta.3, Svg.Skia 5.1.1, SkiaSharp 3.119.4 + SkiaSharp.NativeAssets.Linux.NoDependencies (new native dependency, ~9 MB; all Skia use is confined to Rasterize's try — a host without the native lib degrades to a monument-less map with greppable Warnings instead of crashing).

Verification

  • Full suite: 936 passed + 1 skipped (pre-existing parity fixture skip) / 0 failed across 17 assemblies, -maxcpucount:1, Release, warnings-as-errors clean.
  • jb cleanupcode zero-diff.
  • Drift guards: every mapped type (incl. prefix families) asserted against MonumentAssets.HasAsset; all 39 token routes rasterize to a non-blank 30×30 icon.
  • Multi-agent review: per-task spec+quality gates plus a final whole-branch review (verdict READY TO MERGE after a fix batch covering the Serilog level clash and prefix-family drift-guard gap).

Live smoke (post-merge or on this branch)

Boot the bot, eyeball the #map render (red-badge icons), and grep logs for No monument icon for token — any hit is a one-line dictionary addition in MonumentTokenMap.

🤖 Generated with Claude Code

HandyS11 and others added 7 commits July 11, 2026 17:42
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…h drift guard

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ached, log-once misses

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…null-cache and raster-failure paths

Review fixes on MonumentIconSource: GetOrAdd's value factory could race under
concurrent first requests, leaking a losing Image and double-firing the
rasterization Warning — Lazy (ExecutionAndPublication) now guarantees one
Rasterize per (type, size). Two new tests: an assetless mapped type caches
null (one TryGetAsset call, one Info log across repeats), and a failing
rasterization (bogus MonumentAsset via reflection — its ctor is internal and
unvalidated) warns exactly once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ed PNGs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ards

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the #map monument icon pipeline by replacing vendored monument PNGs with RustMapsApi.Assets SVG artwork, rasterized on-demand via Svg.Skia/SkiaSharp and cached for reuse. It also updates DI and tests to reflect the new icon source and adds a targeted Serilog override so “missing icon” signals reach production logs.

Changes:

  • Introduces MonumentTokenMap (Rust+ token → MonumentType, including prefix families) and MonumentIconSource (token → SVG → rasterized Image<Rgba32>, cached + once-per-token logging).
  • Updates MapRenderer to consume MonumentIconSource via constructor injection and wires it up in AddMap.
  • Updates packages/config/tests accordingly (RustMapsApi beta.3 + assets package, Skia/SVG packages, new/updated map tests, Serilog override).

Reviewed changes

Copilot reviewed 14 out of 49 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/RustPlusBot.Features.Map.Tests/MonumentTokenMapTests.cs Adds mapping + drift-guard tests for token→type and asset coverage.
tests/RustPlusBot.Features.Map.Tests/MonumentIconSourceTests.cs Adds rasterization, caching, and logging behavior tests for the new icon source.
tests/RustPlusBot.Features.Map.Tests/MapRendererTests.cs Updates renderer tests to construct MapRenderer with MonumentIconSource.
tests/RustPlusBot.Features.Map.Tests/MapIconsTests.cs Removes monument/rig assertions now covered by MonumentIconSource tests.
tests/RustPlusBot.Features.Map.Tests/MapComposerTests.cs Updates composer test wiring to provide MapRenderer’s new dependency.
src/RustPlusBot.Host/appsettings.json Adds Serilog per-source override to emit MonumentIconSource Information logs.
src/RustPlusBot.Features.Map/RustPlusBot.Features.Map.csproj Adds references for RustMapsApi.Assets + Skia/SVG raster dependencies.
src/RustPlusBot.Features.Map/Rendering/MapRenderer.cs Switches monument/rig icon retrieval to MonumentIconSource and updates ctor.
src/RustPlusBot.Features.Map/MapServiceCollectionExtensions.cs Registers RustMaps assets + MonumentIconSource singleton for DI.
src/RustPlusBot.Features.Map/Assets/MonumentTokenMap.cs New token→MonumentType mapping (including prefix family rules).
src/RustPlusBot.Features.Map/Assets/MonumentIconSource.cs New runtime SVG rasterizer + cache + “log once” reporting.
src/RustPlusBot.Features.Map/Assets/MonumentIconMap.cs Removes legacy vendored monument icon-key mapping.
src/RustPlusBot.Features.Map/Assets/MapIcons.cs Narrows responsibility to vendored marker/player/vendor icons; removes monument/rig APIs.
Directory.Packages.props Bumps RustMapsApi, adds RustMapsApi.Assets and Skia/SVG package versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HandyS11
HandyS11 merged commit def4d25 into develop Jul 11, 2026
4 checks passed
@HandyS11
HandyS11 deleted the feat/rustmaps-monument-icons branch July 11, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants