Skip to content

Commit

Permalink
Fix vehicle turrets not cooling down (CleverRaven#69551)
Browse files Browse the repository at this point in the history
* allow vehicle-mounted turrets to cool down

* Only send overheat messages to player if they're in position to hear them
  • Loading branch information
actually-a-cat authored Nov 21, 2023
1 parent 8d87411 commit 3cf64dc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5591,6 +5591,20 @@ void vehicle::idle( bool on_map )
if( is_alarm_on ) {
alarm();
}

// Notify player about status of all turrets if they're at controls
bool player_at_controls = !get_parts_at( player_character.pos(), "CONTROLS",
part_status_flag::working ).empty();

for( vehicle_part *turret : turrets() ) {
item_location base = turret_query( *turret ).base();
// Notify player about status of a turret if they're on the same tile
if( player_at_controls || player_character.pos() == base.position() ) {
base->process( here, &player_character, base.position() );
} else {
base->process( here, nullptr, base.position() );
}
}
}

void vehicle::on_move()
Expand Down

0 comments on commit 3cf64dc

Please sign in to comment.