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