From 3cf64dcb336121e0e44feccd0fca753af384f01f Mon Sep 17 00:00:00 2001 From: actually-a-cat <102094270+actually-a-cat@users.noreply.github.com> Date: Tue, 21 Nov 2023 19:15:01 +0100 Subject: [PATCH] Fix vehicle turrets not cooling down (#69551) * allow vehicle-mounted turrets to cool down * Only send overheat messages to player if they're in position to hear them --- src/vehicle.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 4d06a24799d1b..fcfacc531856f 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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()