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 "Muscle-powered vehicles counting animal weight for traction purposes"
Purpose of change
Fixes #73341
Describe the solution
When calculating traction and rolling resistance, the vehicle code used the entire weight of the vehicle to determine the loading that each wheel had. This did not account for the fact that beasts of burden are supporting their own weight and not contributing to the loading on the wheels of the vehicle they are pulling. This caused the issue seen in the original report - the 250kg wagon's wheels were bearing the weight of 2200 kg of horse, causing extremely low offroad traction and acceleration.
This changes adds a new function
weight_on_wheels
which returns the mass of the vehicle minus the weight of any harnessed creatures. This function is used in the two places where the mass of the vehicle is used to calculate loading effects on the wheels - traction and rolling resistance.Describe alternatives you've considered
Making this a cached value that is calculated whenever
mass_cache
is. I didn't notice any performance issues but I'll admit that I wasn't looking for them.Testing
Spawned two wagons and upgraded one of them to a four-horse configuration. Examined the rolling resistance and offroad rating of each with and without harnessed animals and observed no meaningful difference. Did some racing both on and off road and with a load:
Without a load, both vehicles have an offroad rating of 100%, so they perform the same on dirt and pavement. With the load, this drops to 20%, and the power from the additional horses makes the difference
Additional context