use libpso::packet::ship::*; use crate::common::serverstate::ClientId; use crate::ship::ship::{SendShipPacket, ShipError, Clients}; use crate::entity::gateway::EntityGateway; pub async fn update_config(id: ClientId, update_config: &UpdateConfig, clients: &mut Clients, entity_gateway: &mut EG) -> Box + Send> { let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id)).unwrap(); client.character.config.update(update_config); entity_gateway.save_character(&client.character).await; Box::new(None.into_iter()) } pub async fn save_options(id: ClientId, save_options: &SaveOptions, clients: &mut Clients, entity_gateway: &mut EG) -> Box + Send> { // // TODO: don't unwrap? let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id)).unwrap(); client.character.option_flags = save_options.options; entity_gateway.save_character(&client.character).await; Box::new(None.into_iter()) }