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