Skip to content

fix: skip kill event for disconnected players#54

Merged
fank merged 1 commit intomainfrom
fix/disconnect-counted-as-death
Feb 14, 2026
Merged

fix: skip kill event for disconnected players#54
fank merged 1 commit intomainfrom
fix/disconnect-counted-as-death

Conversation

@fank
Copy link
Member

@fank fank commented Feb 14, 2026

Summary

  • When a player disconnects, HandleDisconnect marks the unit as excluded, then the engine deletes the unit which fires EntityKilled. Since fnc_eh_killed had no check for the exclude flag, disconnects were recorded as deaths — inflating the death counter in playback statistics.
  • Adds an early exit in fnc_eh_killed that skips recording the kill event when the victim is already marked as excluded (disconnected).

Fixes OCAP2/OCAP#71

Test plan

  • Connect to a server that is already recording
  • Disconnect and reconnect multiple times
  • Verify death counter does not increase on disconnect
  • Verify actual in-game deaths are still recorded correctly

When a player disconnects, HandleDisconnect marks the unit as excluded,
then the engine deletes the unit which fires EntityKilled. Since
fnc_eh_killed had no check for the exclude flag, disconnects were
recorded as deaths, inflating the death counter in playback statistics.

Fixes OCAP2/OCAP#71
@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 addresses a bug that caused player disconnections to be misinterpreted as in-game deaths, thereby skewing playback statistics. By introducing a check for disconnected players within the kill event handler, the change ensures that only genuine combat-related deaths are accurately recorded, improving the integrity of game analytics.

Highlights

  • Bug Fix: Incorrect Death Recording: Resolved an issue where player disconnections were erroneously recorded as deaths in playback statistics, leading to inflated death counts.
  • Logic Update: fnc_eh_killed: Implemented an early exit condition in the fnc_eh_killed function to prevent recording kill events for players who have already been marked as excluded (disconnected).
Changelog
  • addons/recorder/fnc_eh_killed.sqf
    • Added a check to skip recording kill events for excluded (disconnected) players.
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 addresses an issue where player disconnections were incorrectly recorded as deaths. The fix involves adding an early exit in fnc_eh_killed.sqf to check if the victim unit has been marked with an exclude flag, which is set during the disconnection process. The implementation is clean, correct, and effectively solves the problem described. The new check is well-placed among the existing guard clauses. I have no further suggestions for improvement.

@fank fank merged commit 378348f into main Feb 14, 2026
1 check passed
@fank fank deleted the fix/disconnect-counted-as-death branch February 14, 2026 20:53
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.

Player disconnect counts as death

1 participant