nightshade 0.53.0

A cross-platform data-oriented game engine.
Documentation
//! The cutscene composition. The cutscene subsystem itself lives in
//! [`crate::ecs::cutscene`] because it is core; this plugin is what makes
//! playback advance on its own.

use crate::app::{App, Plugin, Stage};
use crate::ecs::world::World;
use crate::schedule::{FramePhase, schedule_push};

/// Registers the cutscene advance into the frame schedule's update phase,
/// a no-op on every frame without an active or just-stopped cutscene.
pub fn install(world: &mut World) {
    schedule_push(
        &mut world.resources.schedules.frame,
        FramePhase::Update,
        crate::ecs::cutscene::advance_cutscene_system,
    );
}

/// Advances cutscenes automatically: composing this makes `play_cutscene`
/// and the reel and queue APIs run without the game calling
/// [`advance_cutscene_system`](crate::ecs::cutscene::advance_cutscene_system)
/// itself. Hosts that scrub or step cutscenes manually, like the editor's
/// preview, skip the plugin and keep the manual call.
pub struct CutscenePlugin;

impl Plugin for CutscenePlugin {
    fn build(&self, app: &mut App) {
        app.add_system(Stage::Startup, install);
    }
}