mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xvar/fix-admin-loss-on-character-switch' into 'master'
Preserve admin component if present on return to character select screen Closes #780 See merge request veloren/veloren!1413
This commit is contained in:
commit
a4a75782ab
@ -24,6 +24,8 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity) {
|
||||
let maybe_client = state.ecs().write_storage::<Client>().remove(entity);
|
||||
let maybe_uid = state.read_component_copied::<Uid>(entity);
|
||||
let maybe_player = state.ecs().write_storage::<comp::Player>().remove(entity);
|
||||
let maybe_admin = state.ecs().write_storage::<comp::Admin>().remove(entity);
|
||||
|
||||
let maybe_group = state
|
||||
.ecs()
|
||||
.write_storage::<group::Group>()
|
||||
@ -37,11 +39,18 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity) {
|
||||
|
||||
let entity_builder = state.ecs_mut().create_entity().with(client).with(player);
|
||||
|
||||
// Preserve group component if present
|
||||
let entity_builder = match maybe_group {
|
||||
Some(group) => entity_builder.with(group),
|
||||
None => entity_builder,
|
||||
};
|
||||
|
||||
// Preserve admin component if present
|
||||
let entity_builder = match maybe_admin {
|
||||
Some(admin) => entity_builder.with(admin),
|
||||
None => entity_builder,
|
||||
};
|
||||
|
||||
// Ensure UidAllocator maps this uid to the new entity
|
||||
let uid = entity_builder
|
||||
.world
|
||||
|
Loading…
Reference in New Issue
Block a user