-
Notifications
You must be signed in to change notification settings - Fork 2k
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/rdr3): Add natives for train tracks #2575
base: master
Are you sure you want to change the base?
Conversation
Hi. Thanks for your contribution. Can you please provide traintracks.xml for testing and describe expected behavior, so we can test it too? |
Hi! Thank you for the response. This resource, which I linked in the main PR message, can be used to test the changes. Testing Steps
Please let me know if I can provide additional information. Thank you! |
I have updated my testing steps to include steps for testing having 0 train tracks in |
Hey, just checking in. Is there anything I can do to help the review process along? |
Goal of this PR
This PR provides three new natives for RedM for working with train tracks:
traintracks.xml
file. This allows for fully customized rail networks.It also provides patches for three crashes that can occur when using LOAD_TRACKS_FROM_FILE:
This resource can be used to test the track natives. See
client.lua
for the list of commands.How is this PR achieving the goal
The extra natives can be found in
extra-natives-rdr3/src/TrackNatives.cpp
. The patches can be found ingta-core-rdr3/src/PatchTrainTrackCrashes.cpp
.GET_TRACK_COUNT
andGET_TRACK_FROM_INDEX
are just directly accessing the track data.LOAD_TRACKS_FROM_FILE
is based on FiveM's LOAD_WATER_FROM_PATH.The patches for junction crashes and preventing trains from spawning when there are 0 tracks loaded are simple trampolines.
The patch for not loading more tracks than the game has space for is an ASM patch inserted at the original exit condition check for the XML loading loop.
This PR applies to the following area(s)
RedM, Natives
Successfully tested on
Game builds: 1491.50
Platforms: Windows
Checklist
Fixes issues
Resolves #2424.