Skip to content

docs: add struct field documentation and fix semantic issues#78

Merged
fank merged 1 commit intomainfrom
docs/model-field-documentation
Feb 4, 2026
Merged

docs: add struct field documentation and fix semantic issues#78
fank merged 1 commit intomainfrom
docs/model-field-documentation

Conversation

@fank
Copy link
Member

@fank fank commented Feb 4, 2026

Summary

  • Add comprehensive comments to all model struct fields documenting what each field represents, the SQF command reference, and OCAP ID vs Object ID clarification
  • Fix IsAwakeIsUnconscious semantic inversion in Ace3UnconsciousEvent to match SQF behavior
  • Add missing :PROJECTILE: fields: SimulationType, IsSubmunition, MagazineIcon

Changes

Model Documentation

Added detailed comments to all struct fields in model.go including:

  • Field purpose and data type
  • SQF command and argument index reference
  • Clarification that ObjectID refers to OCAP-assigned sequential IDs (not Arma netId)

Bug Fix: Semantic Inversion

The SQF sends _isUnconscious (true when unconscious) but the Go struct had IsAwake (inverted semantics). Fixed across:

  • internal/model/model.go
  • internal/model/core/events.go
  • internal/model/convert/convert.go
  • internal/handlers/handlers.go
  • Tests updated accordingly

Missing Fields Added

Added three missing fields to ProjectileEvent per the SQF specification:

  • SimulationType (index 17) - e.g., shotBullet, shotShell, shotRocket
  • IsSubmunition (index 18) - whether projectile is from cluster/split ammo
  • MagazineIcon (index 19) - path to magazine icon texture

Test plan

  • go build ./... passes
  • go test ./internal/handlers/... ./internal/model/... ./internal/storage/... passes

- Add comprehensive comments to all model struct fields documenting:
  - What each field represents
  - SQF command and argument order reference
  - OCAP ID vs Object ID clarification

- Fix IsAwake -> IsUnconscious semantic inversion in Ace3UnconsciousEvent
  to match SQF behavior (true = unconscious, not awake)

- Add missing :PROJECTILE: fields:
  - SimulationType (index 17) - ammo simulation type
  - IsSubmunition (index 18) - whether from cluster/split ammo
  - MagazineIcon (index 19) - magazine icon texture path
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/extension/v5/internal/handlers 9.87% (-0.10%) 👎
github.com/OCAP2/extension/v5/internal/model 0.00% (ø)
github.com/OCAP2/extension/v5/internal/model/convert 85.71% (ø)
github.com/OCAP2/extension/v5/internal/model/core 0.00% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory 97.09% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/extension/v5/internal/handlers/handlers.go 9.87% (-0.10%) 770 (+8) 76 694 (+8) 👎
github.com/OCAP2/extension/v5/internal/model/convert/convert.go 85.71% (ø) 91 78 13
github.com/OCAP2/extension/v5/internal/model/core/events.go 0.00% (ø) 0 0 0
github.com/OCAP2/extension/v5/internal/model/model.go 0.00% (ø) 36 0 36

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/memory_test.go

@fank fank merged commit 3c18f4f into main Feb 4, 2026
3 checks passed
@fank fank deleted the docs/model-field-documentation branch February 4, 2026 10:55
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