krabmaga 0.6.1

A modern developing art for reliable and efficient Agent-based Model (ABM) simulation with the Rust language.
Documentation
use crate::engine::{schedule::Schedule, state::State};

use crate::visualization::visualization_state::VisualizationState;
use bevy::prelude::{Component, Resource};
use std::sync::{Arc, Mutex};

use std::marker::PhantomData;

// A wrapper of the currently active state, used as a Bevy resource.
#[derive(Resource)]
pub struct ActiveState<S: State>(pub Arc<Mutex<S>>);

// A wrapper of the currently active schedule, used as a Bevy resource.
#[derive(Resource)]
pub struct ActiveSchedule(pub Arc<Mutex<Schedule>>);

// Initialization method to set up state and agents, wrapped as a Bevy resource.
#[derive(Resource)]
pub struct Initializer<I: VisualizationState<S> + 'static + bevy::prelude::Resource, S: State>(
    pub I,
    pub PhantomData<Arc<Mutex<S>>>,
);

// Marker used to identify entities spawned by the visualization layer.
#[derive(Component)]
pub struct SimulationRenderEntity;