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

feat(extra-natives/five): train movement natives #2972

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

Ehbw
Copy link
Contributor

@Ehbw Ehbw commented Dec 1, 2024

Goal of this PR

Introduce a set of getters + a setter for several aspects of train movements. Allows for scripts to get information about the trains current speed, cruise speed, direction and state (e.g. moving, stopping at station, stopped at station and driving away from station) which was previously not possible

How is this PR achieving the goal

By creating GET_TRAIN_DIRECTION, GET_TRAIN_STATE, GET_TRAIN_CRUISE_SPEED, GET_TRAIN_SPEED and SET_TRAIN_STATE (to allow for scripts to change the trains current state)

This PR applies to the following area(s)

FiveM, Natives

Successfully tested on

Game builds: 1604, 3258

Platforms: Windows

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

@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Dec 1, 2024
@dalekenium-cfx dalekenium-cfx self-requested a review December 3, 2024 12:19
Copy link
Contributor

@dalekenium-cfx dalekenium-cfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - no major complaints.

@dalekenium-cfx dalekenium-cfx added ready-to-merge This PR is enqueued for merging and removed triage Needs a preliminary assessment to determine the urgency and required action labels Dec 3, 2024
@Ehbw Ehbw force-pushed the feat/train-natives-movement branch from d0d1a79 to 84ea215 Compare December 3, 2024 16:41
@Ehbw Ehbw force-pushed the feat/train-natives-movement branch from 84ea215 to b2cdc64 Compare December 3, 2024 16:41
@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Dec 3, 2024
@Ehbw
Copy link
Contributor Author

Ehbw commented Dec 3, 2024

Changed SET_TRAIN_STATE to use a function that's used else where in the game code for setting train's new state (it resets a timer used for train states). Also fixed the pattern for Train Speed as for some reason only on b2189 it would return a completely different offset that isn't related to the trains current speed.

I've tested these changes again on all games build (1604 - 3258)

@prikolium-cfx prikolium-cfx merged commit d3e9bdf into citizenfx:master Dec 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants