mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'timo-logout' into 'master'
Fix bugs causing duplicate login/logout messages See merge request veloren/veloren!553
This commit is contained in:
commit
70718b9d02
@ -980,6 +980,21 @@ impl Server {
|
|||||||
ClientState::Registered
|
ClientState::Registered
|
||||||
| ClientState::Spectator
|
| ClientState::Spectator
|
||||||
| ClientState::Dead => {
|
| 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(
|
Self::create_player_character(
|
||||||
state,
|
state,
|
||||||
entity,
|
entity,
|
||||||
@ -989,17 +1004,6 @@ impl Server {
|
|||||||
main.map(|t| comp::Item::Tool { kind: t, power: 10 }),
|
main.map(|t| comp::Item::Tool { kind: t, power: 10 }),
|
||||||
&server_settings,
|
&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 => {
|
ClientState::Character => {
|
||||||
client.error_state(RequestStateError::Already)
|
client.error_state(RequestStateError::Already)
|
||||||
@ -1122,7 +1126,11 @@ impl Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if disconnect {
|
if disconnect {
|
||||||
if let Some(player) = state.ecs().read_storage::<comp::Player>().get(entity) {
|
if let (Some(player), Some(_)) = (
|
||||||
|
state.ecs().read_storage::<comp::Player>().get(entity),
|
||||||
|
// It only shows a message if you had a body (not in char selection)
|
||||||
|
state.ecs().read_storage::<comp::Body>().get(entity),
|
||||||
|
) {
|
||||||
new_chat_msgs.push((
|
new_chat_msgs.push((
|
||||||
None,
|
None,
|
||||||
ServerMsg::broadcast(format!("{} went offline.", &player.alias)),
|
ServerMsg::broadcast(format!("{} went offline.", &player.alias)),
|
||||||
|
Loading…
Reference in New Issue
Block a user