Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean some exothermic CBM code #38020

Merged
merged 3 commits into from
Feb 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,12 +1096,14 @@ void Character::heat_emission( int b, int fuel_energy )
}
const float efficiency = bio.info().fuel_efficiency;

const int &heat_prod = fuel_energy * ( 1 - efficiency );
const int &heat_level = std::min( heat_prod / 10, 4 );
const int &heat_spread = std::max( heat_prod / 10 - heat_level, 1 );
const int heat_prod = fuel_energy * ( 1.0f - efficiency );
const int heat_level = std::min( heat_prod / 10, 4 );
const emit_id hotness = emit_id( "emit_hot_air" + to_string( heat_level ) + "_cbm" );
g->m.emit_field( pos(), hotness, heat_spread );
for( const auto bp : bio.info().occupied_bodyparts ) {
if( hotness.is_valid() ) {
const int heat_spread = std::max( heat_prod / 10 - heat_level, 1 );
g->m.emit_field( pos(), hotness, heat_spread );
}
for( const std::pair<body_part, size_t> &bp : bio.info().occupied_bodyparts ) {
add_effect( effect_heating_bionic, 2_seconds, bp.first, false, heat_prod );
}
}
Expand Down