Skip to content

Commit

Permalink
Merge pull request #37290 from Fris0uman/charger_no_waste
Browse files Browse the repository at this point in the history
Cable charger CBM don't draw power when you're full
  • Loading branch information
ZhilkinSerg authored Jan 24, 2020
2 parents e792bb8 + 36a0c9b commit 50ab9da
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,15 @@ bool Character::burn_fuel( int b, bool start )
mod_power_level( units::from_kilojoule( fuel_energy ) * windpower * effective_efficiency );
}
} else if( is_cable_powered ) {
const int unconsumed = consume_remote_fuel( 1 );
if( unconsumed == 0 ) {
int to_consume = 1;
if( get_power_level() >= get_max_power_level() ) {
to_consume = 0;
}
const int unconsumed = consume_remote_fuel( to_consume );
if( unconsumed == 0 && to_consume == 1 ) {
mod_power_level( units::from_kilojoule( fuel_energy ) * effective_efficiency );
current_fuel_stock -= 1;
} else {
} else if( to_consume == 1 ) {
current_fuel_stock = 0;
}
set_value( "rem_" + fuel, std::to_string( current_fuel_stock ) );
Expand Down

0 comments on commit 50ab9da

Please sign in to comment.