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