mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Allow non player entites to be removed again
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user