From 843e9eef2763b4de0de8cd516a59cc5458fb3d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= <kzm@zkat.tech> Date: Tue, 27 Apr 2021 19:57:20 -0700 Subject: [PATCH] examples: remove confusing Idle action --- examples/thirst.rs | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/examples/thirst.rs b/examples/thirst.rs index 50b125a..6b5d90b 100644 --- a/examples/thirst.rs +++ b/examples/thirst.rs @@ -99,38 +99,6 @@ fn drink_action_system( } } -#[derive(Debug, Clone)] -struct Idle; - -impl Idle { - fn build() -> IdleBuilder { - IdleBuilder - } -} - -#[derive(Debug, Clone)] -struct IdleBuilder; - -impl ActionBuilder for IdleBuilder { - fn build(&self, cmd: &mut Commands, action: Entity, _actor: Entity) { - cmd.entity(action).insert(Idle); - } -} - -fn idle_system(mut query: Query<&mut ActionState, With<Idle>>) { - for mut state in query.iter_mut() { - match *state { - ActionState::Requested => { - *state = ActionState::Executing; - } - ActionState::Cancelled => { - *state = ActionState::Success; - } - ActionState::Executing => {} - _ => {} - } - } -} // Then, we have something called "Scorers". These are special components that // run in the background, calculating a "Score" value, which is what Big Brain // will use to pick which actions to execute. @@ -188,8 +156,7 @@ pub fn init_entities(mut cmd: Commands) { Thinker::build() .picker(FirstToScore { threshold: 0.8 }) // Note that what we pass in are _builders_, not components! - .when(Thirsty::build(), Drink::build()) - .otherwise(Idle::build()), + .when(Thirsty::build(), Drink::build()), ); } @@ -202,6 +169,5 @@ fn main() { .add_system(thirst_system.system()) .add_system(drink_action_system.system()) .add_system(thirsty_scorer_system.system()) - .add_system(idle_system.system()) .run(); } -- GitLab