Show join message after selecting a character

This commit is contained in:
timokoesters 2019-07-05 22:16:06 +02:00
parent ab2c2dd940
commit 0236e2e8f2
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -431,12 +431,6 @@ impl Server {
match client.client_state {
ClientState::Connected => {
Self::initialize_player(state, entity, client, player);
if let Some(player) =
state.ecs().read_storage::<comp::Player>().get(entity)
{
new_chat_msgs
.push((None, format!("{} logged in", &player.alias)));
}
}
// Use RequestState instead (No need to send `player` again).
_ => client.error_state(RequestStateError::Impossible),
@ -464,7 +458,12 @@ impl Server {
ClientState::Registered
| ClientState::Spectator
| ClientState::Dead => {
Self::create_player_character(state, entity, client, name, body)
Self::create_player_character(state, entity, client, name, body);
if let Some(player) =
state.ecs().read_storage::<comp::Player>().get(entity)
{
new_chat_msgs.push((None, format!("{} joined", &player.alias)));
}
}
ClientState::Character => {
client.error_state(RequestStateError::Already)