Skip to content

feat: replace mine projectile events with placed object lifecycle#74

Merged
fank merged 5 commits intomainfrom
refactor/eliminate-database-addon
Feb 22, 2026
Merged

feat: replace mine projectile events with placed object lifecycle#74
fank merged 5 commits intomainfrom
refactor/eliminate-database-addon

Conversation

@fank
Copy link
Member

@fank fank commented Feb 19, 2026

Summary

  • Mines and explosives (weapon == "put") now use dedicated :NEW:PLACED: and :PLACED:EVENT: commands instead of being sent as :PROJECTILE: events
  • Placed objects receive unique OCAP IDs from the shared nextId counter and track lifecycle event handlers for detonation, hit recording, and removal
  • Avoids the double-send issue where mines were sent both at placement and detonation via the projectile path
  • Server-side CBA event handlers forward placed object data and lifecycle events to the extension
  • HitExplosion EH tracks casualties from placed object detonations, sending hit events with victim OCAP ID
  • ACE3 explosives now use the same placed object pipeline instead of marker-based tracking, giving them proper entity tracking, casualty recording, and web playback hit events

Companion extension PR: OCAP2/extension#126

Test plan

  • hemtt build succeeds
  • Place mines in-game → :NEW:PLACED: sent to extension with correct OCAP ID, position, side, and magazine icon
  • Detonate a mine → :PLACED:EVENT: sent with "detonated" type
  • Mine detonation near units → :PLACED:EVENT: sent with "hit" type and victim OCAP ID
  • Defuse/delete a mine → :PLACED:EVENT: sent with "deleted" type
  • Only one lifecycle event sent per mine (no double-send on detonation)
  • Non-mine projectiles (grenades, rockets) still use the existing :PROJECTILE: path
  • ACE3 satchel charges/claymores → :NEW:PLACED: sent (same as vanilla mines)
  • ACE3 explosive detonation → :PLACED:EVENT: with "detonated" and "hit" events

@gemini-code-assist
Copy link

Summary of Changes

Hello @fank, 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 introduces a new feature to track vanilla mine placements within the game, enhancing the recording and playback capabilities by visually representing mine locations. It establishes a system to create temporary map markers when mines are deployed and subsequently removes these markers upon detonation, ensuring that the recorded data accurately reflects the battlefield state. The changes also include a significant refactoring of the extension's initialization logic, streamlining how the recording session is set up and managed.

Highlights

  • Vanilla Mine Tracking: Implemented tracking for vanilla mine placements by detecting the 'put' weapon action in the fired event handler.
  • Minefield Markers: Created temporary 'Minefield' triangle markers on the map at the exact position where vanilla mines are placed.
  • Dynamic Marker Removal: Ensured that mine placement markers are automatically removed from the map upon the mine's detonation, leveraging the 'Explode' event handler.
  • Event Infrastructure Alignment: Reused the existing 'handleMarker' event infrastructure, mirroring the pattern established for ACE explosive tracking, for consistent marker management.
  • Persistent Markers for Undetonated Mines: Designed the system such that mine markers persist throughout the entire recording if the mine never detonates, providing a complete picture of unexploded ordnance.
  • Extension Initialization Refactor: Refactored the extension initialization process, renaming 'initDB' to 'initSession' and centralizing one-time setup calls to improve clarity and flow.
Changelog
  • .gitignore
    • Added '.hemttprivatekey' to the ignore list.
    • Added '*.biprivatekey' to the ignore list.
  • addons/extension/XEH_prep.sqf
    • Added PREP calls for 'initSession' and 'newMission'.
  • addons/extension/fnc_initSession.sqf
    • Renamed from 'fnc_initDB.sqf'.
    • Refactored initialization logic to use 'sessionReady' instead of 'dbValid'.
    • Updated variable names for extension version from 'EGVAR(database,extensionVersion)' to 'GVAR(dllVersion)'.
    • Changed 'EFUNC(extension,sendData)' to 'FUNC(sendData)'.
    • Removed one-time setup calls (getStaticObjects, addEventHandlers, eh_fired_server, telemetryLoop) as they are now handled in 'fnc_init.sqf'.
  • addons/extension/fnc_newMission.sqf
    • Updated internal function name and comments to reflect 'initSession' and 'sessionReady'.
    • Changed 'EFUNC(extension,sendData)' to 'FUNC(sendData)'.
  • addons/recorder/XEH_prep.sqf
    • Added PREP calls for 'addEventIntegrations', 'getStaticObjects', 'handleChatMessage', and 'radioEvent'.
  • addons/recorder/fnc_addEventIntegrations.sqf
    • Removed the 'GVAR(enabled)' check.
    • Updated event data to use 'GVAR(captureFrameNo)' directly.
    • Switched database validity check to 'EGVAR(extension,sessionReady)' and added 'SHOULDSAVEEVENTS'.
  • addons/recorder/fnc_captureLoop.sqf
    • Updated database validity checks to 'EGVAR(extension,sessionReady)' for new soldier and vehicle data.
  • addons/recorder/fnc_eh_fired_client.sqf
    • Implemented tracking for vanilla mine placement, creating a unique marker name and sending a server event.
    • Updated function call for bullet event handlers from 'FUNCMAIN(addBulletEH)' to 'FUNC(eh_fired_clientBullet)'.
  • addons/recorder/fnc_eh_fired_clientBullet.sqf
    • Added logic to send a server event for mine detonation, triggering marker removal.
  • addons/recorder/fnc_eh_fired_server.sqf
    • Streamlined client-side function distribution for fired event handlers, removing 'FUNCMAIN' aliases.
    • Updated calls to client-side fired event handlers from 'FUNCMAIN(handleFiredMan)' to 'FUNC(eh_fired_client)'.
    • Introduced new CBA event handlers for 'minePlaced' and 'mineDetonated' to manage map markers.
  • addons/recorder/fnc_exportData.sqf
    • Updated session validity flag from 'EGVAR(database,dbValid)' to 'EGVAR(extension,sessionReady)'.
  • addons/recorder/fnc_getStaticObjects.sqf
    • Updated internal function name and description in comments.
  • addons/recorder/fnc_handleChatMessage.sqf
    • Updated event data to use 'GVAR(captureFrameNo)' directly instead of 'EGVAR(recorder,captureFrameNo)'.
  • addons/recorder/fnc_init.sqf
    • Relocated event handler and object initialization calls from 'fnc_initSession'.
    • Updated extension initialization to use 'initSession' and 'sessionReady' instead of 'initDB' and 'dbValid'.
  • addons/recorder/fnc_radioEvent.sqf
    • Updated event data to use 'GVAR(captureFrameNo)' directly instead of 'EGVAR(recorder,captureFrameNo)'.
  • addons/recorder/fnc_startRecording.sqf
    • Updated session validity checks and new mission registration calls to use 'sessionReady' and 'EFUNC(extension,newMission)'.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/build.yml
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 introduces a new feature to track vanilla mine placements with markers, mirroring the existing pattern for ACE explosives. It also includes a significant and valuable refactoring of the codebase. The database component is now integrated into a more generic extension component, and recorder-specific logic has been moved to the recorder component, which improves modularity and separation of concerns. The new feature is well-implemented. I have one minor suggestion to improve performance and readability in the new mine tracking logic. Overall, this is a great contribution.

Mines and explosives now get dedicated :NEW:PLACED: and :PLACED:EVENT:
commands instead of being sent as :PROJECTILE: events. Placed objects
receive unique OCAP IDs and track Explode/Deleted events for detonation
and removal, avoiding the double-send issue with the projectile path.
@fank fank force-pushed the refactor/eliminate-database-addon branch from 383a6d1 to 1994d60 Compare February 22, 2026 18:23
@fank fank changed the title feat: track vanilla mine placement with markers feat: replace mine projectile events with placed object lifecycle Feb 22, 2026
fank added 4 commits February 22, 2026 20:25
The fired handler runs on the projectile owner (client/HC/server),
but GVAR(nextId) is only initialized on the server. On clients it
was undefined, producing "any" for placedId and cascading to -1 in
Explode/Deleted event handlers.

Move ID assignment to the server-side handlePlacedData CBA handler
and broadcast the assigned ID back onto the projectile object.
Record which entities are hit by mine/explosive detonations. Sends
a "hit" placed event per victim, filtered by _hitThings to avoid
false positives from near-misses.
Replace marker-based tracking with the same :NEW:PLACED: / :PLACED:EVENT:
pipeline used by vanilla mines, giving ACE3 explosives proper entity
tracking, HitExplosion casualty recording, and web playback hit events.
@fank fank merged commit 483a631 into main Feb 22, 2026
1 check passed
@fank fank deleted the refactor/eliminate-database-addon branch February 22, 2026 22:17
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