-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
vehicles: add support for amphibious vehicles #27251
Conversation
ffabaee
to
146c071
Compare
7f2ada7
to
025699e
Compare
I think I found the issue with the failing tests and should have fixed pushed shortly. Stale data was causing some tests to run with water_safe_velocity as the cruise velocity. |
025699e
to
d1fd36d
Compare
Jenkins rebuild |
465cc3a
to
5c57e00
Compare
Can you include amphibious vehicle for testing purposes? |
Sure! Amphibious truck added. |
fcb1445
to
d428949
Compare
don't test mass when doing make_vehicle_efficiency_case. Make the tests a little more robust and catch some possible corner cases.
Give all vehicles a minimum amount of moves in gain_moves(), so that act_on_map() will be called for every vehicle on the map.
stop treating boat boards as wheels and doing weird things with wheel area traction calculations. Instead, check if a vehicle is mostly in the water, and if it is, whether it can float, or if it isn't, whether it has sufficient wheels. Now that these are entirely separate concepts, a vehicle can be amphibious by giving it wheels and enough boat boards. Revise the drag test to consistently give correct results and include water drag numbers.
Merge the mulitple vehicles, vehicle parts, and vehicle base items JSON files from Boats into 4 clearly named files.
Shorten the vehicle prototypes in Boats by using parts notation.
Add plastic, metal, and carbon fiber boat hulls. Add a plastic hulled kayak and a carbon fiber hulled racing kayak. Add an amphibious truck (aka DUKW) using metal hulls and demonstrating an amphibious vehicle.
d428949
to
3634295
Compare
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/amphibious-monsters-and-vehicles-perhaps/22361/2 |
Summary
SUMMARY: Features "vehicles: add support for amphibious vehicles"
Purpose of change
Fixes #20933
Remove the hardcoded limitations that require a vehicle either be a boat or a ground vehicle. Allow people to put wheels on their boats, or boat boards on their cars, and seamlessly transition between land and water travel.
Describe the solution
First, change vehicle::gain_moves() so even stationary vehicles gain moves and have an opportunity to call act_on_map(), which is necessary because vehicles sink in act_on_map(). This solves a corner case where a stationary vehicle wouldn't sink - you could take your boat out to the middle of a lake, remove all the boat boards, and it would still float.
Second, stop pretending boat boards are some kind of weird wheel. Boats float without taking on water when they have freeboard: their draft is less than the distance from the bottom of the hull to the top (aka the hull height). Approximate hull height based on the percent of the vehicle's footprint that is covered by boat boards, calculate draft from the vehicle dimensions and mass, and set a boolean as to whether the vehicle can float or not.
Then instead of having two different calculations for whether a vehicle is in water - one in buoyancy and the other in k_traction - have a single function check_falling_or_floating that also checks as to whether the vehicle is falling or has 2/3rds or more of its tiles in water. Continue to mercilessly destroy vehicles that are in water but can't float.
Generally simplify the logic for dealing with traction, which now deal exclusively with wheels. Vehicles act as boats (with water movement, etc) when they are in water, and sink if they can't float. Vehicles act as land vehicles if they aren't in water, and they don't move if they don't have enough wheels, whether or not they also have boat boards.
Please review and playtest carefully. This isn't as as big as the vehicle speed rework but it's still changing some fundamental vehicle interactions - for the better but still.
Describe alternatives you've considered
The vehicle efficiency test is randomly failing. I can't figure out why. I considered deleting the randomly failing vehicles but that seemed like poor form.Stale data was causing some tests to randomly start with the cruise velocity set to the water safe speed. Fixed by initializing the relevant values and explicitly calling safe_ground_velocity().There needs to be a better solution for dealing with sunken vehicles.
Additional context
Built on top of #27225.
My HMMWV is actually a DUKW. It has boat boards, it has wheels, it drives on the ground, it floats on the water (barely).
Driving on a bridge at 30mph.
Moving across the lake, faster than my engine can handle.
Back on dry land, no problem.
This canoe is just a canoe. It has no wheels.
It doesn't go places on land because it has no wheels.