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