feat: replace mine projectile events with placed object lifecycle#74
feat: replace mine projectile events with placed object lifecycle#74
Conversation
Summary of ChangesHello @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
Changelog
Ignored Files
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 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.
383a6d1 to
1994d60
Compare
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.
Summary
weapon == "put") now use dedicated:NEW:PLACED:and:PLACED:EVENT:commands instead of being sent as:PROJECTILE:eventsnextIdcounter and track lifecycle event handlers for detonation, hit recording, and removalCompanion extension PR: OCAP2/extension#126
Test plan
hemtt buildsucceeds:NEW:PLACED:sent to extension with correct OCAP ID, position, side, and magazine icon:PLACED:EVENT:sent with"detonated"type:PLACED:EVENT:sent with"hit"type and victim OCAP ID:PLACED:EVENT:sent with"deleted"type:PROJECTILE:path:NEW:PLACED:sent (same as vanilla mines):PLACED:EVENT:with"detonated"and"hit"events