Skip to content

fix: include projectile events in v1 JSON export#77

Merged
fank merged 3 commits intomainfrom
fix/projectile-events-v1-export
Feb 3, 2026
Merged

fix: include projectile events in v1 JSON export#77
fank merged 3 commits intomainfrom
fix/projectile-events-v1-export

Conversation

@fank
Copy link
Member

@fank fank commented Feb 3, 2026

Summary

  • Grenades, smoke grenades, and other projectiles now appear in the v1 JSON export
  • framesFired format simplified to match old C++ extension: [frameNum, [x, y, z]]
  • Web frontend compatibility maintained

Problem

Projectile events (grenades, smokes, etc.) sent via :PROJECTILE: command were:

  1. Being captured by the extension (visible in RPT logs)
  2. But NOT exported to JSON because handleProjectileEvent skipped memory backend storage

Solution

  1. Added ProjectileEventToFiredEvent converter to extract start/end positions from LineStringZM geometry
  2. Updated handleProjectileEvent to record to memory backend when configured
  3. Simplified framesFired format from extended format to simple [frameNum, [x, y, z]]

Test plan

  • All existing tests pass
  • New converter tests added
  • DLL builds successfully
  • Manual test with grenades/smokes in-game

fank added 3 commits February 3, 2026 22:42
Grenades and smoke grenades were being captured via :PROJECTILE: command
but not exported to JSON because the handler skipped memory backend
storage and the v1 builder didn't include them.

Changes:
- Add ProjectileEventToFiredEvent converter to extract start/end
  positions from projectile trajectory LineStringZM geometry
- Update handleProjectileEvent to record to memory backend by
  converting to FiredEvent format
- Simplify framesFired format to [frameNum, [x, y, z]] to match
  old C++ extension and web frontend expectations

The extended format with weapon/magazine/firingMode can be added
in v2 when the web frontend supports it.
The :TIMESTAMP: command was only handled in RVExtension (simple format)
but not in RVExtensionArgs (args format). When the addon called via the
args format, it resulted in "no handler registered" errors.
Replace JSON parsing with direct SQF array format parsing for better
performance. The new format uses:
- Indexed array elements instead of JSON object keys
- diag_tickTime instead of extension :TIMESTAMP: calls
- Stringified nested arrays for positions and hitParts

This aligns with the addon changes that eliminate the JSON encoding
overhead and remove the :TIMESTAMP: extension calls.
@fank fank force-pushed the fix/projectile-events-v1-export branch from f4acf19 to 46a5aa8 Compare February 3, 2026 22:57
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Merging this branch changes the coverage (2 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/extension/v5/internal/handlers 9.97% (-0.04%) 👎
github.com/OCAP2/extension/v5/internal/model/convert 85.71% (+1.76%) 👍
github.com/OCAP2/extension/v5/internal/storage/memory 97.09% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1 100.00% (ø)
github.com/OCAP2/extension/v5/internal/worker 15.85% (-0.46%) 👎
github.com/OCAP2/extension/v5/pkg/a3interface 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/extension/v5/internal/handlers/handlers.go 9.97% (-0.04%) 762 (+3) 76 686 (+3) 👎
github.com/OCAP2/extension/v5/internal/model/convert/convert.go 85.71% (+1.76%) 91 (+10) 78 (+10) 13 👍
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1/builder.go 100.00% (ø) 100 100 0
github.com/OCAP2/extension/v5/internal/worker/dispatch.go 17.95% (-0.67%) 195 (+7) 35 160 (+7) 👎
github.com/OCAP2/extension/v5/pkg/a3interface/rvextension.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/extension/v5/internal/model/convert/convert_test.go
  • github.com/OCAP2/extension/v5/internal/storage/memory/export/v1/builder_test.go
  • github.com/OCAP2/extension/v5/internal/storage/memory/export_test.go

@fank
Copy link
Member Author

fank commented Feb 3, 2026

OCAP2/addon#43

@fank fank merged commit e17998b into main Feb 3, 2026
3 checks passed
@fank fank deleted the fix/projectile-events-v1-export branch February 3, 2026 23:30
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.

1 participant