From bca12804fff27a2c40372ab887ab74e52fe5dd58 Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 21:19:38 +1000 Subject: [PATCH 01/10] Initial implementation of mod Based on previous attempt: https://github.com/CleverRaven/Cataclysm-DDA/pull/24053 --- data/mods/No_Lift_Requirements/modinfo.json | 15 +++++++++++++++ src/options.cpp | 5 +++++ src/veh_interact.cpp | 19 +++++++++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 data/mods/No_Lift_Requirements/modinfo.json diff --git a/data/mods/No_Lift_Requirements/modinfo.json b/data/mods/No_Lift_Requirements/modinfo.json new file mode 100644 index 000000000000..9e0117ddadf2 --- /dev/null +++ b/data/mods/No_Lift_Requirements/modinfo.json @@ -0,0 +1,15 @@ +[ + { + "type": "MOD_INFO", + "ident": "disable_lifting", + "name": "No Lifting Reqs", + "authors": "Wad67", + "description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.", + "category": "rebalance", + "dependencies": [ "dda" ] + }, + { + "type": "WORLD_OPTION", + "options": [ "DISABLE_LIFTING" ] + } +] \ No newline at end of file diff --git a/src/options.cpp b/src/options.cpp index 2c21b7230ca5..764716fee85b 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2168,6 +2168,11 @@ void options_manager::add_options_world_default() { { "any", translate_marker( "Any" ) }, { "multi_pool", translate_marker( "Multi-pool only" ) }, { "no_freeform", translate_marker( "No freeform" ) } }, "any" ); + + add( "DISABLE_LIFTING", "world_default", translate_marker( "Disables lifting requirements for vehicle parts." ), + translate_marker( "If true, strength checks and/or lifting qualities no longer need to be met in order to change parts." ), + false, COPT_ALWAYS_HIDE + ); } void options_manager::add_options_android() diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index e0c69d1687cc..6004c5108348 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -40,6 +40,7 @@ #include "monster.h" #include "npc.h" #include "optional.h" +#include "options.h" #include "output.h" #include "overmapbuffer.h" #include "pimpl.h" @@ -767,7 +768,14 @@ bool veh_interact::can_install_part() str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); - } else { + } else if( get_option( "DISABLE_LIFTING") ) { + qual = qual_LIFT; + lvl = std::ceil( units::quantity( base.weight() ) / + TOOL_LIFT_FACTOR ); + str = base.lift_strength(); + use_aid = max_lift >= lvl; + use_str = g->u.can_lift( base ); + } else { qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); @@ -1740,7 +1748,14 @@ bool veh_interact::can_remove_part( int idx, const player &p ) str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); - } else { + } else if( get_option( "DISABLE_LIFTING") ) { + qual = qual_LIFT; + lvl = std::ceil( units::quantity( base.weight() ) / + TOOL_LIFT_FACTOR ); + str = base.lift_strength(); + use_aid = true; + use_str = true; + } else { qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); From 06e41a864f6d4aed0b02e6e18fef99ce021f9af3 Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 22:03:27 +1000 Subject: [PATCH 02/10] Astyle modinfo.json --- data/mods/No_Lift_Requirements/modinfo.json | 26 ++++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/data/mods/No_Lift_Requirements/modinfo.json b/data/mods/No_Lift_Requirements/modinfo.json index 9e0117ddadf2..71c3ef0f425c 100644 --- a/data/mods/No_Lift_Requirements/modinfo.json +++ b/data/mods/No_Lift_Requirements/modinfo.json @@ -1,15 +1,13 @@ -[ - { - "type": "MOD_INFO", - "ident": "disable_lifting", - "name": "No Lifting Reqs", - "authors": "Wad67", - "description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.", - "category": "rebalance", - "dependencies": [ "dda" ] - }, - { - "type": "WORLD_OPTION", - "options": [ "DISABLE_LIFTING" ] - } +[ { +"type": "MOD_INFO", +"ident": "disable_lifting", +"name": "No Lifting Reqs", +"authors": "Wad67", +"description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.", +"category": "rebalance", +"dependencies": [ "dda" ] +}, { +"type": "WORLD_OPTION", +"options": [ "DISABLE_LIFTING" ] +} ] \ No newline at end of file From 8d39e134d5ee0e95e75c686734a2bdcb1de09669 Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 22:09:30 +1000 Subject: [PATCH 03/10] do not check aid or strength when installing parts --- src/veh_interact.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 6004c5108348..7b672c67ee77 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -773,8 +773,8 @@ bool veh_interact::can_install_part() lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); str = base.lift_strength(); - use_aid = max_lift >= lvl; - use_str = g->u.can_lift( base ); + use_aid = true; + use_str = true; } else { qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / From 0833a9a41549bdbd254aadebf3565009ffcd9f1a Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 22:10:05 +1000 Subject: [PATCH 04/10] Astyling --- src/options.cpp | 11 ++++++----- src/veh_interact.cpp | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 764716fee85b..fc7658a80995 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2168,11 +2168,12 @@ void options_manager::add_options_world_default() { { "any", translate_marker( "Any" ) }, { "multi_pool", translate_marker( "Multi-pool only" ) }, { "no_freeform", translate_marker( "No freeform" ) } }, "any" ); - - add( "DISABLE_LIFTING", "world_default", translate_marker( "Disables lifting requirements for vehicle parts." ), - translate_marker( "If true, strength checks and/or lifting qualities no longer need to be met in order to change parts." ), - false, COPT_ALWAYS_HIDE - ); + + add( "DISABLE_LIFTING", "world_default", + translate_marker( "Disables lifting requirements for vehicle parts." ), + translate_marker( "If true, strength checks and/or lifting qualities no longer need to be met in order to change parts." ), + false, COPT_ALWAYS_HIDE + ); } void options_manager::add_options_android() diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 7b672c67ee77..06977a95b65f 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -768,14 +768,14 @@ bool veh_interact::can_install_part() str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); - } else if( get_option( "DISABLE_LIFTING") ) { - qual = qual_LIFT; - lvl = std::ceil( units::quantity( base.weight() ) / + } else if( get_option( "DISABLE_LIFTING" ) ) { + qual = qual_LIFT; + lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); - str = base.lift_strength(); - use_aid = true; - use_str = true; - } else { + str = base.lift_strength(); + use_aid = true; + use_str = true; + } else { qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); @@ -1748,14 +1748,14 @@ bool veh_interact::can_remove_part( int idx, const player &p ) str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); - } else if( get_option( "DISABLE_LIFTING") ) { - qual = qual_LIFT; - lvl = std::ceil( units::quantity( base.weight() ) / + } else if( get_option( "DISABLE_LIFTING" ) ) { + qual = qual_LIFT; + lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); - str = base.lift_strength(); - use_aid = true; - use_str = true; - } else { + str = base.lift_strength(); + use_aid = true; + use_str = true; + } else { qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); From 6feac4091e346042f9fa332dc14294054bb8b9b6 Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 22:32:10 +1000 Subject: [PATCH 05/10] Do not display lifting and strength requirements if disabled Happy to remove the string if needed --- src/veh_interact.cpp | 49 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 06977a95b65f..2ab7ed68b98b 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -793,17 +793,22 @@ bool veh_interact::can_install_part() const auto helpers = g->u.get_crafting_helpers(); std::string str_string; - if( !helpers.empty() ) { - str_string = string_format( _( "strength ( assisted ) %d" ), str ); + if( !get_option( "DISABLE_LIFTING" ) ) { + if( !helpers.empty() ) { + str_string = string_format( _( "strength ( assisted ) %d" ), str ); + } else { + str_string = string_format( _( "strength %d" ), str ); + } + + //~ %1$s is quality name, %2$d is quality level + std::string aid_string = string_format( _( "1 tool with %1$s %2$d" ), + qual.obj().name, lvl ); + msg += string_format( _( "> %1$s OR %2$s" ), + colorize( aid_string, aid_color ), + colorize( str_string, str_color ) ) + "\n"; } else { - str_string = string_format( _( "strength %d" ), str ); + msg += string_format( _( "Lifting requirements disabled :)" ) ) + "\n"; } - //~ %1$s is quality name, %2$d is quality level - std::string aid_string = string_format( _( "1 tool with %1$s %2$d" ), - qual.obj().name, lvl ); - msg += string_format( _( "> %1$s OR %2$s" ), - colorize( aid_string, aid_color ), - colorize( str_string, str_color ) ) + "\n"; sel_vpart_info->format_description( msg, c_light_gray, getmaxx( w_msg ) - 4 ); @@ -1768,18 +1773,22 @@ bool veh_interact::can_remove_part( int idx, const player &p ) ok = false; } const auto helpers = g->u.get_crafting_helpers(); - if( !helpers.empty() ) { - msg += string_format( - //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength - _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength ( assisted ) %5$i" ), - status_color( use_aid ), qual.obj().name, lvl, - status_color( use_str ), str ) + "\n"; + if( !get_option( "DISABLE_LIFTING" ) ) { + if( !helpers.empty() ) { + msg += string_format( + //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength + _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength ( assisted ) %5$i" ), + status_color( use_aid ), qual.obj().name, lvl, + status_color( use_str ), str ) + "\n"; + } else { + msg += string_format( + //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength + _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength %5$i" ), + status_color( use_aid ), qual.obj().name, lvl, + status_color( use_str ), str ) + "\n"; + } } else { - msg += string_format( - //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength - _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength %5$i" ), - status_color( use_aid ), qual.obj().name, lvl, - status_color( use_str ), str ) + "\n"; + msg += string_format( _( "Lifting requirements disabled :)" ) ) + "\n"; } std::string reason; if( !veh->can_unmount( idx, reason ) ) { From 706c7d623ff291a7d4074339ba3d75b2992062ca Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 23:01:35 +1000 Subject: [PATCH 06/10] No string for disabled requirements Might require further investigation into the display of 'Additional Requirements' --- src/veh_interact.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 2ab7ed68b98b..e6be85f61c2c 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -807,7 +807,7 @@ bool veh_interact::can_install_part() colorize( aid_string, aid_color ), colorize( str_string, str_color ) ) + "\n"; } else { - msg += string_format( _( "Lifting requirements disabled :)" ) ) + "\n"; + msg += "\n"; } sel_vpart_info->format_description( msg, c_light_gray, getmaxx( w_msg ) - 4 ); @@ -1788,7 +1788,7 @@ bool veh_interact::can_remove_part( int idx, const player &p ) status_color( use_str ), str ) + "\n"; } } else { - msg += string_format( _( "Lifting requirements disabled :)" ) ) + "\n"; + msg += "\n"; } std::string reason; if( !veh->can_unmount( idx, reason ) ) { From 03ecccd0ff0aae479a69b8286d387bb680d6c561 Mon Sep 17 00:00:00 2001 From: Wayde Date: Sat, 29 Aug 2020 23:38:49 +1000 Subject: [PATCH 07/10] Json Styling Windows defender was preventing make style-json from running correctly --- data/mods/No_Lift_Requirements/modinfo.json | 28 +++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/data/mods/No_Lift_Requirements/modinfo.json b/data/mods/No_Lift_Requirements/modinfo.json index 71c3ef0f425c..ebebc963ec95 100644 --- a/data/mods/No_Lift_Requirements/modinfo.json +++ b/data/mods/No_Lift_Requirements/modinfo.json @@ -1,13 +1,15 @@ -[ { -"type": "MOD_INFO", -"ident": "disable_lifting", -"name": "No Lifting Reqs", -"authors": "Wad67", -"description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.", -"category": "rebalance", -"dependencies": [ "dda" ] -}, { -"type": "WORLD_OPTION", -"options": [ "DISABLE_LIFTING" ] -} -] \ No newline at end of file +[ + { + "type": "MOD_INFO", + "ident": "disable_lifting", + "name": "No Lifting Reqs", + "authors": "Wad67", + "description": "Strength checks and lifting qualities are no longer required for installing or removing vehicle parts.", + "category": "rebalance", + "dependencies": [ "dda" ] + }, + { + "type": "WORLD_OPTION", + "options": [ "DISABLE_LIFTING" ] + } +] From 7c23bcaff25ae7562e703bb1ca60e472289a394a Mon Sep 17 00:00:00 2001 From: Wayde Date: Tue, 1 Sep 2020 09:48:48 +1000 Subject: [PATCH 08/10] Only display additional requirements if they exist --- src/veh_interact.cpp | 59 ++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index e6be85f61c2c..32460d4cc4af 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -734,16 +734,16 @@ bool veh_interact::can_install_part() bool ok = format_reqs( msg, reqs, sel_vpart_info->install_skills, sel_vpart_info->install_time( g->u ) ); - msg += _( "Additional requirements:\n" ); + std::string additional_requirements; if( dif_eng > 0 ) { if( g->u.get_skill_level( skill_mechanics ) < dif_eng ) { ok = false; } //~ %1$s represents the internal color name which shouldn't be translated, %2$s is skill name, and %3$i is skill level - msg += string_format( _( "> %1$s%2$s %3$i for extra engines." ), - status_color( g->u.get_skill_level( skill_mechanics ) >= dif_eng ), - skill_mechanics.obj().name(), dif_eng ) + "\n"; + additional_requirements += string_format( _( "> %1$s%2$s %3$i for extra engines." ), + status_color( g->u.get_skill_level( skill_mechanics ) >= dif_eng ), + skill_mechanics.obj().name(), dif_eng ) + "\n"; } if( dif_steering > 0 ) { @@ -751,9 +751,9 @@ bool veh_interact::can_install_part() ok = false; } //~ %1$s represents the internal color name which shouldn't be translated, %2$s is skill name, and %3$i is skill level - msg += string_format( _( "> %1$s%2$s %3$i for extra steering axles." ), - status_color( g->u.get_skill_level( skill_mechanics ) >= dif_steering ), - skill_mechanics.obj().name(), dif_steering ) + "\n"; + additional_requirements += string_format( _( "> %1$s%2$s %3$i for extra steering axles." ), + status_color( g->u.get_skill_level( skill_mechanics ) >= dif_steering ), + skill_mechanics.obj().name(), dif_steering ) + "\n"; } int lvl = 0; @@ -803,11 +803,13 @@ bool veh_interact::can_install_part() //~ %1$s is quality name, %2$d is quality level std::string aid_string = string_format( _( "1 tool with %1$s %2$d" ), qual.obj().name, lvl ); - msg += string_format( _( "> %1$s OR %2$s" ), - colorize( aid_string, aid_color ), - colorize( str_string, str_color ) ) + "\n"; - } else { - msg += "\n"; + additional_requirements += string_format( _( "> %1$s OR %2$s" ), + colorize( aid_string, aid_color ), + colorize( str_string, str_color ) ) + "\n"; + } + if( !additional_requirements.empty() ) { + msg += _( "Additional requirements:\n" ); + msg += additional_requirements; } sel_vpart_info->format_description( msg, c_light_gray, getmaxx( w_msg ) - 4 ); @@ -1738,8 +1740,7 @@ bool veh_interact::can_remove_part( int idx, const player &p ) const auto reqs = sel_vpart_info->removal_requirements(); bool ok = format_reqs( msg, reqs, sel_vpart_info->removal_skills, sel_vpart_info->removal_time( p ) ); - - msg += _( "Additional requirements:\n" ); + std::string additional_requirements; int lvl = 0; int str = 0; @@ -1775,26 +1776,30 @@ bool veh_interact::can_remove_part( int idx, const player &p ) const auto helpers = g->u.get_crafting_helpers(); if( !get_option( "DISABLE_LIFTING" ) ) { if( !helpers.empty() ) { - msg += string_format( - //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength - _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength ( assisted ) %5$i" ), - status_color( use_aid ), qual.obj().name, lvl, - status_color( use_str ), str ) + "\n"; + additional_requirements += string_format( + //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength + _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength ( assisted ) %5$i" ), + status_color( use_aid ), qual.obj().name, lvl, + status_color( use_str ), str ) + "\n"; } else { - msg += string_format( - //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength - _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength %5$i" ), - status_color( use_aid ), qual.obj().name, lvl, - status_color( use_str ), str ) + "\n"; + additional_requirements += string_format( + //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength + _( "> %1$s1 tool with %2$s %3$i OR %4$sstrength %5$i" ), + status_color( use_aid ), qual.obj().name, lvl, + status_color( use_str ), str ) + "\n"; } - } else { - msg += "\n"; } std::string reason; if( !veh->can_unmount( idx, reason ) ) { //~ %1$s represents the internal color name which shouldn't be translated, %2$s is pre-translated reason - msg += string_format( _( "> %1$s%2$s" ), status_color( false ), reason ) + "\n"; + additional_requirements += string_format( _( "> %1$s%2$s" ), status_color( false ), + reason ) + "\n"; ok = false; + + } + if( !additional_requirements.empty() ) { + msg += _( "Additional requirements:\n" ); + msg += additional_requirements; } const nc_color desc_color = sel_vehicle_part->is_broken() ? c_dark_gray : c_light_gray; sel_vehicle_part->info().format_description( msg, desc_color, getmaxx( w_msg ) - 4 ); From ccefecb6da0abef178a7379731f230fdba92c25d Mon Sep 17 00:00:00 2001 From: Wayde Date: Wed, 2 Sep 2020 15:33:00 +1000 Subject: [PATCH 09/10] Show jacking when required, remove irrelevant calculations --- src/veh_interact.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 32460d4cc4af..d1452b28c776 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -735,6 +735,7 @@ bool veh_interact::can_install_part() sel_vpart_info->install_time( g->u ) ); std::string additional_requirements; + bool lifting_or_jacking_required = false; if( dif_eng > 0 ) { if( g->u.get_skill_level( skill_mechanics ) < dif_eng ) { @@ -763,19 +764,17 @@ bool veh_interact::can_install_part() bool use_str = false; item base( sel_vpart_info->item ); if( sel_vpart_info->has_flag( "NEEDS_JACKING" ) ) { + lifting_or_jacking_required = true; qual = qual_JACK; lvl = jack_quality( *veh ); str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); } else if( get_option( "DISABLE_LIFTING" ) ) { - qual = qual_LIFT; - lvl = std::ceil( units::quantity( base.weight() ) / - TOOL_LIFT_FACTOR ); - str = base.lift_strength(); use_aid = true; use_str = true; } else { + lifting_or_jacking_required = true; qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); @@ -793,7 +792,7 @@ bool veh_interact::can_install_part() const auto helpers = g->u.get_crafting_helpers(); std::string str_string; - if( !get_option( "DISABLE_LIFTING" ) ) { + if ( lifting_or_jacking_required ) { if( !helpers.empty() ) { str_string = string_format( _( "strength ( assisted ) %d" ), str ); } else { @@ -1741,6 +1740,7 @@ bool veh_interact::can_remove_part( int idx, const player &p ) bool ok = format_reqs( msg, reqs, sel_vpart_info->removal_skills, sel_vpart_info->removal_time( p ) ); std::string additional_requirements; + bool lifting_or_jacking_required = false; int lvl = 0; int str = 0; @@ -1749,19 +1749,17 @@ bool veh_interact::can_remove_part( int idx, const player &p ) bool use_str = false; item base( sel_vpart_info->item ); if( sel_vpart_info->has_flag( "NEEDS_JACKING" ) ) { + lifting_or_jacking_required = true; qual = qual_JACK; lvl = jack_quality( *veh ); str = veh->lift_strength(); use_aid = ( max_jack >= lvl ) || can_self_jack(); use_str = g->u.can_lift( *veh ); } else if( get_option( "DISABLE_LIFTING" ) ) { - qual = qual_LIFT; - lvl = std::ceil( units::quantity( base.weight() ) / - TOOL_LIFT_FACTOR ); - str = base.lift_strength(); use_aid = true; use_str = true; } else { + lifting_or_jacking_required = true; qual = qual_LIFT; lvl = std::ceil( units::quantity( base.weight() ) / TOOL_LIFT_FACTOR ); @@ -1774,7 +1772,7 @@ bool veh_interact::can_remove_part( int idx, const player &p ) ok = false; } const auto helpers = g->u.get_crafting_helpers(); - if( !get_option( "DISABLE_LIFTING" ) ) { + if( lifting_or_jacking_required ) { if( !helpers.empty() ) { additional_requirements += string_format( //~ %1$s represents the internal color name which shouldn't be translated, %2$s is the tool quality, %3$i is tool level, %4$s is the internal color name which shouldn't be translated and %5$i is the character's strength From f87fc98e158b8eddbab501fe203b994b0e7516cf Mon Sep 17 00:00:00 2001 From: Wayde Date: Wed, 2 Sep 2020 15:34:21 +1000 Subject: [PATCH 10/10] Astyle --- src/veh_interact.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index d1452b28c776..da3baea8922e 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -792,7 +792,7 @@ bool veh_interact::can_install_part() const auto helpers = g->u.get_crafting_helpers(); std::string str_string; - if ( lifting_or_jacking_required ) { + if( lifting_or_jacking_required ) { if( !helpers.empty() ) { str_string = string_format( _( "strength ( assisted ) %d" ), str ); } else {