Function veloren_rtsim::ai::just

source ·
pub fn just<S: State, F, R: Send + Sync + 'static>(f: F) -> Just<F, R>
where F: Fn(&mut NpcCtx<'_>, &mut S) -> R + Send + Sync + 'static,
Expand description

An action that executes some code just once when performed.

If you want to execute this code on every tick, consider combining it with Action::repeat.

§Example

// Make the current NPC say 'Hello, world!' exactly once
just(|ctx| ctx.controller.say("Hello, world!"))