mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt
This commit is contained in:
@ -17,7 +17,8 @@ impl Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_valid(&self) -> bool {
|
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
|
// 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 the space above is free...
|
||||||
if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone())
|
if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone())
|
||||||
&& resolve_dir.z == 0.0
|
&& 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())
|
.map(|vox| !vox.is_empty())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
@ -455,21 +455,25 @@ impl Server {
|
|||||||
ClientState::Pending => {}
|
ClientState::Pending => {}
|
||||||
},
|
},
|
||||||
// Valid player
|
// Valid player
|
||||||
ClientMsg::Register { player } if player.is_valid() => match client.client_state {
|
ClientMsg::Register { player } if player.is_valid() => {
|
||||||
ClientState::Connected => {
|
match client.client_state {
|
||||||
Self::initialize_player(state, entity, client, player);
|
ClientState::Connected => {
|
||||||
if let Some(player) =
|
Self::initialize_player(state, entity, client, player);
|
||||||
state.ecs().read_storage::<comp::Player>().get(entity)
|
if let Some(player) =
|
||||||
{
|
state.ecs().read_storage::<comp::Player>().get(entity)
|
||||||
new_chat_msgs
|
{
|
||||||
.push((None, format!("{} logged in", &player.alias)));
|
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
|
// 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 {
|
ClientMsg::SetViewDistance(view_distance) => match client.client_state {
|
||||||
ClientState::Character { .. } => {
|
ClientState::Character { .. } => {
|
||||||
state
|
state
|
||||||
|
@ -114,7 +114,8 @@ impl PlayState for MainMenuState {
|
|||||||
false,
|
false,
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
self.main_menu_ui.login_error("Invalid username".to_string());
|
self.main_menu_ui
|
||||||
|
.login_error("Invalid username".to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainMenuEvent::StartSingleplayer => {
|
MainMenuEvent::StartSingleplayer => {
|
||||||
|
Reference in New Issue
Block a user