Skip to content

Commit

Permalink
Make eBooks (Smartphone, Tablet, ...) only turn on their light in dar…
Browse files Browse the repository at this point in the history
…kness (#59261)

* Check local visibility before turning the flashlight app on.

* Add a comment to describe the if clause a bit better
  • Loading branch information
Nyghtrid3r authored Aug 9, 2022
1 parent 416457f commit e4ce417
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9957,7 +9957,8 @@ cata::optional<int> iuse::ebookread( Character *p, item *it, bool t, const tripo
return cata::nullopt;
}

if( !it->active && it->is_transformable() ) {
// Only turn on the eBook light, if it's too dark to read
if( p->fine_detail_vision_mod() > 4 && !it->active && it->is_transformable() ) {
const use_function *readinglight = it->type->get_use( "transform" );
if( readinglight ) {
readinglight->call( *p, *it, it->active, p->pos() );
Expand Down

0 comments on commit e4ce417

Please sign in to comment.