fix: sector tracking bugs, contested events, and typed event args#97
fix: sector tracking bugs, contested events, and typed event args#97
Conversation
1. Init mode unreachable: bare `call FUNC(trackSectors)` inherits `_this` as an array from the CBA XEH calling scope, so `_this isEqualType []` was always true — entering single-sector mode with no sector argument instead of init mode. Fixed by requiring a non-empty array for single-sector dispatch. 2. Case mismatch: BIS_fnc_moduleSector fires the scripted event as "ownerChanged" (lowercase), but we registered for "OwnerChanged" (uppercase). The BIS scripted EH system uses case-sensitive getVariable for lookup, so our handler was never called. 3. Swapped parameters: BIS passes [sector, newOwner, oldOwner] but params had _oldOwner and _newOwner reversed, causing the sideUnknown guard to check the wrong side.
When a sector's owner changes to sideUnknown (neutral), emit a "contested" event instead of silently dropping the transition. Previously only captured events were emitted, and ownership loss was filtered out entirely. Also removes redundant INFO RPT log since the extension log already captures these events.
Summary of ChangesHello, 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 addresses several issues related to sector tracking and event handling within the recorder addon. It refines how sector ownership changes are detected and reported, ensuring more accurate and comprehensive event logging. The changes improve the reliability of event triggers, correct parameter handling, and introduce a new event type for contested sectors, ultimately enhancing the fidelity of recorded gameplay data. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces several important bug fixes for sector tracking, including correcting a case-sensitive event name, fixing swapped event handler parameters, and preventing an issue with _this initialization. It also adds a new 'contested' event type for when a sector becomes neutral. The changes are well-documented and address real issues. I have one suggestion to improve code conciseness by refactoring the new event dispatching logic.
Summary
Sector Tracking Bug Fixes
"OwnerChanged"→"ownerChanged"— BIS fires lowercase, andBIS_fnc_addScriptedEventHandlerstores handlers case-sensitively, so the handler never fired_oldOwner, _newOwner→_newOwner, _oldOwner— BIS passes[sector, newOwner, oldOwner]_this isEqualType []always matched because barecallinherits_this=[]from CBA XEH scope — added&& {count _this > 0}guardContested Sector Events
sideUnknown), emit a"contested"event instead of silently dropping the transitionTyped Event Args
fnc_handleCustomEvent.sqf: Routes by event type — captured/contested/capturedFlag send typed positional args[frame, type, objectType, unitName, posX, posY, posZ], endMission sends[frame, type, side, message], other events keep the legacy formatfnc_trackSectors.sqf: Passes["sector", _name, _pos]arrays instead offormat ["%1,sector", _name]comma-delimited strings — fixes parsing when sector names contain commasfnc_exportData.sqf: Sends typed[frame, "endMission", side, message]instead of empty message + extraData JSON — fixes data loss in v1 exportCompanion PR
ParseGeneralEvent)ba092b1don main (contested event support in decoders/UI/i18n)Test plan
hemtt build)