Allow non player entites to be removed again

This commit is contained in:
timokoesters
2019-08-23 22:50:35 +02:00
committed by jshipsey
parent b5f649eb15
commit e674424974

View File

@ -243,6 +243,8 @@ impl Server {
let state = &mut self.state;
let clients = &mut self.clients;
let mut todo_remove = None;
match event {
ServerEvent::Explosion { pos, radius } => {
const RAYS: usize = 500;
@ -306,7 +308,6 @@ impl Server {
clients.notify_registered(ServerMsg::kill(msg));
}
{
// Give EXP to the client
let mut stats = ecs.write_storage::<comp::Stats>();
@ -324,14 +325,13 @@ impl Server {
});
}
}
}
if let Some(client) = clients.get_mut(&entity) {
let _ = ecs.write_storage().insert(entity, comp::Vel(Vec3::zero()));
let _ = ecs.write_storage().insert(entity, comp::ForceUpdate);
client.force_state(ClientState::Dead);
} else {
let _ = state.ecs_mut().delete_entity_synced(entity);
todo_remove = Some(entity.clone());
}
}
@ -356,6 +356,10 @@ impl Server {
}
}
}
if let Some(entity) = todo_remove {
let _ = state.ecs_mut().delete_entity_synced(entity);
}
}
}