Skip to content

Commit

Permalink
Gate 3+ engines behind DEBUG_HS (#45914)
Browse files Browse the repository at this point in the history
It's not intended that a survivor can install more than 2 engines in a
vehicle, yet it is still useful to be able to install more than 2
engines for vehicle creation.

Additionally, it was often asked how to get to mechanics 12, an
effectively impossible task, but still show for the install
requirements for 2+ engines.

As such, require debug hammerspace to install more than 2 engines or
display the skills need to install more engines.
The skills don't mean anything after 2 engines, but it's easier to leave
them there, and there is no harm in doing so.
  • Loading branch information
anothersimulacrum authored Dec 9, 2020
1 parent c380afc commit 8fbf09f
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions src/veh_interact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,21 @@ bool veh_interact::update_part_requirements()

nmsg += _( "<color_white>Additional requirements:</color>\n" );

bool allow_more_eng = engines < 2 || player_character.has_trait( trait_DEBUG_HS );

if( dif_eng > 0 ) {
if( player_character.get_skill_level( skill_mechanics ) < dif_eng ) {
if( !allow_more_eng || player_character.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
nmsg += string_format( _( "> %1$s%2$s %3$i</color> for extra engines." ),
status_color( player_character.get_skill_level( skill_mechanics ) >= dif_eng ),
skill_mechanics.obj().name(), dif_eng ) + "\n";
if( allow_more_eng ) {
//~ %1$s represents the internal color name which shouldn't be translated, %2$s is skill name, and %3$i is skill level
nmsg += string_format( _( "> %1$s%2$s %3$i</color> for extra engines." ),
status_color( player_character.get_skill_level( skill_mechanics ) >= dif_eng ),
skill_mechanics.obj().name(), dif_eng ) + "\n";
} else {
nmsg += _( "> <color_red>You cannot install any more engines on this vehicle.</color>" ) +
std::string( "\n" );
}
}

if( dif_steering > 0 ) {
Expand Down Expand Up @@ -2059,8 +2066,22 @@ int veh_interact::part_at( const point &d )
*/
bool veh_interact::can_potentially_install( const vpart_info &vpart )
{
return get_player_character().has_trait( trait_DEBUG_HS ) ||
vpart.install_requirements().can_make_with_inventory( crafting_inv, is_crafting_component );
bool engine_reqs_met = true;
bool can_make = vpart.install_requirements().can_make_with_inventory( crafting_inv,
is_crafting_component );
bool hammerspace = get_player_character().has_trait( trait_DEBUG_HS );

int engines = 0;
if( vpart.has_flag( VPFLAG_ENGINE ) && vpart.has_flag( "E_HIGHER_SKILL" ) ) {
for( const vpart_reference &vp : veh->get_avail_parts( "ENGINE" ) ) {
if( vp.has_feature( "E_HIGHER_SKILL" ) ) {
engines++;
}
}
engine_reqs_met = engines < 2;
}

return hammerspace || ( can_make && engine_reqs_met );
}

/**
Expand Down

0 comments on commit 8fbf09f

Please sign in to comment.