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, namespace_skin_textures, on_screen_narrates, pack_key, pack_namespace,
76    pack_texture_dir, pack_texture_id, plain as l10n_plain, play_sound_actor_refs, sound_refs,
77    tag_translatables, untag as l10n_untag, validate_l10n, validate_l10n_provenance,
78    validate_marker_channel, validate_tr_sigil,
79};
80pub use layout::{
81    Beat, BriefFact, Closure, Direction, Edge, EdgeGating, GeometryBriefContent, Grant, Grants,
82    LayoutBinding, LayoutGraphContent, OpensFrom, Station, StationKind,
83};
84pub use mclang::mc_lang_code;
85pub use placement::{Placement, anchor_vocabulary_unknowable};
86pub use prefab::PrefabMeta;
87pub use registry::{
88    AnchorRegistry, BlockRegistry, EffectRegistry, EntityRegistry, ItemBackedBlockRegistry,
89    ItemRegistry, Lighting, LightingProfile, VendoredAnchorRegistry, VendoredEffectRegistry,
90    VendoredEntityRegistry, VendoredItemRegistry, is_potion_id, is_technical_block,
91};
92pub use schema::stage_schema;
93pub use siteplan::{
94    Axis, Ceiling, Cmp, Datum, ENTRY_ANCHOR, Face, Floor, Identity, Measure, Offset, PackedBox,
95    PlanAxis, PlanBinding, PlanBox, Provenance, SITE_AREA, Seam, Sightline, SitePlanContent, View,
96    Volume, VolumeRole, WorldBox, node_anchor, owed_anchors, placed_boxes, placed_seams,
97    placements, refused_upstream, seam_anchor, seam_unlock_anchor, synthesized_anchor_kinds,
98    synthesized_anchors, synthesized_gate_block,
99};
100pub use siteplan::{PlacedBox, PlacedSeam};
101pub use stages::{
102    Actor, Ambush, Area, AreaLighting, AreaMitigation, BONFIRE_PROMPT_EN, BONFIRE_REST_LABEL_EN,
103    BONFIRE_SAVE_LABEL_EN, BodyTraversal, BonfireLabels, Boundary, BranchDecl, BranchPoint,
104    CameraShot, CameraSubject, CameraTarget, CameraWaypoint, Carrier, CastAbsence, CastBarks,
105    CastDialogue, CastDialogueKeyword, CastEntry, CastPlace, CastPlacement, Class, ClassesContent,
106    CollectBy, CompareOp, DamageKind, DespawnStyle, DialogueContent, DialogueEffect, DialogueNode,
107    DialogueOption, EffectSite, EnchantedItem, EncounterTier, EnvTrigger, EquipItem, EquipSlot,
108    Facing, Fixture, Forfeit, Guard, Happening, HappeningVerb, Horizon, HorizonBase, HorizonSpec,
109    ItemDrop, KitItem, LethalVolume, Lethality, Locomotion, Loot, LootItem, MAX_POTION_AMPLIFIER,
110    MAX_POTION_DURATION_TICKS, MobAttributes, MobDrop, MobEffect, MobEquipment, NarrateStyle, Npc,
111    NpcDialogue, NpcSkin, NpcsContent, Objective, OnFull, Persona, Pieces, PlannedQuest,
112    PotionContents, PotionEffect, Prop, Quest, QuestEffect, QuestPlanContent, QuestsContent,
113    Relationship, Role, SequenceStep, Shop, ShopOffer, Shortcut, ShotStyle, SkinModel, SlotDrop,
114    SoundAt, Stake, StateCompare, StateDecl, StateScope, StateWrite, StealthZone, TimedGate, Trap,
115    TrapDisarm, TrapEffect, TrapReset, TrapTrigger, Trigger, TriggerAudience, TriggerOn, Verb,
116    Wave, WaveLane, WaveMob, WaveSummon, WorldContent, WorldDifficulty, WorldTime, WorldWeather,
117    is_potion_bearing_item,
118};
119pub use stages::{
120    BodyRef, BodySite, BodySkinSite, BodyTraversalSite, body_sites, body_skin_sites,
121    body_skins_mut, body_traversal_sites, for_each_campaign_effect,
122};
123pub use stages::{
124    EditBatch, EditFrame, FragmentRotation, MorphOp, PaletteBlock, PaletteRecipe, RegionShape,
125    SocketState, TreeKind, WorldEdit, WorldEditsContent,
126};
127pub use stages::{ResolvedHorizon, horizon_base, horizon_defaults, resolved_horizon};
128pub use validate::{validate_campaign, validate_campaign_with};