Skip to content

Commit

Permalink
passing time for immobile vehicles (#63206)
Browse files Browse the repository at this point in the history
  • Loading branch information
cake-pie authored Jan 30, 2023
1 parent a14b798 commit 200e84d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,11 +924,21 @@ static void wait()
bool setting_alarm = false;
map &here = get_map();

if( player_character.controlling_vehicle &&
( here.veh_at( player_character.pos() )->vehicle().velocity ||
here.veh_at( player_character.pos() )->vehicle().cruise_velocity ) ) {
popup( _( "You can't pass time while controlling a moving vehicle." ) );
return;
if( player_character.controlling_vehicle ) {
const vehicle &veh = here.veh_at( player_character.pos() )->vehicle();
if( !veh.can_use_rails() && ( // control optional if on rails
veh.is_flying_in_air() || // control required: fuel is consumed even at hover
veh.is_falling || // *not* vertical_velocity, which is only used for collisions
veh.velocity || // is moving
( veh.cruise_velocity && ( // would move if it could
( veh.is_watercraft() && veh.can_float() ) || // is viable watercraft floating on water
veh.sufficient_wheel_config() // is viable land vehicle on ground or fording shallow water
) ) ||
( veh.is_in_water( true ) && !veh.can_float() ) // is sinking in deep water
) ) {
popup( _( "You can't pass time while controlling a moving vehicle." ) );
return;
}
}

if( player_character.has_alarm_clock() ) {
Expand Down

0 comments on commit 200e84d

Please sign in to comment.