-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(gamestate/server): CREATE_TRAIN(_CARRIAGE) natives #2322
Conversation
0442dc6
to
cbe1fd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validations do not take into account potential content additions by the server.
code/components/citizen-server-impl/src/state/ServerSetters.cpp
Outdated
Show resolved
Hide resolved
code/components/citizen-server-impl/src/state/ServerSetters.cpp
Outdated
Show resolved
Hide resolved
imo, it would be nice to get the feature out, and then add support for custom tracks later, a working but limited feature is better than no feature |
cbe1fd8
to
8872682
Compare
any update on this??? |
Any update on this??? |
1 similar comment
Any update on this??? |
ede5561
to
2102287
Compare
2102287
to
f6d3a4c
Compare
Is this essentially something we can use, if merged ofc, in order to rewrite a script such as https://github.com/LexTheGreat/TrainSportation in order to stop so much desync between our client sided trains etc? |
please merge this, we want trains |
one can only hope heh |
Any update on this??? |
1 similar comment
Any update on this??? |
MERGE IT, MERGE IT WE WANT TRAINS ON SERVER SIDE GOOOO |
Closing this for now. It needs some improvements (especially around handling custom train and track configs). Generally trains could do with a few more fixes (taken the only client side train fix in this pr and made a new PR for that #2911) |
Goal of this PR
Allows for server-side creation of functioning trains, to be used in strict and relaxed entity lockdown modes.
How is this PR achieving the goal
By adding the
CREATE_TRAIN
andCREATE_TRAIN_CARRIAGE
to allow for the creation of trains and its carriages through server-setters. The followingLOAD_TRAIN_CONFIG_FROM_PATH
andLOAD_TRAIN_TRACKS_FROM_PATH
are also added to address the issue of the server lacking knowledge of train configurations and train index's. Currently the information is only used to prevent invalid track ID's and train config indexes which cause unintended client behaviour.Modifications were required for the client, to have server-setter trains behave as intended when re-entering a the scope of a client or changing ownership. By updating the trains current track node to its relative position and then force blending on ownership change (if the server was the last owner). This has no effect on client created trains or trains actively owned by other players.
While creating this PR I also completed the
CTrainGameStateDataNode
based on the research provided by gottfriedleibniz, and some of my own.Examples of Invalid and Valid uses of these natives can be found here: https://gist.github.com/Ehbw/c40e88f0686275f4a6fe417573babb64
A functioning script snippet can be found here: https://gist.github.com/Ehbw/ef9d2302c4833bab5b23160588ff3a6f
This PR applies to the following area(s)
FiveM, Server, Natives
Successfully tested on
Builds prior to the tuners update (2372) results in all trains being deleted by the owning client when leaving the owner's scope. This behaviour is identical to client created trains on these same builds. This would be resolved with blocking deletion of any server-owned entity as suggested here #962
Game builds: 1604-3095
Platforms: Windows
Checklist
Fixes issues
resolves #2197