//! The `PoolBehavior` trait and its dispatch runner. Concrete pool behaviors (acid, slow)
//! live in `crate::pools`; the `GroundPool` entity lives in `crate::pool`.
use crate::{behavior::dyn_clone_trait, context::TickContext, pool::GroundPool};
pub trait PoolBehavior: PoolClone + Send + Sync {
fn on_tick(&mut self, _pool: &mut GroundPool, _c: &mut TickContext) {}
}
dyn_clone_trait!(PoolClone, PoolBehavior);
pub fn dispatch_pool_tick(g: &mut GroundPool, c: &mut TickContext) {
let mut behaviors = std::mem::take(&mut g.behaviors);
for b in behaviors.iter_mut() {
b.on_tick(g, c);
}
g.behaviors = behaviors;
}