Skip to content

fix: sector event routing, type guards, and color field#99

Merged
fank merged 10 commits intomainfrom
fix/sector-event-side-field
Mar 7, 2026
Merged

fix: sector event routing, type guards, and color field#99
fank merged 10 commits intomainfrom
fix/sector-event-side-field

Conversation

@fank
Copy link
Member

@fank fank commented Mar 7, 2026

Summary

  • Pass side field through sector events (captured/contested) to the extension via :EVENT:SECTOR:
  • Remove capturedFlag from :EVENT:SECTOR: routing — it has incompatible player-centric field semantics ([unitName, unitSide, flagSide]) vs sector-centric ([objectType, unitName, side, color, position]). capturedFlag now falls through to :EVENT:GENERAL:.
  • Add type guards ([""]) to all param extractions so array values at unexpected indices don't leak through as wrong types
  • Extract and send the color field (index 3) from event message arrays to the extension
  • Update fnc_trackSectors.sqf to include empty color field in sector capture events

Sector event args sent to extension change from:
[frame, type, objectType, unitName, side, posX?, posY?, posZ?]
to:
[frame, type, objectType, unitName, side, color, posX?, posY?, posZ?]

Test plan

  • Verify captured events include side string from fnc_trackSectors
  • Verify contested events pass empty side string
  • Verify capturedFlag routes through :EVENT:GENERAL: with JSON-encoded data
  • Verify color field is extracted from event message and sent to extension
  • Verify fnc_trackSectors events include empty color between side and position

- fnc_trackSectors: include str _newOwner (side) in captured events,
  empty string for contested events
- fnc_handleCustomEvent: extract side string from eventMessage[2]
  and pass it as a typed positional arg to :EVENT:SECTOR:
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request restores the side field to sector capture events, which was inadvertently omitted in a previous refactor. By modifying both the event generation and handling scripts, it ensures that the external extension receives comprehensive event data, including the side of the capturing entity, thereby improving the accuracy and completeness of recorded information.

Highlights

  • Event Data Enrichment: The fnc_trackSectors.sqf script now includes the side of the new owner (or an empty string for contested sectors) when capturing sector events, ensuring more complete data is passed.
  • Event Argument Handling: The fnc_handleCustomEvent.sqf script was updated to correctly extract this side string from the event message array and pass it as a typed positional argument to the external extension.
Changelog
  • addons/recorder/fnc_handleCustomEvent.sqf
    • Added logic to extract the side string from the third element of the event message array (_eventMessage param [2, ""]) if it is present and of string type.
    • Updated the internal comment describing the array format to include 'side' and 'color' as potential elements at specific indices.
  • addons/recorder/fnc_trackSectors.sqf
    • Modified the CBA_fnc_localEvent call for 'contested' sectors to explicitly pass an empty string for the side, maintaining the expected data structure.
    • Modified the CBA_fnc_localEvent call for 'captured' sectors to explicitly pass the string representation of the new owner's side (str _newOwner).
Activity
  • The PR author confirmed that hemtt build compiles successfully.
  • The changes have been verified against real game recording data.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds the side field to sector events, ensuring it's passed to the extension as intended. The changes in fnc_trackSectors.sqf properly include the side information, and fnc_handleCustomEvent.sqf is updated to process it. I have one suggestion for fnc_handleCustomEvent.sqf to simplify the new logic for improved clarity.

fank added 2 commits March 7, 2026 13:50
capturedFlag has player-centric fields (unitName, unitSide, flagSide)
incompatible with sector-centric fields (objectType, unitName, side,
position). Let it fall through to :EVENT:GENERAL: instead.
@fank fank changed the title fix: pass side field through sector events to extension fix: sector event side field and capturedFlag separation Mar 7, 2026
fank added 6 commits March 7, 2026 15:00
param [2, ""] already guarantees a string default, so the isEqualType
check was redundant.
param [2, ""] returns the raw value at index 2 even if it's an array
(position), not the default. Use param's type-check argument [2, "", [""]]
to ensure only strings are accepted as side, falling back to "" for
non-string values like position arrays at index 2.
Document the full format [objectType, unitName, side, color, position]
and note that color is not captured by the extension. Add type guards
to params 0 and 1 for consistency.
Extract color (index 3) from the event message array and send it to
the extension as part of the :EVENT:SECTOR: args. Format changes from
[frame, type, objectType, unitName, side, posX?, posY?, posZ?] to
[frame, type, objectType, unitName, side, color, posX?, posY?, posZ?].
fnc_trackSectors sends [objectType, name, side, position] but the
extension now expects color between side and position. Add empty string
for color since sectors don't have a meaningful color value.
@fank fank changed the title fix: sector event side field and capturedFlag separation fix: sector event routing, type guards, and color field Mar 7, 2026
@fank fank merged commit b5189f7 into main Mar 7, 2026
1 check passed
@fank fank deleted the fix/sector-event-side-field branch March 7, 2026 14:37
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