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 #578: doors state with setElementModel #599

Merged
merged 2 commits into from Mar 23, 2020

Conversation

FileEX
Copy link
Contributor

@FileEX FileEX commented Sep 26, 2018

Fixes #578

Bug description
Changing vehicle model from doorless or "doorful" causes doors to fall off.

To reproduce

  1. Take a tractor.
  2. Set its model to a 4 door vehicle.
  3. Doors fall off.

Now all vehicles without doors (tractor, baggage, etc.) will returns doors state as 0, because haven't doors. Now this vehicles returns doors state as 4 (missing).

@patrikjuvonen
Copy link
Contributor

What is different in behavior when switching from a bike or tractor to a 4 door vehicle, and in reverse and repeated?

@FileEX FileEX closed this Sep 27, 2018
@FileEX FileEX reopened this Sep 27, 2018
@FileEX
Copy link
Contributor Author

FileEX commented Sep 27, 2018

Because the door 0 status also means the default lack of doors, and the state 4 means there is no door when we damage them and fall off. With setElementModel the vehicle status is saved from the previous vehicle. If the previous vehicle had door status as 0 (none) then the door is added. Now some vehicles, eg bikes, boats return the door status as 0, and vehicles from the (cpp switch) return the door status as 4 instead of 0.

@patrikjuvonen
Copy link
Contributor

I was thinking maybe we could also look at implementing it so that if you switch from a doorless vehicle to for example a 4-door vehicle, it would add the missing doors automatically, as it's a bit weird that they are missing.

@FileEX
Copy link
Contributor Author

FileEX commented Sep 27, 2018

My commit just fixes it, after switching from a vehicle without a door to, eg. 4 doors, the doors are automatically added.

@botder botder added the bug Something isn't working label Sep 27, 2018
@qaisjp
Copy link
Contributor

qaisjp commented Feb 11, 2019

How does this commit behave with other MTA versions? (It touches code that is touched in #70.)

@qaisjp qaisjp added the feedback Further information is requested label Feb 11, 2019
@FileEX
Copy link
Contributor Author

FileEX commented Feb 11, 2019

I do not know how this will affect this code, but this switch causes the bug that arises here, removing it does the trick.

@botder botder added this to the Backlog milestone Mar 4, 2019
@qaisjp
Copy link
Contributor

qaisjp commented Mar 23, 2020

How does this commit behave with other MTA versions? (It touches code that is touched in #70.)

Copying @Dutchman101's comment here from #13 (which was reverted and re-PRd in #70):

Seems to cause ProtocolError 60 through a desync, changes the return value of CClientVehicleManager::HasDoors() which is used in the net code (got this from ccw) if Bloodring banger is on map spawn, but cannot reproduce that simply with adding it to map and joining with r7454.
It may corrupt other data, the protocol error was reproducable 100% on r7454 and not prior revision in circumstances it first occured.

And this PR doesn't touch HasDoors, so it's probably fine.

@qaisjp qaisjp modified the milestones: Backlog, 1.6 Mar 23, 2020
@qaisjp qaisjp changed the title Fix doors state with setElementModel Fix #578: doors state with setElementModel Mar 23, 2020
@qaisjp qaisjp merged commit c2dc463 into multitheftauto:master Mar 23, 2020
qaisjp referenced this pull request Apr 6, 2020
Co-authored-by: Qais Patankar <qaisjp@gmail.com>
qaisjp added a commit to qaisjp/mtasa-blue that referenced this pull request Aug 6, 2020
qaisjp added a commit that referenced this pull request Aug 6, 2020
* Revert "Fix typo in c2dc463"

This reverts commit a03f2a9.

* Revert "Fix #578: doors state with setElementModel (#599)"

This reverts commit c2dc463.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing vehicle model from doorless or "doorful" causes doors to fall off
4 participants