Frame Base Event System
Source file: client/engine/systems/systems_functions/FrameBaseEventSystem.cpp
Purpose: Trigger callbacks bound to specific animation frames on an entity.
Components used:
FrameEvents(list of frame events with target animation, trigger frame, callback,triggeredflag)AnimatedSprite(current animation/frame)Transform(iterated alongside, not modified)
Behavior
- For each entity with
FrameEvents, fetches the current animation fromAnimatedSprite. - For each
FrameEvent: if animation and current frame match and the event is not yet triggered, executesaction(entityId)and markstriggered. - Resets
triggeredwhen the animation frame returns to 0, allowing the event to fire again on the next loop.
Main signature
void FrameBaseEventSystem(Eng::registry ®,
Eng::sparse_array<Com::Transform> &transforms,
Eng::sparse_array<Com::AnimatedSprite> &animated_sprites,
Eng::sparse_array<Com::FrameEvents> &frame_events);
Notes
- No
dtdependency: triggering is solely based on animation frame progression. - Events replay every loop because
triggeredis cleared when the frame cycles back to 0.