Skip to content

Commit

Permalink
Forbid modification of helicopters
Browse files Browse the repository at this point in the history
  • Loading branch information
anothersimulacrum committed May 12, 2020
1 parent 6892e81 commit 004c524
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/veh_interact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,10 @@ bool veh_interact::can_install_part()
if( is_drive_conflict() ) {
return false;
}
if( sel_vpart_info->has_flag( "NO_INSTALL_PLAYER" ) ) {
if( veh->is_rotorcraft() ) {
print_message_to( w_msg, c_light_red, _( "This vehicle cannot be modified.\n" ) );
return false;
} else if( sel_vpart_info->has_flag( "NO_INSTALL_PLAYER" ) ) {
print_message_to( w_msg, c_light_red, _( "This part cannot be installed.\n" ) );
return false;
}
Expand Down Expand Up @@ -1183,13 +1186,16 @@ bool veh_interact::do_repair( std::string &msg )
if( pt.is_broken() ) {
ok = format_reqs( nmsg, vp.install_requirements(), vp.install_skills, vp.install_time( g->u ) );
} else {
if( !vp.has_flag( "NO_REPAIR" ) && !vp.repair_requirements().is_empty() &&
pt.base.max_damage() > 0 ) {
ok = format_reqs( nmsg, vp.repair_requirements() * pt.base.damage_level( 4 ), vp.repair_skills,
vp.repair_time( g->u ) * pt.base.damage() / pt.base.max_damage() );
} else {
if( vp.has_flag( "NO_REPAIR" ) || vp.repair_requirements().is_empty() ||
pt.base.max_damage() <= 0 ) {
nmsg += colorize( _( "This part cannot be repaired.\n" ), c_light_red );
ok = false;
} else if( veh->is_rotorcraft() ) {
nmsg += colorize( _( "This vehicle cannot be repaired.\n" ), c_light_red );
ok = false;
} else {
ok = format_reqs( nmsg, vp.repair_requirements() * pt.base.damage_level( 4 ), vp.repair_skills,
vp.repair_time( g->u ) * pt.base.damage() / pt.base.max_damage() );
}
}

Expand Down Expand Up @@ -1722,7 +1728,10 @@ bool veh_interact::can_remove_part( int idx, const player &p )
sel_vpart_info = &sel_vehicle_part->info();
std::string msg;

if( sel_vpart_info->has_flag( "NO_UNINSTALL" ) ) {
if( veh->is_rotorcraft() ) {
print_message_to( w_msg, c_light_red, _( "This vehicle cannot be modified.\n" ) );
return false;
} else if( sel_vpart_info->has_flag( "NO_UNINSTALL" ) ) {
print_message_to( w_msg, c_light_red, _( "This part cannot be uninstalled.\n" ) );
return false;
}
Expand Down

0 comments on commit 004c524

Please sign in to comment.