diff --git a/CHANGELOG.md b/CHANGELOG.md index bec6a47843..50b2594f95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed region display name - Fixed the bow fire rate - Healthbars now flash on critical health +- Fixed ghosts when going back to character screen ### Removed diff --git a/Cargo.toml b/Cargo.toml index 9c674add42..1c26a0fa62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ members = [ # default profile for devs, fast to compile, okay enough to run, no debug information [profile.dev] opt-level = 2 -overflow-checks = false +overflow-checks = true debug-assertions = true panic = "abort" -debug = false +debug = false codegen-units = 8 lto = false incremental = true diff --git a/server/src/lib.rs b/server/src/lib.rs index a67ced3508..d6d1ba9948 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -28,7 +28,7 @@ use common::{ msg::{ClientMsg, ClientState, PlayerListUpdate, ServerError, ServerInfo, ServerMsg}, net::PostOffice, state::{BlockChange, State, TimeOfDay}, - sync::{Uid,UidAllocator, WorldSyncExt}, + sync::{Uid, UidAllocator, WorldSyncExt}, terrain::{block::Block, TerrainChunkSize, TerrainGrid}, vol::{ReadVol, RectVolSize, Vox}, }; @@ -36,8 +36,8 @@ use log::{debug, error}; use metrics::ServerMetrics; use rand::Rng; use specs::{ - join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity, RunNow, - SystemData, WorldExt, saveload::MarkerAllocator, + join::Join, saveload::MarkerAllocator, world::EntityBuilder as EcsEntityBuilder, Builder, + Entity as EcsEntity, RunNow, SystemData, WorldExt, }; use std::{ i32, @@ -413,8 +413,12 @@ impl Server { } } - - if state.ecs().write_storage::().get_mut(entity).is_some() { + if state + .ecs() + .write_storage::() + .get_mut(entity) + .is_some() + { state .ecs() .write_storage() @@ -576,7 +580,12 @@ impl Server { ServerEvent::Respawn(entity) => { // Only clients can respawn - if state.ecs().write_storage::().get_mut(entity).is_some() { + if state + .ecs() + .write_storage::() + .get_mut(entity) + .is_some() + { let respawn_point = state .read_component_cloned::(entity) .map(|wp| wp.get_pos()) @@ -596,7 +605,7 @@ impl Server { .ecs() .write_storage() .insert(entity, comp::ForceUpdate) - .err().map(|err| + .err().map(|err| error!("Error inserting ForceUpdate component when respawning client: {:?}", err) ); } @@ -750,19 +759,16 @@ impl Server { // Easier than checking and removing all other known components // Note: If other `ServerEvent`s are referring to this entity they will be // disrupted - let maybe_client = - state.ecs().write_storage::().remove(entity); - let maybe_uid = - state.read_component_cloned::(entity); - let maybe_player = - state.ecs().write_storage::().remove(entity); - if let (Some(mut client), Some(uid), Some(player)) = ( - maybe_client, maybe_uid, maybe_player, - ) { - // Tell client its request was successful - client.allow_state(ClientState::Registered); + let maybe_client = state.ecs().write_storage::().remove(entity); + let maybe_uid = state.read_component_cloned::(entity); + let maybe_player = state.ecs().write_storage::().remove(entity); + if let (Some(mut client), Some(uid), Some(player)) = + (maybe_client, maybe_uid, maybe_player) + { + // Tell client its request was successful + client.allow_state(ClientState::Registered); // Tell client to clear out other entities and its own components - client.notify(ServerMsg::ExitIngameCleanup); + client.notify(ServerMsg::ExitIngameCleanup); let entity_builder = state.ecs_mut().create_entity().with(client).with(player);