1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use crate::events::ApplicableEvent;
use crate::players::PlayerId;
use crate::universe_group::UniverseGroup;
use serde_derive::{Deserialize, Serialize};
/// This event informs of the disconnect of a player from the [`UniverseGroup`].
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RemovedPlayerEvent {
pub id: PlayerId,
}
impl ApplicableEvent<UniverseGroup> for RemovedPlayerEvent {
fn apply(self, group: &mut UniverseGroup) {
group.players[self.id.0] = None;
}
}