Skip to main content

EnvTrigger

Struct EnvTrigger 

Source
pub struct EnvTrigger {
    pub id: TriggerId,
    pub at: Option<AnchorId>,
    pub prop: Option<Prop>,
    pub on: TriggerOn,
    pub requires_flags: Vec<FlagId>,
    pub forbids_flags: Vec<FlagId>,
    pub requires_state: Vec<StateCompare>,
    pub once: bool,
    pub audience: TriggerAudience,
    pub effects: Vec<QuestEffect>,
}
Expand description

A stage-5 environment trigger (DSL v0.4). Emission uses vanilla-intended primitives only (spec-0008 §7): strike/use read a minecraft:interaction entity’s attack/interaction records; approach is a distance selector on the tick. Look-at / break-attempt detection is excluded on principle (no vanilla primitive).

Fields§

§id: TriggerId

Unique trigger id (trigger/<kebab>).

§at: Option<AnchorId>

The anchor this trigger watches. Required for strike / use / approach, which watch a place; absent for strike-npc (DSL v0.6), which watches a character and names it in on.npc instead — there is no cell for the author to supply and no cell the compiler would use. Either mismatch is DW0194.

§prop: Option<Prop>

The visible object the click acts on (spec-0093 §6.5): for a use or a strike trigger, the block the compiler places at at — a lever, a bell, a lamp, a stone. A use on a block vanilla reports the use of (a lever, a button, a bell) fires through vanilla’s default_block_use criterion and summons no hitbox; any other prop, and every strike, is placed with the minecraft:interaction hitbox fitted over it as its hit area. A click trigger with no prop on open air is refused (DW0963): the hitbox is invisible and is never the object. A prop on an event with no cell of its own — an approach, a strike-npc, a strike-assembly — is DW0964.

§on: TriggerOn

The event that fires it.

§requires_flags: Vec<FlagId>

Flags that must be set before the trigger can fire (DSL v0.4).

§forbids_flags: Vec<FlagId>

Negative flag gate (DSL v0.6): the trigger is suppressed while ANY listed flag is set (by any player — flags are campaign state). The dual of requires_flags, so an “armed between two story beats” trigger needs no re-arm plumbing: e.g. a strike-the-giant retaliation trigger with requires_flags: [flag/sealed] and forbids_flags: [flag/asleep] arms when the cave seals and stands down the moment the wake beat takes over.

§requires_state: Vec<StateCompare>

Numeric gate terms (DSL v0.10, spec-0031): every listed comparison must hold for this gate to be open. The third field of the one gate, carried by every gate consumer — never by the verb that first wanted it. Default empty, so a pre-0.10 campaign is byte-identical.

§once: bool

Fire at most once (default true, mirroring objective completion). Set false to allow re-firing every time the condition is met.

§audience: TriggerAudience

Who the trigger’s effects address (DSL v0.11). Default TriggerAudience::Party, so every campaign written before this field existed is byte-identical.

A trigger is two different things depending on what the author means by it. A pressure plate that opens a gate and narrates the room is a party beat: everyone should see it, and it does not matter who stepped on the plate. A barred door that answers “this cannot be opened from this side” is a reply to one person: broadcasting it tells four players about a door three of them are nowhere near.

Until this field the second was inexpressible, which is why the two verbs that needed it (close-gate’s seal answer, and nothing at all for a shortcut door) grew their own private reply machinery instead. The capability belongs to the press, not to the verb.

§effects: Vec<QuestEffect>

Effects fired when the trigger matches.

Implementations§

Source§

impl EnvTrigger

Source

pub fn gate(&self) -> Gate<'_>

This trigger’s whole gate, as one value (DSL v0.10).

Source§

impl EnvTrigger

Source

pub fn at_anchor(&self) -> Option<&str>

The anchor this trigger watches, if it watches a place at all. None for strike-npc, whose target is a character.

Source

pub fn addresses_presser(&self) -> bool

Whether this trigger’s bundle is addressed to the player who pressed it.

Source

pub fn attributes_its_actor(&self) -> bool

Whether vanilla can name the player whose act fired this trigger, which is what audience: presser needs: a right-click (use, through minecraft:player_interacted_with_entity) and a step (step, a player in the cell). A left-click is recorded as a UUID no command can become; everything else is refused by DW0427.

Trait Implementations§

Source§

impl Clone for EnvTrigger

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnvTrigger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EnvTrigger

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for EnvTrigger

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for EnvTrigger

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for EnvTrigger

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EnvTrigger

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.