lightyear 0.3.0

Server-client networking library for the Bevy game engine
Documentation
//! Bevy [`SystemSet`] that are shared between the server and client
use bevy::prelude::SystemSet;

/// System sets related to Replication
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum ReplicationSet {
    /// ReplicationSystems that run once per frame
    ReplicationSystems,

    // TODO: is it useful to separate these two system sets?
    /// System Set to gather all the replication updates to send
    /// These systems only run once every send_interval
    SendEntityUpdates,
    SendComponentUpdates,

    // SystemSet that encompasses all replication systems
    All,
}

/// Main SystemSets used by lightyear to receive and send data
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum MainSet {
    /// Systems that receive data (buffer any data received from transport, and read
    /// data from the buffers)
    ///
    /// Runs in `PreUpdate`.
    Receive,
    ReceiveFlush,

    /// Runs once per frame, update sync (client only)
    Sync,
    /// Runs once per frame, clears events (server only)
    ClearEvents,

    /// Systems that send data (buffer any data to be sent, and send any buffered packets)
    ///
    /// Runs in `PostUpdate`.
    SendPackets,
    /// System to encompass all send-related systems
    Send,
}

/// SystemSet that run during the FixedUpdate schedule
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum FixedUpdateSet {
    /// System that runs at the very start of the FixedUpdate schedule to increment the ticks
    TickUpdate,
    /// Main loop (with physics, game logic) during FixedUpdate
    Main,
    MainFlush,
}