mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt
This commit is contained in:
parent
0f386bbedb
commit
324de39bfe
@ -17,7 +17,8 @@ impl Player {
|
||||
}
|
||||
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.alias.chars().all(|c| c.is_alphanumeric() || c == '_') && self.alias.len() <= MAX_ALIAS_LEN
|
||||
self.alias.chars().all(|c| c.is_alphanumeric() || c == '_')
|
||||
&& self.alias.len() <= MAX_ALIAS_LEN
|
||||
// TODO: Check view distance here based on server config too
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,8 @@ impl<'a> System<'a> for Sys {
|
||||
// If the space above is free...
|
||||
if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone())
|
||||
&& resolve_dir.z == 0.0
|
||||
&& terrain.get((pos.0 - Vec3::unit_z()).map(|e| e.floor() as i32)) // Make sure we're close to the ground
|
||||
&& terrain
|
||||
.get((pos.0 - Vec3::unit_z()).map(|e| e.floor() as i32)) // Make sure we're close to the ground
|
||||
.map(|vox| !vox.is_empty())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
|
@ -455,21 +455,25 @@ impl Server {
|
||||
ClientState::Pending => {}
|
||||
},
|
||||
// Valid player
|
||||
ClientMsg::Register { player } if player.is_valid() => 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)));
|
||||
ClientMsg::Register { player } if player.is_valid() => {
|
||||
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),
|
||||
}
|
||||
// Use RequestState instead (No need to send `player` again).
|
||||
_ => client.error_state(RequestStateError::Impossible),
|
||||
},
|
||||
}
|
||||
// Invalid player
|
||||
ClientMsg::Register { player } => client.error_state(RequestStateError::Impossible),
|
||||
ClientMsg::Register { player } => {
|
||||
client.error_state(RequestStateError::Impossible)
|
||||
}
|
||||
ClientMsg::SetViewDistance(view_distance) => match client.client_state {
|
||||
ClientState::Character { .. } => {
|
||||
state
|
||||
|
@ -114,7 +114,8 @@ impl PlayState for MainMenuState {
|
||||
false,
|
||||
)));
|
||||
} else {
|
||||
self.main_menu_ui.login_error("Invalid username".to_string());
|
||||
self.main_menu_ui
|
||||
.login_error("Invalid username".to_string());
|
||||
}
|
||||
}
|
||||
MainMenuEvent::StartSingleplayer => {
|
||||
|
Loading…
Reference in New Issue
Block a user