Skip to content

Commit

Permalink
Merge pull request #73966 from Procyonae/Backport72515
Browse files Browse the repository at this point in the history
Backport #72515
  • Loading branch information
Maleclypse authored May 21, 2024
2 parents 37db19f + acc89ff commit a718cf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/grab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ bool game::grabbed_veh_move( const tripoint &dp )

//vehicle movement: strength check. very strong humans can move about 2,000 kg in a wheelbarrow.
int mc = 0;
int str_req = grabbed_vehicle->total_mass() / 100_kilogram; //strength required to move vehicle.
// worst case scenario strength required to move vehicle.
const int max_str_req = grabbed_vehicle->total_mass() / 10_kilogram;
// actual strength required to move vehicle.
int str_req = 0;
// ARM_STR governs dragging heavy things
int str = u.get_arm_str();

//if vehicle is rollable we modify str_req based on a function of movecost per wheel.

const auto &wheel_indices = grabbed_vehicle->wheelcache;
if( grabbed_vehicle->valid_wheel_config() ) {
str_req = max_str_req / 10;
//determine movecost for terrain touching wheels
const tripoint vehpos = grabbed_vehicle->global_pos3();
for( int p : wheel_indices ) {
Expand All @@ -98,8 +102,10 @@ bool game::grabbed_veh_move( const tripoint &dp )
}
//finally, adjust by the off-road coefficient (always 1.0 on a road, as low as 0.1 off road.)
str_req /= grabbed_vehicle->k_traction( get_map().vehicle_wheel_traction( *grabbed_vehicle ) );
// If it would be easier not to use the wheels, don't use the wheels.
str_req = std::min( str_req, max_str_req );
} else {
str_req *= 10;
str_req = max_str_req;
//if vehicle has no wheels str_req make a noise. since it has no wheels assume it has the worst off roading possible (0.1)
if( str_req <= str ) {
sounds::sound( grabbed_vehicle->global_pos3(), str_req * 2, sounds::sound_t::movement,
Expand Down

0 comments on commit a718cf6

Please sign in to comment.