Check future full moon

Discuss modding questions and implementation details.
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Check future full moon

Post by Ralzar »

Ah, yeah that's how werewolfs work in vanilla.

Daggerfall Calendar

"Every 32 days there is a full moon, especially relevant for shape-shifters since they will turn into their were-form and will stay in that form until midnight of the next day. Hence a Lunar Transition is every 8 days, which is interesting if this effect is used when enchanting items.

It must be noted that there are two moons affecting the game, they are time shifted by 4 days. That means four days after a full moon there is a second full moon, since Nirn has two moons (Masser and Secunda).

The first full moons in the game are on the 21st and 25th of Morning Star 3E 405 the next are on the 23rd and 27th of Sun's Dawn 3E 405 and so on."


This... is not what the DFU code does right?

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Check future full moon

Post by pango »

Thanks for the info!

So the code should be something like

Code: Select all

            // Find the lunar phase for current day
            int moonRatio = (DayOfYear + Year * 360 + offset) % 32;
(21 + 405 * 360 + 3) % 32 == 0
(25 + 405 * 360 - 1) % 32 == 0

So this should work as intended
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Check future full moon

Post by pango »

I submitted a PR
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Check future full moon

Post by Ralzar »

Cool.

So, if that PR gets merged, to get the day before I should do

(21 + 405 * 360 + 4) % 32 == 0
(25 + 405 * 360) % 32 == 0

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Check future full moon

Post by pango »

... or compute moonRatio exactly the same way as GetLunarPhase(), and check if it's 31
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Check future full moon

Post by Ralzar »

Just wanted to pop in and say the change works perfectly as far as I can tell and my mods warning about full moon now triggers correctly.

Post Reply