Function veloren_rtsim::ai::finish

source ·
pub fn finish() -> Finish
Expand description

An action that immediately finishes without doing anything.

This action is useless by itself, but becomes useful when combined with actions that make decisions.

§Example

now(|ctx| {
    if ctx.npc.is_tired() {
        sleep().boxed() // If we're tired, sleep
    } else if ctx.npc.is_hungry() {
        eat().boxed() // If we're hungry, eat
    } else {
        finish().boxed() // Otherwise, do nothing
    }
})