fix(game/five): SET_HELI_*_ROTOR_HEALTH sync fixes #3088
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal of this PR
This PR addresses an issue where helicopter rotors do not break off correctly when their health is set to
0.0
via scripts using the natives_SET_HELI_MAIN_ROTOR_HEALTH
or_SET_HELI_TAIL_ROTOR_HEALTH
.Under normal game scenarios, such as damage from collisions or bullets, a rotor with
0.0
health breaks off the helicopter as intended. However, when the health is altered via these natives, the necessary checks to trigger rotor detachment are missing. This results in an inconsistent synchronization state: the rotor remains attached on the entity owner's client, while it appears broken off for remote players (as health sync node updates forNetObjHeli
contain the required checks already).This PR ensures that rotor health changes made via script are handled consistently, preserving sync integrity across all clients.
How is this PR achieving the goal
We hook the native handlers for
_SET_HELI_MAIN_ROTOR_HEALTH
and_SET_HELI_TAIL_ROTOR_HEALTH
. After the native invocation, the new rotor health is checked. If the health is set to0.0
, we manually call the rotor break-off functions to ensure that the rotor detaches correctly and the synchronization state remains consistent for all clients within the sync range.This PR applies to the following area(s)
FiveM, Natives
Successfully tested on
Game builds: 2060, 3407
Platforms: Windows (Client)
Checklist
Fixes issues
fixes #2997