Skip to main content

Crate delvewright_dsl

Crate delvewright_dsl 

Source
Expand description

Delvewright DSL: serde types, validation, canonical serialization and JSON Schema export for the staged campaign DSL (spec-0001).

Entry points:

  • parse_campaign / check_campaign: parse the six raw stage documents.
  • validate_campaign: run all spec-0001 v0.2 rule groups on a parsed Campaign, returning Diagnostics (spec-0002 --json shape).
  • to_canonical_string: the single canonical writer — pretty JSON put through fmt, so what the compiler WRITES is what delvec fmt --check accepts. One canonical form, one implementation.
  • fmt: that canonical form as a grammar-level formatter over any authored JSON (stage documents, l10n sidecars, prefab metadata).
  • stage_schema: export a stage’s JSON Schema.

Each stage type lives in the module of the object it declares (ADR-0031), and the root re-exports every module’s public items through one glob per module. Every stage struct is deny_unknown_fields; reserved enum values a campaign’s dsl_version is too low for parse and are refused by validate.

Determinism (ADR-0006): all iteration is over BTreeMap/BTreeSet or slices; nothing depends on hash order, wall-clock, or absolute paths.

Re-exports§

pub use actor::*;
pub use ambush::*;
pub use assembly::*;
pub use body::*;
pub use canonical::*;
pub use cast::*;
pub use celestial::*;
pub use chrome::*;
pub use class::*;
pub use cutscene::*;
pub use design::*;
pub use detailplan::*;
pub use diagnostic::*;
pub use dialogue::*;
pub use economy::*;
pub use effects::*;
pub use envelope::*;
pub use equipment::*;
pub use fight::*;
pub use firework::*;
pub use gate::*;
pub use healthbar::*;
pub use ids::*;
pub use l10n::*;
pub use layout::*;
pub use lethal::*;
pub use loop::*;
pub use loot::*;
pub use mark::*;
pub use mclang::*;
pub use npc::*;
pub use onkill::*;
pub use placement::*;
pub use prefab::*;
pub use quest::*;
pub use quest_plan::*;
pub use registry::*;
pub use schema::*;
pub use shortcut::*;
pub use siteplan::*;
pub use state::*;
pub use stealth::*;
pub use timed_gate::*;
pub use trap::*;
pub use trigger::*;
pub use validate::*;
pub use wave::*;
pub use world::*;
pub use world_edits::*;

Modules§

actor
Stage 5 — scripted actors (DSL v0.6, spec-0014): bodies the story moves.
ambush
Ambushes: a fight sprung on the party at a place.
assembly
Stage 5 — assemblies (spec-0082): a fixed thing that can be hit and hits back.
blocks
The pinned 1.21.11 block-state registry, and the check every emitter of a structure template owes it.
blockshape
What a block state does to a body that walks into it (spec-0056) — the one authority, for every crate in this workspace.
body
Body traversal — the declaration every body that moves carries (DSL v0.11, spec-0034), and the one enumeration of the campaign’s bodies.
canonical
The single canonical JSON writer.
cast
The cast ledger: where each body is, and what it says, at each point of the story.
celestial
The clock, read from the pinned game (spec-0081): the moon’s eight phases, the sun’s eased path, the sky-light and monster-burn keyframes, and the twelve ticks a body’s position names.
chrome
Compiler chrome: the player-visible strings the compiler writes itself, which no campaign authored and no translator was ever asked for (spec-0029 addendum).
class
Stage 3 — classes: the kits a party chooses from, and the item grants and potion contents a kit or a give-item carries.
color
The one #rrggbb colour literal rule.
cutscene
Cutscenes: the camera shots a cutscene is made of and whether the party is shown.
design
The design record — the machine half of an approved look (spec-0061).
detailplan
The detail plan: a place is detailed inside the box the whole gave it (spec-0050) — pipeline stage 6.
diagnostic
Diagnostics: the --json shape from spec-0002 and the stable DW01xx codes.
dialogue
Stage 6 — dialogue: each NPC’s branching conversation, its options and effects.
economy
Stage 5 — trade and the recovery stake (DSL v0.10, spec-0032).
effects
The one enumeration of the campaign’s effect roots.
envelope
The stage envelope, the assembled Campaign, and parsing from raw JSON.
equipment
What a body shows (spec-0067 §4): the equipment slots each living entity type of pinned Minecraft Java 1.21.11 draws, the kind of piece each slot draws, and the fit rule DW0898 holds every declared piece to.
fight
The two classes a fight takes — a wave (dw_wave_<id>) and an actor (dw_actor_<id>) — and the static facts about them that more than one rule reads.
firework
A firework’s surface, and every game fact it is built on, in one file (spec-0068).
fluid
What a cell does when there is fluid beside it — block knowledge, so it lives beside blocks and blockshape rather than beside any one reader of it. delvewright_schem::fluid re-exports it, and the prefab generators reach it through their dependency on this crate: they may not depend on delvec, and this is the crate every reader of a block fact can reach. What a cell of a piece does when there is fluid beside it.
fmt
delvec fmt — the canonical form for authored Delvewright JSON.
gate
The one gate.
healthbar
A fight shows its health (spec-0073): the health_bar a wave or an actor may declare, and the document-tier rules that judge it.
ids
Type-prefixed, kebab-case identifier newtypes (spec-0001 “IDs”).
l10n
Native i18n: author-declared languages, l10n sidecar documents, the authoritative key inventory, and the localization pass (spec-0001 i18n addendum).
layout
Space is a graph before it is a coordinate (spec-0049 §3, §4.2) — pipeline stages 2 and 3.
lethal
Lethal volumes and the kinds of damage they deal.
license
The one record of a licence this engine has, and the one allowlist it is judged against (ADR-0013).
lightning
A lightning strike’s surface, and every game fact it is built on, in one file (spec-0092).
loop
Loops: an endless corridor (spec-0086).
loot
Loot containers and what they hold.
mark
Marks: a point the campaign places relative to an anchor (spec-0066).
mclang
The pinned client’s own language set (Minecraft Java 1.21.11, ADR-0009).
metrics
The metrics standard (spec-0049 §2) — pipeline stage 0.
npc
Stage 2 — NPCs: who they are, what they look like and where they stand.
onkill
A kill pays (spec-0074): what happens each time a body of a fight is killed.
perception
A perception beat’s surface, and every game fact it is built on, in one file (spec-0085).
placement
Where a campaign’s places and anchor names come from — asked once.
prefab
The prefab metadata document (<id>.json, beside the structure .nbt) — the one definition of its shape.
quest
Stage 5 — quests: each quest’s trigger, objectives and effects, and the stage document that holds every stage-5 collection.
quest_plan
Stage 4 — the quest plan: the planned quests, their dependencies, branch points and happenings, and the spine they form.
registry
Registries for data that lives outside the DSL: the vanilla item registry and prefab anchor metadata.
rig
The rig: the parts and clips of an assembly (spec-0082 §3.1).
schema
JSON Schema export (one full envelope schema per stage) via schemars.
shortcut
Shortcuts: a route that unlocks from one side and stays open.
siteplan
The whole owns the space and hands out boxes (spec-0049 §4) — pipeline stage 4, the geometric embedding of the layout graph.
split
Oversize splitting — the one tiling in this project.
state
Stage 5 — runtime state (DSL v0.10, spec-0031): declared data, how it is displayed, written and compared.
stealth
Stealth zones: the shadow regions a stealth section is judged by.
timed_gate
Timed gates: a door that closes on a clock once opened.
trap
Traps: what fires them, what they do and how they reset or are disarmed.
trigger
Environment triggers and the props a player interacts with.
validate
Campaign validation: all six rule groups from spec-0001.
viewdistance
The view distance a campaign declares, and what it serves (spec-0091).
wave
Waves: the mobs a fight spawns, their lanes, equipment, drops and attributes.
world
Stage 1 — the world: the setting’s time, weather, difficulty, horizon, boundary, areas, pieces, skies and texture overrides (spec-0001).
world_edits
Stage 7 — world edits (the map editor’s edit script, DSL v0.6, spec-0017).

Macros§

dw_code
Declare a DW code — the only way to. Expands to the constant as written and registers it in DECLARED: