From 8c79924984d5a22da0252553702101094d45498c Mon Sep 17 00:00:00 2001 From: KeremBaba Date: Sat, 28 Sep 2024 19:11:51 +0300 Subject: [PATCH] fix gun shy trait (#76660) * fix primitives * fix other stuff --- src/handle_action.cpp | 2 +- src/ranged.cpp | 5 ++--- src/turret.cpp | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/handle_action.cpp b/src/handle_action.cpp index ca832ac9b43f2..849b5db04c642 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -1697,7 +1697,7 @@ static void fire() add_msg( m_bad, _( "You refuse to use ranged weapons." ) ); return; } - if( you.has_trait( trait_GUNSHY ) && weapon->is_firearm() ) { + if( you.has_trait( trait_GUNSHY ) && weapon && weapon->is_firearm() ) { add_msg( m_bad, _( "You refuse to use firearms." ) ); return; } diff --git a/src/ranged.cpp b/src/ranged.cpp index 18683e9e7325c..49f47629b3866 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -4180,9 +4180,8 @@ bool gunmode_checks_common( avatar &you, const map &m, std::vector result = false; } - if( you.has_trait( trait_GUNSHY ) ) { - messages.push_back( string_format( _( "You're too gun-shy to use this." ), - gmode->tname() ) ); + if( you.has_trait( trait_GUNSHY ) && gmode->is_firearm() ) { + messages.push_back( string_format( _( "You're too gun-shy to use this." ) ) ); result = false; } diff --git a/src/turret.cpp b/src/turret.cpp index c58fd0d004adb..976ab27f1b96c 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -418,9 +418,8 @@ bool vehicle::turrets_aim( std::vector &turrets ) return false; } if( player_character.has_trait( trait_GUNSHY ) ) { - // Check if any turret is a firearm player_character.add_msg_if_player( - _( "Firing a gun isn't any better, even if it's mounted." ) ); + _( "You refuse to use a firearm even when it's mounted." ) ); return false; }