From 01706a3477b8fe1aecdeacbd0d59e1c3e608d995 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:11:32 -0700 Subject: [PATCH 01/12] Update mutations.json to add gunshy trait --- data/json/mutations/mutations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index 1a35dcef31a03..699cb34eb1a17 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9990,6 +9990,15 @@ "starting_trait": true, "valid": false }, + { + "type": "mutation", + "id": "GUNSHY", + "name": { "str": "Brawler" }, + "points": -3, + "description": "Whether from personal choice or childhood trauma, using a firearm is off-limits to you, even if your life depended on it.", + "starting_trait": true, + "valid": false + }, { "type": "mutation", "id": "FAST_REFLEXES", From 808dd2fa2d2192ad28dd70f3e3ae60551cd1e772 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:16:07 -0700 Subject: [PATCH 02/12] Update turret.cpp for gunshy --- src/turret.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/turret.cpp b/src/turret.cpp index 3b70b7e93e270..6f501f116976f 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -33,6 +33,8 @@ static const skill_id skill_gun( "gun" ); static const trait_id trait_BRAWLER( "BRAWLER" ); +static const trait_id trait_GUNSHY( "GUNSHY" ); + std::vector vehicle::turrets() { std::vector res; @@ -415,6 +417,12 @@ bool vehicle::turrets_aim( std::vector &turrets ) _( "Pfft. You are a brawler; using turrets is beneath you." ) ); return false; } + + if( player_character.has_trait( trait_GUNSHY ) ) { + player_character.add_msg_if_player( + _( "Firing a gun isn't any better, even if it's mounted" ) ); + return false; + } // Get target target_handler::trajectory trajectory = target_handler::mode_turrets( player_character, *this, From 41cece7382ec7553c72eb3f5152671a9e0a66968 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:20:15 -0700 Subject: [PATCH 03/12] Update ranged.cpp for gunshy --- src/ranged.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ranged.cpp b/src/ranged.cpp index 28a5152f6c24a..071ebf11716b5 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -171,6 +171,7 @@ static const skill_id skill_swimming( "swimming" ); static const skill_id skill_throw( "throw" ); static const trait_id trait_BRAWLER( "BRAWLER" ); +static const trait_id trait_GUNSHY( "GUNSHY" ); static const trait_id trait_PYROMANIA( "PYROMANIA" ); static const trap_str_id tr_practice_target( "tr_practice_target" ); @@ -4178,6 +4179,12 @@ 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() ) ); + result = false; + } + // Check that passed gun mode is valid and we are able to use it if( !( gmode && you.can_use( *gmode ) ) ) { messages.push_back( string_format( _( "You can't currently fire your %s." ), From ab5fded4c47681fd1c729a64a1b405c436f1374b Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:24:05 -0700 Subject: [PATCH 04/12] Update handle_action.cpp for gunshy --- src/handle_action.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 864958fab82d8..995b3ea35b8ad 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -150,6 +150,7 @@ static const quality_id qual_CUT( "CUT" ); static const skill_id skill_melee( "melee" ); static const trait_id trait_BRAWLER( "BRAWLER" ); +static const trait_id trait_GUNSHY( "GUNSHY" ); static const trait_id trait_HIBERNATE( "HIBERNATE" ); static const trait_id trait_PROF_CHURL( "PROF_CHURL" ); static const trait_id trait_SHELL2( "SHELL2" ); @@ -1696,6 +1697,10 @@ static void fire() add_msg( m_bad, _( "You refuse to use ranged weapons." ) ); return; } + if( you.has_trait( trait_GUNSHY ) && weapon->is_firearm() ) { + add_msg( m_bad, _( "You refuse to use firearms." ) ); + return; + } // try firing gun if( weapon && weapon->is_gun() && !weapon->gun_current_mode().melee() ) { avatar_action::fire_wielded_weapon( you ); From a78d53d01a3d0aff0cd38ea5e2bc77f1b67e2871 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:37:35 -0700 Subject: [PATCH 05/12] Update mutations.json adding gunshy --- data/json/mutations/mutations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index 699cb34eb1a17..c81360fc4e893 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9993,7 +9993,7 @@ { "type": "mutation", "id": "GUNSHY", - "name": { "str": "Brawler" }, + "name": { "str": "Gun-shy" }, "points": -3, "description": "Whether from personal choice or childhood trauma, using a firearm is off-limits to you, even if your life depended on it.", "starting_trait": true, From 7b72a9104edd2ceb183dc16f38c3cf1a66968119 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:43:17 -0700 Subject: [PATCH 06/12] Update turret.cpp astyle fix --- src/turret.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/turret.cpp b/src/turret.cpp index 6f501f116976f..30e21ba133b33 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -417,10 +417,9 @@ bool vehicle::turrets_aim( std::vector &turrets ) _( "Pfft. You are a brawler; using turrets is beneath you." ) ); return false; } - if( player_character.has_trait( trait_GUNSHY ) ) { player_character.add_msg_if_player( - _( "Firing a gun isn't any better, even if it's mounted" ) ); + _( "Firing a gun isn't any better, even if it's mounted." ) ); return false; } From 594d7055557df23ae01ae394ede3e4a5043f9582 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:54:09 -0700 Subject: [PATCH 07/12] Update data/json/mutations/mutations.json Co-authored-by: TheShadowFerret <99621099+TheShadowFerret@users.noreply.github.com> --- data/json/mutations/mutations.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index c81360fc4e893..def04da5c12eb 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9988,7 +9988,8 @@ "points": -4, "description": "Whether from personal choice or childhood trauma, using ranged weapons is off-limits to you, even if your life depended on it.", "starting_trait": true, - "valid": false + "valid": false, + "cancels": [ "GUNSHY" ] }, { "type": "mutation", From d565753cd2cbc51a9852c3def78d0626425401c2 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:06:21 -0700 Subject: [PATCH 08/12] Update mutations.json for description and mutual exclusivity --- data/json/mutations/mutations.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index def04da5c12eb..67cd2041da72d 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9994,11 +9994,12 @@ { "type": "mutation", "id": "GUNSHY", - "name": { "str": "Gun-shy" }, + "name": { "str": "Gun-Shy" }, "points": -3, - "description": "Whether from personal choice or childhood trauma, using a firearm is off-limits to you, even if your life depended on it.", + "description": "Using a firearm is off limits, due to personal philosophy or a traumatic event. You can still use bows and slings.", "starting_trait": true, "valid": false + "cancels": [ "BRAWLER" ] }, { "type": "mutation", From 328a43092918212405b9e73a54c75a177e6cb4ed Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:00:09 -0700 Subject: [PATCH 09/12] Update data/json/mutations/mutations.json Co-authored-by: Uwuewsky <99945024+Uwuewsky@users.noreply.github.com> --- data/json/mutations/mutations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index 67cd2041da72d..b4502a1d1e2ac 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9996,7 +9996,7 @@ "id": "GUNSHY", "name": { "str": "Gun-Shy" }, "points": -3, - "description": "Using a firearm is off limits, due to personal philosophy or a traumatic event. You can still use bows and slings.", + "description": "Using a firearm is off limits, due to personal philosophy or a traumatic event. You can still use bows and slings.", "starting_trait": true, "valid": false "cancels": [ "BRAWLER" ] From 97bcab9bd9623607ff3564e1fb443bbc41ecbf95 Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:36:20 -0700 Subject: [PATCH 10/12] Update mutations.json fixes style --- data/json/mutations/mutations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index b4502a1d1e2ac..177e9caff13bf 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -9998,7 +9998,7 @@ "points": -3, "description": "Using a firearm is off limits, due to personal philosophy or a traumatic event. You can still use bows and slings.", "starting_trait": true, - "valid": false + "valid": false, "cancels": [ "BRAWLER" ] }, { From eada1397f83a659497be6bd3800c89820620dcef Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:04:03 -0700 Subject: [PATCH 11/12] Update turret.cpp checks if any turrets are firearms --- src/turret.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/turret.cpp b/src/turret.cpp index 30e21ba133b33..05bddad7df795 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -418,9 +418,14 @@ bool vehicle::turrets_aim( std::vector &turrets ) return false; } if( player_character.has_trait( trait_GUNSHY ) ) { - player_character.add_msg_if_player( - _( "Firing a gun isn't any better, even if it's mounted." ) ); - return false; + // Check if any turret is a firearm + for( vehicle_part *t : turrets ) { + if( *t->base.is_firearm() ) { + player_character.add_msg_if_player( + _( "Firing a gun isn't any better, even if it's mounted." ) ); + return false; + } + } } // Get target From ef449cbce48ba6b1c6d02b733cd670494518c5bb Mon Sep 17 00:00:00 2001 From: Consoleable <107653330+Consoleable@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:12:57 -0700 Subject: [PATCH 12/12] Update turret.cpp rollback turret checks --- src/turret.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/turret.cpp b/src/turret.cpp index 05bddad7df795..2c9c4297ff00c 100644 --- a/src/turret.cpp +++ b/src/turret.cpp @@ -419,13 +419,9 @@ bool vehicle::turrets_aim( std::vector &turrets ) } if( player_character.has_trait( trait_GUNSHY ) ) { // Check if any turret is a firearm - for( vehicle_part *t : turrets ) { - if( *t->base.is_firearm() ) { - player_character.add_msg_if_player( - _( "Firing a gun isn't any better, even if it's mounted." ) ); - return false; - } - } + player_character.add_msg_if_player( + _( "Firing a gun isn't any better, even if it's mounted." ) ); + return false; } // Get target