use crate::engine::ecs::component::{ActionComponent, KeyframeComponent};
use crate::engine::ecs::{ComponentId, IntentValue, SignalEmitter, World};
pub(crate) fn register_action(
world: &mut World,
emit: &mut dyn SignalEmitter,
component: ComponentId,
) {
let Some(action) = world.get_component_by_id_as::<ActionComponent>(component) else {
return;
};
let mut cur = component;
while let Some(parent) = world.parent_of(cur) {
if world
.get_component_by_id_as::<KeyframeComponent>(parent)
.is_some()
{
return;
}
cur = parent;
}
if matches!(action.signal, IntentValue::RegisterAction { .. }) {
return;
}
emit.push_intent_now(component, action.signal.clone());
}