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

Fix bio_solar producing power in the dark #35755

Merged
merged 6 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,11 @@ bool Character::burn_fuel( int b, bool start )
mod_stored_kcal( -kcal_consumed );
mod_power_level( power_gain );
} else if( is_perpetual_fuel ) {
if( fuel == itype_id( "sunlight" ) ) {
const double modifier = g->natural_light_level( pos().z ) / default_daylight_level();
mod_power_level( units::from_kilojoule( fuel_energy ) * modifier * effective_efficiency );
if( fuel == itype_id( "sunlight" ) && g->is_in_sunlight( pos() ) ) {
const weather_type &wtype = current_weather( pos() );
const float tick_sunlight = incident_sunlight( wtype, calendar::turn );
const double intensity = tick_sunlight / default_daylight_level();
mod_power_level( units::from_kilojoule( fuel_energy ) * intensity * effective_efficiency );
} else if( fuel == itype_id( "wind" ) ) {
int vehwindspeed = 0;
const optional_vpart_position vp = g->m.veh_at( pos() );
Expand Down
5 changes: 4 additions & 1 deletion src/bionics_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ static void draw_bionics_titlebar( const catacurses::window &window, player *p,
bool found_fuel = false;
fuel_string = _( "Available Fuel: " );
for( const bionic &bio : *p->my_bionics ) {
for( const itype_id fuel : p->get_fuel_available( bio.id ) ) {
for( const itype_id &fuel : p->get_fuel_available( bio.id ) ) {
found_fuel = true;
const item temp_fuel( fuel ) ;
if( temp_fuel.has_flag( "PERPETUAL" ) ) {
if( fuel == itype_id( "sunlight" ) && !g->is_in_sunlight( p->pos() ) ) {
continue;
}
fuel_string += colorize( temp_fuel.tname(), c_green ) + " ";
continue;
}
Expand Down