Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(game/five): SET_HELI_*_ROTOR_HEALTH sync fixes #3088

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tens0rfl0w
Copy link
Contributor

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 for NetObjHeli 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 to 0.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

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

fixes #2997

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Jan 21, 2025
@ImBaphomettt
Copy link

This seems to fix my previous report. Great work !

#2997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Requires changes before it's considered valid and can be (re)triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronization issue with helicopter blade breaking using the native SetHeliMainRotorHealth
2 participants