Skip to content

Commit

Permalink
fix: post update, check if entity exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Nov 5, 2023
1 parent 416c615 commit 4e8986b
Show file tree
Hide file tree
Showing 3 changed files with 287 additions and 281 deletions.
13 changes: 7 additions & 6 deletions crates/gamai/src/common_actions/post_update_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use bevy_ecs::prelude::*;
pub fn combined_post_update<N: AiNode>(
mut commands: Commands,
mut added_result: Query<
(Entity, Option<&mut Prop<ActionTimer, N>>),
(With<Prop<ActionResult, N>>, With<Prop<Running, N>>),
(Entity, Option<&mut Prop<ActionTimer, N>>),
(With<Prop<ActionResult, N>>, With<Prop<Running, N>>),
>,
// for second time around, remove the [ActionResult]
mut removed_running: RemovedComponents<Prop<Running, N>>,
Expand All @@ -24,11 +24,12 @@ pub fn combined_post_update<N: AiNode>(
timer.last_finish.reset();
}
}


for entity in removed_running.iter() {
// println!("removing result");
commands.entity(entity).remove::<Prop<ActionResult, N>>();
if let Some(mut commands) = commands.get_entity(entity) {
commands.remove::<Prop<ActionResult, N>>();
}
}
}

Expand Down
39 changes: 22 additions & 17 deletions docs/src/gamai/changelog.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# Changelog

## TODO
- interrupts (recursive cleanup)
- single post_update system for a tree
- all cleanups etc in a single system

## main
- private action inners

## `0.1.32` - 17/10/2023
- trees
- props
- actions

## `0.1.31` - 18/09/2023
- initial release
# Changelog

## TODO
- recursive queries
- all timers, cleanups etc in single pre and post systems per tree
- interrupts (recursive cleanup)
- requires apply_deferred before post tree
- expose first & final sets, single parent set?
- investigate closer bevy integration
- new ui format: bsn
- bevy entity relations: aery

## main
- private action inners

## `0.1.32` - 17/10/2023
- trees
- props
- actions

## `0.1.31` - 18/09/2023
- initial release
- agent/choice architecture
Loading

0 comments on commit 4e8986b

Please sign in to comment.