Fix formatting, Update CHANGELOG, turn overflow checks on for dev

profile
This commit is contained in:
Imbris 2019-12-31 03:47:00 -05:00
parent 06ea29bd4c
commit c9caf14877
3 changed files with 28 additions and 21 deletions

View File

@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed region display name - Fixed region display name
- Fixed the bow fire rate - Fixed the bow fire rate
- Healthbars now flash on critical health - Healthbars now flash on critical health
- Fixed ghosts when going back to character screen
### Removed ### Removed

View File

@ -14,10 +14,10 @@ members = [
# default profile for devs, fast to compile, okay enough to run, no debug information # default profile for devs, fast to compile, okay enough to run, no debug information
[profile.dev] [profile.dev]
opt-level = 2 opt-level = 2
overflow-checks = false overflow-checks = true
debug-assertions = true debug-assertions = true
panic = "abort" panic = "abort"
debug = false debug = false
codegen-units = 8 codegen-units = 8
lto = false lto = false
incremental = true incremental = true

View File

@ -28,7 +28,7 @@ use common::{
msg::{ClientMsg, ClientState, PlayerListUpdate, ServerError, ServerInfo, ServerMsg}, msg::{ClientMsg, ClientState, PlayerListUpdate, ServerError, ServerInfo, ServerMsg},
net::PostOffice, net::PostOffice,
state::{BlockChange, State, TimeOfDay}, state::{BlockChange, State, TimeOfDay},
sync::{Uid,UidAllocator, WorldSyncExt}, sync::{Uid, UidAllocator, WorldSyncExt},
terrain::{block::Block, TerrainChunkSize, TerrainGrid}, terrain::{block::Block, TerrainChunkSize, TerrainGrid},
vol::{ReadVol, RectVolSize, Vox}, vol::{ReadVol, RectVolSize, Vox},
}; };
@ -36,8 +36,8 @@ use log::{debug, error};
use metrics::ServerMetrics; use metrics::ServerMetrics;
use rand::Rng; use rand::Rng;
use specs::{ use specs::{
join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity, RunNow, join::Join, saveload::MarkerAllocator, world::EntityBuilder as EcsEntityBuilder, Builder,
SystemData, WorldExt, saveload::MarkerAllocator, Entity as EcsEntity, RunNow, SystemData, WorldExt,
}; };
use std::{ use std::{
i32, i32,
@ -413,8 +413,12 @@ impl Server {
} }
} }
if state
if state.ecs().write_storage::<Client>().get_mut(entity).is_some() { .ecs()
.write_storage::<Client>()
.get_mut(entity)
.is_some()
{
state state
.ecs() .ecs()
.write_storage() .write_storage()
@ -576,7 +580,12 @@ impl Server {
ServerEvent::Respawn(entity) => { ServerEvent::Respawn(entity) => {
// Only clients can respawn // Only clients can respawn
if state.ecs().write_storage::<Client>().get_mut(entity).is_some() { if state
.ecs()
.write_storage::<Client>()
.get_mut(entity)
.is_some()
{
let respawn_point = state let respawn_point = state
.read_component_cloned::<comp::Waypoint>(entity) .read_component_cloned::<comp::Waypoint>(entity)
.map(|wp| wp.get_pos()) .map(|wp| wp.get_pos())
@ -596,7 +605,7 @@ impl Server {
.ecs() .ecs()
.write_storage() .write_storage()
.insert(entity, comp::ForceUpdate) .insert(entity, comp::ForceUpdate)
.err().map(|err| .err().map(|err|
error!("Error inserting ForceUpdate component when respawning client: {:?}", 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 // Easier than checking and removing all other known components
// Note: If other `ServerEvent`s are referring to this entity they will be // Note: If other `ServerEvent`s are referring to this entity they will be
// disrupted // disrupted
let maybe_client = let maybe_client = state.ecs().write_storage::<Client>().remove(entity);
state.ecs().write_storage::<Client>().remove(entity); let maybe_uid = state.read_component_cloned::<Uid>(entity);
let maybe_uid = let maybe_player = state.ecs().write_storage::<comp::Player>().remove(entity);
state.read_component_cloned::<Uid>(entity); if let (Some(mut client), Some(uid), Some(player)) =
let maybe_player = (maybe_client, maybe_uid, maybe_player)
state.ecs().write_storage::<comp::Player>().remove(entity); {
if let (Some(mut client), Some(uid), Some(player)) = ( // Tell client its request was successful
maybe_client, maybe_uid, maybe_player, client.allow_state(ClientState::Registered);
) {
// Tell client its request was successful
client.allow_state(ClientState::Registered);
// Tell client to clear out other entities and its own components // Tell client to clear out other entities and its own components
client.notify(ServerMsg::ExitIngameCleanup); client.notify(ServerMsg::ExitIngameCleanup);
let entity_builder = let entity_builder =
state.ecs_mut().create_entity().with(client).with(player); state.ecs_mut().create_entity().with(client).with(player);