Make eBooks (Smartphone, Tablet, ...) only turn on their light in darkness #59261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Make eBooks (Smartphone, Tablet, ...) only turn on their light in darkness"
Purpose of change
Fixes #55983
Describe the solution
I added a check for the player avatar's current visibility before the screen / flashlight is turned on (see below).
Also, we should rework the flashlight app for smartphones to work like an actual flashlight and distinguish between it and a lit up screen more concisely. The default action should be just turning the screen on as it is with the laptop and tablet.
Describe alternatives you've considered
We could leave it as it is for now, as this is just a temporary fix regarding smartphones. Reading eBooks should not require the flashlight at all, as the light from the screen should be enough to read (although I suppose reading from a device in darkness is bad for your eyes, so maybe our survivor is just very responsible).
I also considered making the flashlight turn off on its own after reading, but I haven't figured out how to do that yet.
Testing
1.) Spawned in a skill book, smartphone, as well as a tablet + battery
2.) Read the book once to learn of the contents
3.) Stored the book in the devices
4.) Moved to a bright spot, read stored book with each device
--> Tablet screen / smartphone flashlight did not turn on
5.) Move to a dark spot, read stored book with each device
--> Screen and flashlight DID turn on, could still read book with the tablet (see below for smartphone)
Additional context
Change:
For some reason, the smartphone's flashlight is not enough to read, as it does not light up the tile which the survivor is standing on. Wielding it, like you'd do with an actual flashlight, does not work either. However, that also happened during testing before I made the changes, so that must be an unrelated bug. Once that is worked out, this should also work with smartphones.
This is my first PR, pls no bully