unsoluble / smalltime

A small FoundryVTT module for displaying and controlling the current time of day.
MIT License
23 stars 15 forks source link

[Suggestion] Variable Max Darkness Based on Moon Phases pulled from SimpleCal 2.0 #130

Closed Shuggaloaf closed 2 years ago

Shuggaloaf commented 2 years ago

Allow the user to opt having a varying Darkness Level based on how "bright" their moons(s) are. I am thinking it could be based off (1) your already existing user defined max (we'll call it UDM) darkness level and (2) a new setting added to the settings config called Full Moon Value (FMV).

Example

I may be (probably am) over-complicating things, but to get things rolling...

Let's assume that we set UDM darkness level at 95%. I never want it darker than 95%.

For nights with a full moon, I want it to be less dark to simulate the brighter night of a full moon. I decide that I want my nights to be 15% brighter with a full moon, so I set the FMV at 15%.

For other nights when the moon(s) are less full, the light level could auto-adjust somewhere between the UDM and (UDM - FMV), in other words, between 80% and 95%. Full darkness (in this case 95%) would represent a new moon(s).

So basically, using a 1 moon example and some rough math, taking the difference between UDM and the FMV got us a 15% swing from 80% to 95%. So using that "15" percentage value, the max darkness would vary as follows...

Full Moon = UDM - FMV = 95% - 15% = 80% darkness
Gibbous = UDM - (FMV x 0.75) = 84% darkness
Quarter = UDM - (FMV x 0.50) = 87% darkness
Crescent = UDM - (FMV x 0.25) = 91% darkness
New Moon = 95% darkness

Multiple moons could be handled in multiple ways depending on how complex you wanted to get with it.

Hopefully that makes sense but let me know if you have questions. I'm not sure how feasible it is but it would be pretty amazing! That said, I'm hoping it's a matter of pulling the data, adding a little code and some calculations and you're good. I'll be the first to admit that if it looks like this would be a lot of work to implement then it is probably not practical enough to be worth it.

unsoluble commented 2 years ago

Thanks for writing up all your thoughts clearly! This is closely related to #129, which I've already started poking at but have had to put it on hold due to a bug in Simple Calendar that's causing moon phase changes to happen silently. Will investigate when I can.

Shuggaloaf commented 2 years ago

bug in Simple Calendar that's causing moon phase changes to happen silently.

Completely understood. Can't work with something where the part you need isn't working!

Regarding the other request, I see they are suggesting to do this with token vision limitation. I could see a case being made for either (or both really). I was thinking more globally, or at least any scene where ST controls the scene darkness, whereas they were thinking of a separate per-scene control. I could get behind the per-scene controls if the varying scene darkness were also able to be included.

I actually had started to highlight several situations where I think scene darkness wins out over token vision range but honestly the 2 work so well together in many other cases that I think trying to implement both would really be the best way to go.

unsoluble commented 2 years ago

Both kinda need to be scene-specific, as one will often have a mix of scenes that are outdoors/indoors.

Shuggaloaf commented 2 years ago

Yeah, sorry, unclear wording. Where I said

I was thinking more globally, or at least any scene where ST controls the scene darkness

I was meaning it would work when the ST controls scene-darkness toggle was checked in scene configuration. Basically it would piggy-back on that.

I won't complain if it's separate though. ;)

unsoluble commented 2 years ago

Implemented in 1.14.1 — with just a constant scaling factor for now.

Shuggaloaf commented 2 years ago

Wow unsoluble I wasn't expecting implementation that fast! I see from the release notes you implemented both methods as well. Looking forward to using this feature.

Much appreciated!

unsoluble commented 2 years ago

Not gonna be super surprised if you find some edge cases where things get weird — I kinda just got 'er done and pushed it out. But it should mostly work. :)

Shuggaloaf commented 2 years ago

kinda just got 'er done and pushed it out. But it should mostly work.

Ah, the Microsoft approach. ;) No worries, if I catch anything odd I'll report back. Thanks again.