Skip to main content

Crate delvewright_dsl

Crate delvewright_dsl 

Source
Expand description

Delvewright DSL: serde types, validation, canonical serialization and JSON Schema export for the staged campaign DSL (spec-0001).

Entry points:

  • parse_campaign / check_campaign: parse the six raw stage documents.
  • validate_campaign: run all spec-0001 v0.2 rule groups on a parsed Campaign, returning Diagnostics (spec-0002 --json shape).
  • to_canonical_string: the single canonical writer — pretty JSON put through fmt, so what the compiler WRITES is what delvec fmt --check accepts. One canonical form, one implementation.
  • fmt: that canonical form as a grammar-level formatter over any authored JSON (stage documents, l10n sidecars, prefab metadata).
  • stage_schema: export a stage’s JSON Schema.

Determinism (ADR-0006): all iteration is over BTreeMap/BTreeSet or slices; nothing depends on hash order, wall-clock, or absolute paths.

Re-exports§

pub use canonical::to_canonical_string;
pub use celestial::Body;
pub use celestial::CelestialTime;
pub use celestial::Clock;
pub use celestial::MoonPhase;
pub use celestial::Position;
pub use chrome::Chrome;
pub use chrome::ChromeString;
pub use chrome::validate_chrome_namespace;
pub use design::CONCEPT_DIR;
pub use design::DesignContent;
pub use design::IMAGE_EXTENSIONS;
pub use design::REFERENCE_DIR;
pub use design::REFERENCE_DIRS;
pub use design::Reference;
pub use design::is_image_extension;
pub use detailplan::Detail;
pub use detailplan::DetailPlanContent;
pub use detailplan::FLOOR_COURSE;
pub use detailplan::Frame;
pub use detailplan::bound_places;
pub use detailplan::is_bound;
pub use diagnostic::Diagnostic;
pub use diagnostic::DwCode;
pub use diagnostic::ExitTier;
pub use diagnostic::Group;
pub use diagnostic::Severity;
pub use diagnostic::Subject;
pub use diagnostic::codes;
pub use effects::EffectRootKind;
pub use effects::EffectRootOwner;
pub use effects::EffectRootSite;
pub use effects::RootBinding;
pub use effects::for_each_effect_root;
pub use effects::for_each_effect_root_mut;
pub use envelope::Campaign;
pub use envelope::DSL_VERSION;
pub use envelope::Envelope;
pub use envelope::RawCampaign;
pub use envelope::Stage;
pub use envelope::check_campaign;
pub use envelope::parse_campaign;
pub use equipment::EquipmentBinding;
pub use equipment::Equippable;
pub use equipment::EquippableFact;
pub use equipment::PieceKind;
pub use fight::Fight;
pub use fight::FightKind;
pub use fight::fights;
pub use fight::quest_area;
pub use fight::unleashed_actors;
pub use fight::wave_area;
pub use firework::FireworkExplosion;
pub use firework::FireworkShape;
pub use gate::Gate;
pub use gate::GateBinding;
pub use gate::GateConsumer;
pub use gate::GateSite;
pub use gate::for_each_gate;
pub use healthbar::HealthBar;
pub use healthbar::HealthBarBinding;
pub use healthbar::health_bar_checks;
pub use ids::ActorId;
pub use ids::AmbushId;
pub use ids::AnchorId;
pub use ids::AreaId;
pub use ids::AssemblyId;
pub use ids::AtmosphereId;
pub use ids::BranchId;
pub use ids::BranchPointId;
pub use ids::CampaignId;
pub use ids::ClassId;
pub use ids::DatumId;
pub use ids::DialogueId;
pub use ids::EdgeId;
pub use ids::EditBatchId;
pub use ids::EndingId;
pub use ids::FactId;
pub use ids::FlagId;
pub use ids::LethalVolumeId;
pub use ids::LoopId;
pub use ids::NodeId;
pub use ids::NpcId;
pub use ids::ObjectiveId;
pub use ids::PoolId;
pub use ids::PrefabId;
pub use ids::QuestId;
pub use ids::RegionId;
pub use ids::RigId;
pub use ids::ShortcutId;
pub use ids::StateId;
pub use ids::TimedGateId;
pub use ids::TriggerId;
pub use ids::ViewId;
pub use ids::VolumeId;
pub use ids::WaveId;
pub use l10n::ArtNarrate;
pub use l10n::CANONICAL_LANG;
pub use l10n::L10nDoc;
pub use l10n::L10nKind;
pub use l10n::MARKER_SIGIL;
pub use l10n::OptionLabel;
pub use l10n::ScreenNarrate;
pub use l10n::SoundRef;
pub use l10n::TR_SIGIL;
pub use l10n::TextKind;
pub use l10n::art_narrates;
pub use l10n::bonfire_option_labels;
pub use l10n::declared_mc_codes;
pub use l10n::dialogue_option_labels;
pub use l10n::each_string;
pub use l10n::has_tr_sigil;
pub use l10n::inventory as l10n_inventory;
pub use l10n::key_kind;
pub use l10n::key_situations;
pub use l10n::key_speaker;
pub use l10n::local_id;
pub use l10n::localize;
pub use l10n::namespace_skin_textures;
pub use l10n::on_screen_narrates;
pub use l10n::pack_key;
pub use l10n::pack_namespace;
pub use l10n::pack_texture_dir;
pub use l10n::pack_texture_id;
pub use l10n::plain as l10n_plain;
pub use l10n::play_sound_actor_refs;
pub use l10n::sound_refs;
pub use l10n::tag_translatables;
pub use l10n::untag as l10n_untag;
pub use l10n::validate_l10n;
pub use l10n::validate_l10n_provenance;
pub use l10n::validate_marker_channel;
pub use l10n::validate_tr_sigil;
pub use layout::Beat;
pub use layout::BriefFact;
pub use layout::Closure;
pub use layout::Direction;
pub use layout::Edge;
pub use layout::EdgeGating;
pub use layout::GeometryBriefContent;
pub use layout::Grant;
pub use layout::Grants;
pub use layout::LayoutBinding;
pub use layout::LayoutGraphContent;
pub use layout::OpensFrom;
pub use layout::Station;
pub use layout::StationKind;
pub use mclang::mc_lang_code;
pub use onkill::on_kill_checks;
pub use placement::Placement;
pub use placement::anchor_vocabulary_unknowable;
pub use prefab::PrefabMeta;
pub use purchase::PurchaseBinding;
pub use purchase::purchase_checks;
pub use registry::AnchorRegistry;
pub use registry::BlockRegistry;
pub use registry::EffectRegistry;
pub use registry::EntityRegistry;
pub use registry::ItemBackedBlockRegistry;
pub use registry::ItemRegistry;
pub use registry::Lighting;
pub use registry::LightingProfile;
pub use registry::VendoredAnchorRegistry;
pub use registry::VendoredEffectRegistry;
pub use registry::VendoredEntityRegistry;
pub use registry::VendoredItemRegistry;
pub use registry::is_potion_id;
pub use registry::is_technical_block;
pub use schema::stage_schema;
pub use siteplan::Axis;
pub use siteplan::Ceiling;
pub use siteplan::Cmp;
pub use siteplan::Datum;
pub use siteplan::ENTRY_ANCHOR;
pub use siteplan::Face;
pub use siteplan::Floor;
pub use siteplan::Identity;
pub use siteplan::Measure;
pub use siteplan::Offset;
pub use siteplan::PackedBox;
pub use siteplan::PlanAxis;
pub use siteplan::PlanBinding;
pub use siteplan::PlanBox;
pub use siteplan::Provenance;
pub use siteplan::SITE_AREA;
pub use siteplan::Seam;
pub use siteplan::Sightline;
pub use siteplan::SitePlanContent;
pub use siteplan::View;
pub use siteplan::Volume;
pub use siteplan::VolumeRole;
pub use siteplan::WorldBox;
pub use siteplan::node_anchor;
pub use siteplan::owed_anchors;
pub use siteplan::placed_boxes;
pub use siteplan::placed_seams;
pub use siteplan::placements;
pub use siteplan::refused_upstream;
pub use siteplan::seam_anchor;
pub use siteplan::seam_unlock_anchor;
pub use siteplan::synthesized_anchor_kinds;
pub use siteplan::synthesized_anchors;
pub use siteplan::synthesized_gate_block;
pub use siteplan::PlacedBox;
pub use siteplan::PlacedSeam;
pub use stages::Actor;
pub use stages::Ambush;
pub use stages::Area;
pub use stages::AreaLighting;
pub use stages::AreaMitigation;
pub use stages::Assembly;
pub use stages::AssemblyHitbox;
pub use stages::AssemblyStrikes;
pub use stages::Atmosphere;
pub use stages::AtmosphereTint;
pub use stages::BONFIRE_PROMPT_EN;
pub use stages::BONFIRE_REST_LABEL_EN;
pub use stages::BONFIRE_SAVE_LABEL_EN;
pub use stages::BodyTraversal;
pub use stages::BonfireLabels;
pub use stages::Boundary;
pub use stages::BranchDecl;
pub use stages::BranchPoint;
pub use stages::CameraShot;
pub use stages::CameraSubject;
pub use stages::Carrier;
pub use stages::CastAbsence;
pub use stages::CastBarks;
pub use stages::CastDialogue;
pub use stages::CastDialogueKeyword;
pub use stages::CastEntry;
pub use stages::CastPlace;
pub use stages::CastPlacement;
pub use stages::Class;
pub use stages::ClassesContent;
pub use stages::Climate;
pub use stages::CollectBy;
pub use stages::CompareOp;
pub use stages::DamageKind;
pub use stages::DespawnStyle;
pub use stages::DialogueContent;
pub use stages::DialogueEffect;
pub use stages::DialogueNode;
pub use stages::DialogueOption;
pub use stages::EffectAudience;
pub use stages::EffectSite;
pub use stages::EnchantedItem;
pub use stages::EncounterTier;
pub use stages::EnvTrigger;
pub use stages::EquipItem;
pub use stages::EquipSlot;
pub use stages::Facing;
pub use stages::Fixture;
pub use stages::Forfeit;
pub use stages::Guard;
pub use stages::Happening;
pub use stages::HappeningSubject;
pub use stages::HappeningVerb;
pub use stages::Horizon;
pub use stages::HorizonBase;
pub use stages::HorizonSpec;
pub use stages::ItemDrop;
pub use stages::KillFires;
pub use stages::KitItem;
pub use stages::LethalVolume;
pub use stages::Lethality;
pub use stages::Locomotion;
pub use stages::Loop;
pub use stages::Loot;
pub use stages::LootItem;
pub use stages::MAX_POTION_AMPLIFIER;
pub use stages::MAX_POTION_DURATION_TICKS;
pub use stages::Mark;
pub use stages::MobAttributes;
pub use stages::MobDrop;
pub use stages::MobEffect;
pub use stages::MobEquipment;
pub use stages::NarrateStyle;
pub use stages::NestedDispatch;
pub use stages::Npc;
pub use stages::NpcDialogue;
pub use stages::NpcSkin;
pub use stages::NpcsContent;
pub use stages::Objective;
pub use stages::OnFull;
pub use stages::OnKill;
pub use stages::ParticleAt;
pub use stages::Persona;
pub use stages::Pieces;
pub use stages::PlannedQuest;
pub use stages::PlayersKeyword;
pub use stages::PotionContents;
pub use stages::PotionEffect;
pub use stages::Precipitation;
pub use stages::Prop;
pub use stages::Quest;
pub use stages::QuestEffect;
pub use stages::QuestPlanContent;
pub use stages::QuestsContent;
pub use stages::Relationship;
pub use stages::RespawnWait;
pub use stages::Role;
pub use stages::SequenceStep;
pub use stages::Shop;
pub use stages::ShopOffer;
pub use stages::Shortcut;
pub use stages::ShotStyle;
pub use stages::SkinModel;
pub use stages::SlotDrop;
pub use stages::SoundAt;
pub use stages::Stake;
pub use stages::StateCompare;
pub use stages::StateDecl;
pub use stages::StateDisplay;
pub use stages::StateScope;
pub use stages::StateWrite;
pub use stages::StealthZone;
pub use stages::StrikeAim;
pub use stages::StrikeStep;
pub use stages::TextureOverride;
pub use stages::TimeKeyword;
pub use stages::TimeSite;
pub use stages::TimedGate;
pub use stages::Trap;
pub use stages::TrapDisarm;
pub use stages::TrapEffect;
pub use stages::TrapReset;
pub use stages::TrapTrigger;
pub use stages::Trigger;
pub use stages::TriggerAudience;
pub use stages::TriggerOn;
pub use stages::Verb;
pub use stages::Wave;
pub use stages::WaveLane;
pub use stages::WaveMob;
pub use stages::WaveSummon;
pub use stages::WorldContent;
pub use stages::WorldDifficulty;
pub use stages::WorldTime;
pub use stages::WorldWeather;
pub use stages::enchantment_component;
pub use stages::is_potion_bearing_item;
pub use stages::offset_cell;
pub use stages::BodyRef;
pub use stages::BodySite;
pub use stages::BodySkinSite;
pub use stages::BodyTraversalSite;
pub use stages::body_sites;
pub use stages::body_skin_sites;
pub use stages::body_skins_mut;
pub use stages::body_traversal_sites;
pub use stages::for_each_campaign_effect;
pub use stages::EditBatch;
pub use stages::EditFrame;
pub use stages::FragmentRotation;
pub use stages::MorphOp;
pub use stages::PaletteBlock;
pub use stages::PaletteRecipe;
pub use stages::RegionShape;
pub use stages::SocketState;
pub use stages::TreeKind;
pub use stages::WorldEdit;
pub use stages::WorldEditsContent;
pub use stages::ResolvedHorizon;
pub use stages::horizon_base;
pub use stages::horizon_defaults;
pub use stages::resolved_horizon;
pub use validate::declares_bonfire;
pub use validate::validate_campaign;
pub use validate::validate_campaign_with;

Modules§

blocks
The pinned 1.21.11 block-state registry, and the check every emitter of a structure template owes it.
blockshape
What a block state does to a body that walks into it (spec-0056) — the one authority, for every crate in this workspace.
canonical
The single canonical JSON writer.
celestial
The clock, read from the pinned game (spec-0081): the moon’s eight phases, the sun’s eased path, the sky-light and monster-burn keyframes, and the twelve ticks a body’s position names.
chrome
Compiler chrome: the player-visible strings the compiler writes itself, which no campaign authored and no translator was ever asked for (spec-0029 addendum).
color
The one #rrggbb colour literal rule.
design
The design record — the machine half of an approved look (spec-0061).
detailplan
The detail plan: a place is detailed inside the box the whole gave it (spec-0050) — pipeline stage 6.
diagnostic
Diagnostics: the --json shape from spec-0002 and the stable DW01xx codes.
effects
The one enumeration of the campaign’s effect roots.
envelope
The stage envelope, the assembled Campaign, and parsing from raw JSON.
equipment
What a body shows (spec-0067 §4): the equipment slots each living entity type of pinned Minecraft Java 1.21.11 draws, the kind of piece each slot draws, and the fit rule DW0898 holds every declared piece to.
fight
The two classes a fight takes — a wave (dw_wave_<id>) and an actor (dw_actor_<id>) — and the static facts about them that more than one rule reads.
firework
A firework’s surface, and every game fact it is built on, in one file (spec-0068).
fluid
What a cell does when there is fluid beside it — block knowledge, so it lives beside blocks and blockshape rather than beside any one reader of it. delvewright_schem::fluid re-exports it, and the prefab generators reach it through their dependency on this crate: they may not depend on delvec, and this is the crate every reader of a block fact can reach. What a cell of a piece does when there is fluid beside it.
fmt
delvec fmt — the canonical form for authored Delvewright JSON.
gate
The one gate.
healthbar
A fight shows its health (spec-0073): the health_bar a wave or an actor may declare, and the document-tier rules that judge it.
ids
Type-prefixed, kebab-case identifier newtypes (spec-0001 “IDs”).
l10n
Native i18n: author-declared languages, l10n sidecar documents, the authoritative key inventory, and the localization pass (spec-0001 i18n addendum).
layout
Space is a graph before it is a coordinate (spec-0049 §3, §4.2) — pipeline stages 2 and 3.
license
The one record of a licence this engine has, and the one allowlist it is judged against (ADR-0013).
mclang
The pinned client’s own language set (Minecraft Java 1.21.11, ADR-0009).
metrics
The metrics standard (spec-0049 §2) — pipeline stage 0.
onkill
A kill pays (spec-0074): what happens each time a body of a fight is killed.
perception
A perception beat’s surface, and every game fact it is built on, in one file (spec-0085).
placement
Where a campaign’s places and anchor names come from — asked once.
prefab
The prefab metadata document (<id>.json, beside the structure .nbt) — the one definition of its shape.
purchase
A purchase that does not add up is refused where it is written (spec-0071 §2, DW0901).
registry
Registries for data that lives outside the DSL: the vanilla item registry and prefab anchor metadata.
rig
The rig: the parts and clips of an assembly (spec-0082 §3.1).
schema
JSON Schema export (one full envelope schema per stage) via schemars.
siteplan
The whole owns the space and hands out boxes (spec-0049 §4) — pipeline stage 4, the geometric embedding of the layout graph.
split
Oversize splitting — the one tiling in this project.
stages
serde types for the six stage content payloads (spec-0001 v0.2).
validate
Campaign validation: all six rule groups from spec-0001.

Macros§

dw_code
Declare a DW code — the only way to. Expands to the constant as written and registers it in DECLARED: