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

Delete getTrainTrack and setTrainTrack #1713

Merged

Conversation

qaisjp
Copy link
Contributor

@qaisjp qaisjp commented Oct 14, 2020

We don't use this anymore so we should just remove it. We will reimplement this using the new parser when custom train tracks arrives.

@qaisjp qaisjp added the enhancement New feature or request label Oct 14, 2020
@qaisjp qaisjp added this to the 1.6 milestone Oct 14, 2020
@qaisjp qaisjp merged commit 89b5620 into multitheftauto:master Oct 14, 2020
@qaisjp qaisjp deleted the feature/delete-unused-train-track-code branch October 14, 2020 20:27
qaisjp added a commit to qaisjp/mtasa-blue that referenced this pull request Oct 14, 2020
qaisjp added a commit that referenced this pull request Oct 16, 2020
This **fully backwards compatible** pull request contains initial support for the train track element and the ability to change between default train tracks. This is the first in a series of pull requests that intends to pick apart the `feature/custom-train-tracks` branch in #250, so that it can be confidently reviewed and merged without worrying about bugs too much.

You can get default track elements using the below documentation. This documentation is currently only accurate server-side. Client-side it will just return the same number you provide, as clients do not yet have a concept of track elements.

```lua
-- OOP: TrainTrack.getDefaultTrack(trackID)
train-track getDefaultTrack(number trackID)

-- trackID: the ID of the default track, one of `0`, `1`, `2`, `3`.
```

And then set (or get) the track of a train using the following functions:

```lua
-- OOP: v:setTrack(t)
bool setTrainTrack(vehicle v, train-track t)

-- OOP: v:getTrack(v)
train-track getTrainTrack(vehicle v)
```

I have tested sync with one and two players, and track and position _syncing_ seems to work great. The only client changes this PR brings is exposing existing client to the Lua API (a partial revert of 89b5620 / #1713).


The client-side `setTrainTrack` function is not protected, and can run on server trains. This is consistent with the behaviour of `setTrainPosition`, `setTrainDirection` and `setTrainSpeed`.


Finally, since this code is based on the original `feature/custom-train-tracks` branch:

Co-authored-by: Jusonex <jusonex96@gmail.com>
Co-authored-by: Cazomino05 <Cazomino05@gmail.com>
Co-authored-by: "sebasdevelopment@gmx.com" <sebasdevelopment@gmx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants