diff --git a/src/actions.rs b/src/actions.rs index 2dd5f82804fc4870db8b260ce4f958255fa1b303..2e69efe7ed015cbeccc84117136144a47d0a9cd2 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -54,11 +54,11 @@ impl ActionState { pub(crate) struct ActionBuilderId; #[derive(Debug, Clone)] -pub(crate) struct ActionBuilderWrapper(pub ActionBuilderId, pub Arc<dyn ActionBuilder>); +pub(crate) struct ActionBuilderWrapper(pub Arc<ActionBuilderId>, pub Arc<dyn ActionBuilder>); impl ActionBuilderWrapper { pub fn new(builder: Arc<dyn ActionBuilder>) -> Self { - ActionBuilderWrapper(ActionBuilderId, builder) + ActionBuilderWrapper(Arc::new(ActionBuilderId), builder) } } diff --git a/src/thinker.rs b/src/thinker.rs index b60286b4e6de32149821efc701ea67b05edcb7cd..cbdcab558d82534f4990599356d1ee4ca9941678 100644 --- a/src/thinker.rs +++ b/src/thinker.rs @@ -310,7 +310,7 @@ fn exec_picked_action( // oscillation protection so we're not just bouncing back and // forth between the same couple of actions. if let Some((action_ent, ActionBuilderWrapper(current_id, _))) = &mut thinker.current_action { - if *current_id != picked_action.0 { + if !Arc::ptr_eq(current_id, &picked_action.0) { // So we've picked a different action than we were // currently executing. Just like before, we grab the // actual Action component (and we assume it exists).