Refine criteria that prohibit vehicle modification when moving #64056
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Refine criteria that prohibit vehicle modification when moving"
Purpose of change
This is the current check for whether a vehicle is moving before allowing modifications (e.g. adding / removing parts)
Cataclysm-DDA/src/veh_interact.cpp
Lines 712 to 714 in 524ad22
It was adapted from the "Dive from moving vehicle?" check, so apparently a small enough non-zero velocity is fine! This should not be the case.
Meanwhile the check for whether the player is controlling the vehicle was intended as a guard against acceleration via cruise control. This isn't sufficient, especially also considering the development of autopilot, autodrive, and eventually looking toward things like NPC driving.
Here are a couple corner cases I can think of that would pass, but shouldn't:
e
xamine as it passes by...Describe the solution
Describe alternatives you've considered
One could argue for allowing some simple things such as clock or seatbelt. That would to need special casing to flag what kind of work is allowed, with checks such as you actually being on board the vehicle and will continue to be able to access the mount point while vehicle continues to move. Seems pretty low utility, and out of scope.
Testing
Absolutely no changes allowed while vehicle is in motion, or aircraft in stationary hover.