[ui] Sunrise: The garden names the real sunrise from sunset until it comes
This commit is contained in:
@@ -159,6 +159,17 @@ export function nextInvitation(now: number, place: Place): { readonly sun: SunDa
|
||||
throw new Error(`nextInvitation: no invitation within two days of ${today}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* The next thing to look up for (sunrise.md R1): the sunrise of the next invitation's
|
||||
* day while it is still ahead, otherwise the invitation itself. Built on
|
||||
* `nextInvitation`, so Reykjavík's after-midnight sunset stays tonight's (D2).
|
||||
*/
|
||||
export function nextSunEvent(now: number, place: Place): { readonly sun: SunDay; readonly at: number; readonly kind: 'sunrise' | 'invitation' } {
|
||||
const next = nextInvitation(now, place);
|
||||
if (next.sun.kind === 'sun-sets' && next.sun.sunrise >= now) return { sun: next.sun, at: next.sun.sunrise, kind: 'sunrise' };
|
||||
return { ...next, kind: 'invitation' };
|
||||
}
|
||||
|
||||
/**
|
||||
* When the game invites the player outside: the sunset; in polar day the lowest
|
||||
* light; in polar night noon, when the twilight is brightest (D4; decided by the
|
||||
|
||||
Reference in New Issue
Block a user