fix: skip kill event for disconnected players#54
Conversation
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
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 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
Changelog
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 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.
Summary
HandleDisconnectmarks the unit as excluded, then the engine deletes the unit which firesEntityKilled. Sincefnc_eh_killedhad no check for the exclude flag, disconnects were recorded as deaths — inflating the death counter in playback statistics.fnc_eh_killedthat skips recording the kill event when the victim is already marked as excluded (disconnected).Fixes OCAP2/OCAP#71
Test plan