pub enum WorldTime {
Day,
Noon,
Dusk,
Night,
Midnight,
Dawn,
Celestial(CelestialTime),
}Expand description
A declared world time state (DSL v0.5, spec-0010; the celestial spelling
spec-0081). The sole difference from vanilla is that the daylight cycle is
frozen (advance_time false), so a set state persists for the whole delve
until a set-time effect cuts to another.
Two spellings of one clock. A keyword — day, noon, dusk, night,
midnight, dawn — states vanilla’s word with vanilla’s meaning: the hour,
on day 0, so a keyword night shows a full moon. A celestial statement
(CelestialTime, {"moon": "just-risen", "phase": "new-moon"}) names one
body, where it stands and, where the moon shows, its phase, and the engine
computes the tick count, day included. Both resolve to one Clock
(WorldTime::clock); two values are equal when their clocks are.
Vanilla’s /time set primitive takes either one of four keywords or a raw
tick count, and the tick form is the general one. dusk and dawn are the
tick form exposed first-class, per the no-hack rule; a celestial statement is
the same primitive reached from a designer’s sentence. A keyword on day 0
still emits its keyword verbatim (WorldTime::token), so existing
campaigns are byte-identical.
There is no Default (spec-0061 §4). A default hour is a design decision
wearing a mechanism’s clothes, and #[default] Noon is what let a delve whose
whole approved look was night build, light-check and render under a blue noon
sky. Removing the impl is what makes that unwritable rather than merely
discouraged: WorldContent::time is required, and nothing can supply an hour
the author did not.
Variants§
Day
Morning daylight (/time set day, 1000 ticks).
Noon
Midday, brightest (/time set noon, 6000 ticks).
Dusk
Sunset onset (/time set 12000).
Night
Night, sun fully down (/time set night, 13000 ticks).
Midnight
Deep night, darkest (/time set midnight, 18000 ticks).
Dawn
First light, just before sunrise (/time set 23000).
Celestial(CelestialTime)
A sky stated in a designer’s words (spec-0081).
Implementations§
Source§impl WorldTime
impl WorldTime
Sourcepub fn is_keyword(self) -> bool
pub fn is_keyword(self) -> bool
Whether this is one of the six keywords.
Sourcepub fn celestial(self) -> Option<CelestialTime>
pub fn celestial(self) -> Option<CelestialTime>
The celestial statement, if this is one.
Sourcepub fn stated_phase(self) -> Option<MoonPhase>
pub fn stated_phase(self) -> Option<MoonPhase>
The phase this value states, if any.
Sourcepub fn daytime_ticks(self) -> i64
pub fn daytime_ticks(self) -> i64
The daytime tick value this state sets (the time query daytime
read-back). Keywords: day=1000, noon=6000, dusk=12000 (sunset onset),
night=13000, midnight=18000, dawn=23000; a celestial statement its
position’s tick (crate::celestial::position_tick).
Sourcepub fn world_day(self) -> i64
pub fn world_day(self) -> i64
The day this value names as the world’s own time: a keyword is day 0;
a celestial statement the day its phase names, or day 0 where it names
none (the moon is below the horizon, so no phase is stated).
Sourcepub fn clock(self, site: TimeSite, world: WorldTime) -> Clock
pub fn clock(self, site: TimeSite, world: WorldTime) -> Clock
The clock this value sets, at a site whose world declares world
(spec-0081 §3.3).
- A celestial statement is its position’s tick on the day its
phasenames, or the world’s day where it states none — a cut changes the hour, and the moon keeps the phase the world declared. - A keyword is its table row on day 0 where it states a sky — the
world’s own time, a design row, a camera (
TimeSite::Sky) — and on the world’s day where it is aset-timecut (TimeSite::Cut), which changes the hour and keeps the moon.
Sourcepub fn world_clock(self) -> Clock
pub fn world_clock(self) -> Clock
The world’s own clock: WorldTime::clock at the world’s site.
Sourcepub fn token(self, clock: Clock) -> String
pub fn token(self, clock: Clock) -> String
The vanilla /time set argument for clock, the one token every
time set the engine emits goes through: a keyword on day 0 emits its
table argument verbatim (night, 12000), so no keyword campaign’s bytes
move; any other clock emits the integer day × 24000 + daytime.
Sourcepub fn keyword(self) -> String
pub fn keyword(self) -> String
What an author writes — this state’s spelling in a document: the
keyword, or the canonical JSON of a celestial statement
({"moon":"high","phase":"new-moon"}).
Not WorldTime::token, which is the /time set argument and is a raw
tick count for every state vanilla does not name. A diagnostic that asks
an author to declare an hour has to say dusk, not 12000.
Trait Implementations§
impl Copy for WorldTime
Source§impl<'de> Deserialize<'de> for WorldTime
impl<'de> Deserialize<'de> for WorldTime
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<WorldTime, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<WorldTime, D::Error>
impl Eq for WorldTime
Source§impl From<TimeKeyword> for WorldTime
impl From<TimeKeyword> for WorldTime
Source§fn from(k: TimeKeyword) -> WorldTime
fn from(k: TimeKeyword) -> WorldTime
Source§impl JsonSchema for WorldTime
impl JsonSchema for WorldTime
Source§fn json_schema(g: &mut SchemaGenerator) -> Schema
fn json_schema(g: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more