fix: selecting another character no longer shows a new login message

This commit is contained in:
timokoesters 2019-10-06 18:26:51 +02:00
parent 4501fef503
commit 0d1bf16e46
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -980,6 +980,21 @@ impl Server {
ClientState::Registered
| ClientState::Spectator
| ClientState::Dead => {
if let (Some(player), None) = (
state.ecs().read_storage::<comp::Player>().get(entity),
// Only send login message if the player didn't have a body
// previously
state.ecs().read_storage::<comp::Body>().get(entity),
) {
new_chat_msgs.push((
None,
ServerMsg::broadcast(format!(
"[{}] is now online.",
&player.alias
)),
));
}
Self::create_player_character(
state,
entity,
@ -989,17 +1004,6 @@ impl Server {
main.map(|t| comp::Item::Tool { kind: t, power: 10 }),
&server_settings,
);
if let Some(player) =
state.ecs().read_storage::<comp::Player>().get(entity)
{
new_chat_msgs.push((
None,
ServerMsg::broadcast(format!(
"[{}] is now online.",
&player.alias
)),
));
}
}
ClientState::Character => {
client.error_state(RequestStateError::Already)