Skip to main content

delvewright_dsl/
lib.rs

1//! Delvewright DSL: serde types, validation, canonical serialization and JSON
2//! Schema export for the staged campaign DSL (spec-0001).
3//!
4//! Entry points:
5//! - [`parse_campaign`] / [`check_campaign`]: parse the six raw stage documents.
6//! - [`validate_campaign`]: run all spec-0001 v0.2 rule groups on a parsed
7//!   [`Campaign`], returning [`Diagnostic`]s (spec-0002 `--json` shape).
8//! - [`to_canonical_string`]: the single canonical writer — pretty JSON put
9//!   through [`fmt`], so what the compiler WRITES is what `delvec fmt --check`
10//!   accepts. One canonical form, one implementation.
11//! - [`fmt`]: that canonical form as a grammar-level formatter over any
12//!   authored JSON (stage documents, l10n sidecars, prefab metadata).
13//! - [`stage_schema`]: export a stage's JSON Schema.
14//!
15//! Determinism (ADR-0006): all iteration is over `BTreeMap`/`BTreeSet` or slices;
16//! nothing depends on hash order, wall-clock, or absolute paths.
17
18pub mod blocks;
19pub mod blockshape;
20pub mod canonical;
21pub mod chrome;
22pub mod design;
23pub mod detailplan;
24pub mod diagnostic;
25pub mod effects;
26pub mod envelope;
27/// **What a cell does when there is fluid beside it** — block knowledge, so it
28/// lives beside [`blocks`] and [`blockshape`] rather than beside any one reader
29/// of it. `delvewright_schem::fluid` re-exports it, and the prefab generators
30/// reach it through their dependency on this crate: they may not depend on
31/// `delvec`, and this is the crate every reader of a block fact can reach.
32pub mod fluid;
33pub mod fmt;
34pub mod gate;
35pub mod ids;
36pub mod l10n;
37pub mod layout;
38pub mod mclang;
39pub mod metrics;
40pub mod placement;
41pub mod prefab;
42pub mod registry;
43pub mod schema;
44pub mod siteplan;
45pub mod split;
46pub mod stages;
47pub mod validate;
48
49pub use canonical::to_canonical_string;
50pub use chrome::{Chrome, ChromeString, validate_chrome_namespace};
51pub use design::{
52    CONCEPT_DIR, DesignContent, IMAGE_EXTENSIONS, REFERENCE_DIR, REFERENCE_DIRS, Reference,
53    is_image_extension,
54};
55pub use detailplan::{Detail, DetailPlanContent, FLOOR_COURSE, Frame, bound_places, is_bound};
56pub use diagnostic::{Diagnostic, DwCode, ExitTier, Group, Severity, Subject, codes};
57pub use effects::{
58    EffectRootKind, EffectRootOwner, EffectRootSite, RootBinding, for_each_effect_root,
59    for_each_effect_root_mut,
60};
61pub use envelope::{
62    Campaign, DSL_VERSION, Envelope, RawCampaign, Stage, check_campaign, parse_campaign,
63};
64pub use gate::{Gate, GateBinding, GateConsumer, GateSite, for_each_gate};
65pub use ids::{
66    ActorId, AmbushId, AnchorId, AreaId, BranchId, BranchPointId, CampaignId, ClassId, DatumId,
67    DialogueId, EdgeId, EditBatchId, EndingId, FactId, FlagId, LethalVolumeId, NodeId, NpcId,
68    ObjectiveId, PoolId, PrefabId, QuestId, RegionId, ShortcutId, StateId, TimedGateId, TriggerId,
69    ViewId, VolumeId, WaveId,
70};
71pub use l10n::{
72    ArtNarrate, CANONICAL_LANG, L10nDoc, L10nKind, MARKER_SIGIL, OptionLabel, ScreenNarrate,
73    SoundRef, TR_SIGIL, art_narrates, bonfire_option_labels, declared_mc_codes,
74    dialogue_option_labels, each_string, has_tr_sigil, inventory as l10n_inventory, key_speaker,
75    local_id, localize, on_screen_narrates, plain as l10n_plain, play_sound_actor_refs, sound_refs,
76    tag_translatables, untag as l10n_untag, validate_l10n, validate_l10n_provenance,
77    validate_marker_channel, validate_tr_sigil,
78};
79pub use layout::{
80    Beat, BriefFact, Closure, Direction, Edge, EdgeGating, GeometryBriefContent, Grant, Grants,
81    LayoutBinding, LayoutGraphContent, OpensFrom, Station, StationKind,
82};
83pub use mclang::mc_lang_code;
84pub use placement::{Placement, anchor_vocabulary_unknowable};
85pub use prefab::PrefabMeta;
86pub use registry::{
87    AnchorRegistry, BlockRegistry, EffectRegistry, EntityRegistry, ItemBackedBlockRegistry,
88    ItemRegistry, Lighting, LightingProfile, VendoredAnchorRegistry, VendoredEffectRegistry,
89    VendoredEntityRegistry, VendoredItemRegistry, is_potion_id, is_technical_block,
90};
91pub use schema::stage_schema;
92pub use siteplan::{
93    Axis, Ceiling, Cmp, Datum, ENTRY_ANCHOR, Face, Floor, Identity, Measure, Offset, PackedBox,
94    PlanAxis, PlanBinding, PlanBox, Provenance, SITE_AREA, Seam, Sightline, SitePlanContent, View,
95    Volume, VolumeRole, WorldBox, node_anchor, owed_anchors, placed_boxes, placed_seams,
96    placements, refused_upstream, seam_anchor, seam_unlock_anchor, synthesized_anchor_kinds,
97    synthesized_anchors, synthesized_gate_block,
98};
99pub use siteplan::{PlacedBox, PlacedSeam};
100pub use stages::{
101    Actor, Ambush, Area, AreaLighting, AreaMitigation, BONFIRE_PROMPT_EN, BONFIRE_REST_LABEL_EN,
102    BONFIRE_SAVE_LABEL_EN, BodyTraversal, BonfireLabels, Boundary, BranchDecl, BranchPoint,
103    CameraShot, CameraSubject, CameraTarget, CameraWaypoint, Carrier, CastAbsence, CastBarks,
104    CastDialogue, CastDialogueKeyword, CastEntry, CastPlace, CastPlacement, Class, ClassesContent,
105    CollectBy, CompareOp, DamageKind, DespawnStyle, DialogueContent, DialogueEffect, DialogueNode,
106    DialogueOption, EffectSite, EnchantedItem, EncounterTier, EnvTrigger, EquipItem, EquipSlot,
107    Facing, Fixture, Forfeit, Guard, Happening, HappeningVerb, Horizon, HorizonBase, HorizonSpec,
108    ItemDrop, KitItem, LethalVolume, Lethality, Locomotion, Loot, LootItem, MAX_POTION_AMPLIFIER,
109    MAX_POTION_DURATION_TICKS, MobAttributes, MobDrop, MobEffect, MobEquipment, NarrateStyle, Npc,
110    NpcDialogue, NpcSkin, NpcsContent, Objective, OnFull, Persona, Pieces, PlannedQuest,
111    PotionContents, PotionEffect, Prop, Quest, QuestEffect, QuestPlanContent, QuestsContent,
112    Relationship, Role, SequenceStep, Shop, ShopOffer, Shortcut, ShotStyle, SkinModel, SlotDrop,
113    SoundAt, Stake, StateCompare, StateDecl, StateScope, StateWrite, StealthZone, TimedGate, Trap,
114    TrapDisarm, TrapEffect, TrapReset, TrapTrigger, Trigger, TriggerAudience, TriggerOn, Verb,
115    Wave, WaveLane, WaveMob, WaveSummon, WorldContent, WorldDifficulty, WorldTime, WorldWeather,
116    is_potion_bearing_item,
117};
118pub use stages::{
119    BodyRef, BodySite, BodySkinSite, BodyTraversalSite, body_sites, body_skin_sites,
120    body_traversal_sites, for_each_campaign_effect,
121};
122pub use stages::{
123    EditBatch, EditFrame, FragmentRotation, MorphOp, PaletteBlock, PaletteRecipe, RegionShape,
124    SocketState, TreeKind, WorldEdit, WorldEditsContent,
125};
126pub use stages::{ResolvedHorizon, horizon_base, horizon_defaults, resolved_horizon};
127pub use validate::{validate_campaign, validate_campaign_with};