Skip to main content

spru_bevy/local/
plugin.rs

1use std::marker::PhantomData;
2
3use bevy::prelude;
4use derive_where::derive_where;
5
6#[derive_where(Debug, Default)]
7pub struct Plugin<Server: crate::server::ServerSSS, Client: crate::client::ClientSSS> {
8    _server: PhantomData<fn() -> Server>,
9    _client: PhantomData<fn() -> Client>,
10}
11
12impl<Server, Client> prelude::Plugin for Plugin<Server, Client>
13where
14    Server: crate::server::ServerSSS,
15    Client: crate::client::ClientSSS<
16            State = Server::State,
17            Action = Server::Action,
18            Root = Server::Root,
19            Interaction = Server::Interaction,
20            GameOutcome = <Server::Reaction as spru::Reaction>::GameOutcome,
21            Common = Server::Common,
22        >,
23{
24    fn build(&self, app: &mut bevy::app::App) {
25        app.add_systems(
26            prelude::FixedUpdate,
27            (
28                super::system::propagate_local_queues::<Server, Client>,
29                super::system::create_local_clients::<Server, Client>,
30            ),
31        );
32    }
33}