vehicles: enable functional boats phase 1 #27225
Merged
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
SUMMARY: Infrastructure "vehicles: enable functional boats phase 1"
Purpose of change
Fixes #27223
Do a minimal update of the vehicle code to successfully handle boats.
Describe the solution
add a function vehicle::is_in_water() and an underlying variable is_floating to replace ad-hoc calls to !floating.empty (with the long term plan of dynamically determining if a vehicle is in water to allow
amphibious vehicles).
rework the boat movement equations to use the same kind of math as the ground vehicle movement equations. Approximate boat draft and freeboard based on vehicle weight and percentage of structure that have boat boards.
Add two more lines to the stats pane in the vehicle interaction menu and use the extra space to display water speed and acceleration and draft.
Describe alternatives you've considered
Setting all the boat code on fire was tempting, but I will work within the existing framework.
Additional Content
Goals/phases
-[x] - Re-enable existing boats in some kind of sensible fashion
-[x] - Add proper support for amphibious vehicles and get rid of the "board boards are wheels" hack
-[ ] - Fix collisions
-[ ] - Migrate mods/Boats content into mainline and obsolete Boats