Skip to main content

control

Macro control 

Source
macro_rules! control {
    ($plugin_name:ident : $name:expr; children($children_binding:ident),create: $create:expr,) => { ... };
    (
        $plugin_name:ident :
        $name:expr; children($children_binding:ident),params($params_binding:ident):
        $params_ty:path,create:
        $create:expr,
    ) => { ... };
}
Expand description

Creates a control plugin for nodes that manage multiple children.

Minimal example with bound child nodes:

struct Sequence {
    children: NonEmptyNodes,
}

impl Sequence {
    fn new(children: NonEmptyNodes) -> Self {
        Self { children }
    }
}

impl Node for Sequence {
    fn tick(&mut self) -> TickStatus {
    }
}

control!(
    SequencePlugin: "Sequence";
    children(children),
    create: Sequence::new(children),
);

Parameters are attached the same way as in action!.