Skip to main content

nil_core/behavior/
idle.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::behavior::{Behavior, BehaviorScore};
5use crate::error::Result;
6use crate::world::World;
7use std::ops::ControlFlow;
8
9#[derive(Debug)]
10pub struct IdleBehavior;
11
12impl IdleBehavior {
13  const SCORE: BehaviorScore = BehaviorScore::new(0.1);
14}
15
16impl Behavior for IdleBehavior {
17  fn score(&self, _: &World) -> Result<BehaviorScore> {
18    Ok(Self::SCORE)
19  }
20
21  fn behave(&self, _: &mut World) -> Result<ControlFlow<()>> {
22    Ok(ControlFlow::Break(()))
23  }
24}