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

Recalculate vehicle viability after part destruction #38487

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

jkraybill
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Recalculate vehicle viability after part destruction"

Purpose of change

Fixes #38473.

Describe the solution

Previously, the vehicle info cache was not being refreshed when parts on your car were destroyed via damage_direct.

This fix calls refresh() when a part is destroyed. It also calls stop() if the vehicle is no longer viable to drive, which fixes a bug that just calling refresh() caused where the vehicle still reported a positive velocity after stopping due to wheels being blown out, and endlessly reporting that it could not move.

Describe alternatives you've considered

Leaving this to someone who is more of an expert in the vehicle code.

Testing

Before and after, dropped multiple bear traps and drove over them in a vehicle. Previously, you could drive forever as long as you never stopped driving, even after losing all wheels. Now, after you lose 2 wheels in a normal car, you immediately come to a screeching halt with the "X doesn't have enough wheels to move" message.

Additional context

I added the stop() call to boats that become too leaky, but I am not sure if currently it's possible to set up a situation where you can be driving a boat and it gets hit by something to make it too leaky to continue. If so, please let me know the repro for this and I will test it as well.

This change definitely makes accidents more dangerous if they blow out tires while you're in a dangerous spot, which I'm all in favor of!

@Qrox
Copy link
Contributor

Qrox commented Mar 1, 2020

after you lose 2 wheels in a normal car, you immediately come to a screeching halt

This is not the most realistic behavior. Cars should gradually lose momentum due to friction instead of suddenly stopping after losing wheels. You should probably fix the message spam some other way instead of doing this.

@kevingranade kevingranade merged commit 5b8625e into CleverRaven:master Mar 2, 2020
@jkraybill jkraybill deleted the 38473b branch March 8, 2020 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken vehicle wheels are perfectly rideable until you stop the engine
3 participants