1
0
Fork 0
polaris-task-force/src/lib/arma-markers/AGENTS.md
Z8MB1E 3bef63af33 feat(map-objectives): superuser-authored strategic objectives on mission maps
Add a superuser-authored objective layer (defend, assault, secure, etc.)
shown as labelled map markers on both the world map and mission planning
map, with per-layer toggles on the planning map.

- collection: MapObjectives (map_objectives table, enums, FKs)
- lib: objectives service + objectiveTypes + permissions + event emit
- actions/api: create/update/delete objectives server actions
- UI: feature-layer toggles, objective picker dialog, world/plan markers,
  SQF export, dossier dialog integration
- generated: regenerate payload schema + types for map_objectives
- tests: 10 integration specs + e2e spec
- docs: CHANGELOG, map-system, AGENTS guides
2026-10-27 02:12:31 -04:00

5.1 KiB

AGENTS.md: Mission Planning Map (Arma 3 Markers)

Parent: ../../../AGENTS.md (root guide: commands, Server Actions convention, domain guide index).

Optional per-mission planning layer: the mission's own map (classification.map) rendered on the mission page with Arma 3 map markers that belong to that mission only (never on the shared world map).

  • Marker assets: bun run markers:arma (src/tools/arma/extractMarkers.ts, needs the game install + hemtt; default game root /mnt/LData/SteamLibrary/steamapps/common/Arma 3, override --game). Scans Dta, Addons and every DLC addons dir (skips @ mod folders), parses + merges CfgMarkers / CfgMarkerColors / CfgMarkerBrushes / CfgMarkerClasses with inheritance, resolves $STR_ names via stringtables, converts icons to PNG in public/arma/markers/ (committed, so prod needs no game files) and regenerates src/lib/arma-markers/catalog.generated.ts (never edit by hand). Side-color expressions resolve to Arma's default profile colors (BLUFOR 0,0.3,0.6 etc.).
  • Catalog lib (src/lib/arma-markers/, pure, client-safe): index.ts (case-insensitive markerTypeOf/markerColorOf/markerBrushOf, resolveMarkerRgba where color Default = the type's own config color, markerTypesByCategory), missionMarkers.ts (marker model mirroring Arma: shape icon/rectangle/ellipse/polyline + type/color/brush/text/size/direction/alpha/points; normalizeMarkerInput validation; areaOutline (direction = degrees clockwise from north, size = half-extents like markerSize); hatchSegments for pattern brushes; armaGridRef; markersToSqf export, y flipped against world height).
  • Collection: mission-map-markers (src/collections/intelligence/MissionMapMarkers.ts, permission group "Mission Map Markers", REST access permission-gated). Missions gained classification.planningMapEnabled (opt-in) and a beforeDelete hook that removes the mission's markers (the FK is NOT NULL, so Payload's default ON DELETE SET NULL would fail the delete). Migration 20261003_190000_add_mission_map_markers (hand-written; matches the generated schema).
  • Rules: read = anyone who can read the mission (user-scoped findByID). Two edit tiers in src/lib/intelligence/missionMap.ts: curators (missions:update or the mission's createdBy) manage the whole plan (toggle, clear, edit/delete any marker); delegates (classification.planningMapDelegates, set per mission by missions:update holders via setMissionPlanningDelegates) may place markers and edit/delete only their own. The map locks for everyone (isMissionPlanLocked) once status is Completed/Cancelled. Placing a marker queues 2 contribution XP that grants only if the marker survives to completion (see src/lib/contributions/AGENTS.md). Service src/lib/intelligence/missionMap.ts; server actions src/app/(frontend)/intelligence/missions/mapActions.ts (setMissionPlanningMap, setMissionPlanningDelegates, getMissionMapMarkers, saveMissionMapMarker, deleteMissionMapMarker, clearMissionMapMarkers; events mission:planning-map-toggle / mission:planning-delegates / mission:map-marker-* / mission:map-markers-clear, target missions). Max 1000 markers per mission.
  • UI: src/components/frontend/intelligence/missionMap/ (tactical dossier section above the mission detail grid). MissionPlanningMap (state, debounced per-marker saves, 30s background refresh of markers and the map's shared objectives, Delete/Escape keys, SQF copy that includes visible objectives, Arma grid readout, Layers popover persisted in localStorage: objectives/structures/nodes/shipments/ranges plus grid/roads/zones), MissionMapCanvas (Leaflet, basemap + roads/zones via GET /api/map-features?mapId=&layers=base, which skips structures/nodes/shipments until one of those reference layers is switched on; then the full feed loads), PlanningFeatureLayers (read-only structure/node/shipment/range reference markers with links back to the owning records), MarkerToolPanel (tools, type picker, colors, brush, text, scale/size, direction, opacity), markerIcon.ts + iconStyle.ts (icons render as texture MULTIPLIED by the marker color and masked by the texture alpha, exactly like Arma: white glyphs take the color, flags keep theirs; both moved to the shared src/components/frontend/markers/ folder alongside MarkerTypePicker). Editors see an "Enable planning map" card until it is on; non-editors see nothing until enabled. Superusers (system:admin-access) can also place and amend the map's strategic objectives from the planning map through the shared ObjectiveDialog / ObjectiveLayer, independently of mission-marker curation.
  • Gotchas: leaflet click/dblclick/mousedown/mouseup fire faster than React re-renders, so draft line vertices and the area drag start live in refs (state only drives the preview). URLs inside divIcon HTML must use single quotes (url('...')): a double quote ends the style attribute and the glyph silently disappears. Radix Select keeps pointer-events: none on <body> briefly after closing (affects scripted drags right after choosing a brush). Tests: tests/int/mission-map.int.spec.ts, tests/e2e/mission-planning-map.e2e.spec.ts.