Update changelog, address comments, fmt

This commit is contained in:
Imbris 2020-10-29 18:46:28 -04:00
parent 64def3cde4
commit cb68aec291
3 changed files with 46 additions and 35 deletions

View File

@ -54,6 +54,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moved hammer leap attack to skillbar - Moved hammer leap attack to skillbar
- Reworked fire staff - Reworked fire staff
- Overhauled cloud shaders to add mist, light attenuation, an approximation of rayleigh scattering, etc. - Overhauled cloud shaders to add mist, light attenuation, an approximation of rayleigh scattering, etc.
- Fixed a bug where a nearby item would also be collected when collecting collectible blocks
- Allowed collecting nearby blocks without aiming at them
- Made voxygen wait until singleplayer server is initialized before attempting to connect, removing the chance for it to give up on connecting if the server takes a while to start
- Log where userdata folder is located
### Removed ### Removed

View File

@ -66,7 +66,7 @@ hashbrown = {version = "0.7.2", features = ["rayon", "serde", "nightly"]}
image = {version = "0.23.8", default-features = false, features = ["ico", "png"]} image = {version = "0.23.8", default-features = false, features = ["ico", "png"]}
native-dialog = { version = "0.4.2", default-features = false, optional = true } native-dialog = { version = "0.4.2", default-features = false, optional = true }
num = "0.2" num = "0.2"
ordered-float = "2.0.0" ordered-float = { version = "2.0.0", default-features = false }
rand = "0.7" rand = "0.7"
rodio = {version = "0.11", default-features = false, features = ["wav", "vorbis"]} rodio = {version = "0.11", default-features = false, features = ["wav", "vorbis"]}
ron = {version = "0.6", default-features = false} ron = {version = "0.6", default-features = false}

View File

@ -15,9 +15,7 @@ use client::{self, Client};
use common::{ use common::{
assets::Asset, assets::Asset,
comp, comp,
comp::{ comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel},
ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel,
},
consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE}, consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE},
event::EventBus, event::EventBus,
outcome::Outcome, outcome::Outcome,
@ -274,18 +272,24 @@ impl PlayState for SessionState {
.get(self.client.borrow().entity()) .get(self.client.borrow().entity())
.is_some(); .is_some();
let interactable = select_interactable(&self.client.borrow(), self.target_entity, select_pos, &self.scene); let interactable = select_interactable(
&self.client.borrow(),
self.target_entity,
select_pos,
&self.scene,
);
// Only highlight interactables // Only highlight interactables
// unless in build mode where select_pos highlighted // unless in build mode where select_pos highlighted
self.scene.set_select_pos( self.scene
select_pos .set_select_pos(
.filter(|_| can_build) select_pos
.or_else(|| match interactable { .filter(|_| can_build)
Some(Interactable::Block(_, block_pos)) => Some(block_pos), .or_else(|| match interactable {
_ => None, Some(Interactable::Block(_, block_pos)) => Some(block_pos),
}) _ => None,
); }),
);
// Handle window events. // Handle window events.
for event in events { for event in events {
@ -467,10 +471,13 @@ impl PlayState for SessionState {
&client.state().ecs().read_storage::<comp::MountState>(), &client.state().ecs().read_storage::<comp::MountState>(),
) )
.join() .join()
.filter(|(entity, _, mount_state)| *entity != client.entity() .filter(|(entity, _, mount_state)| {
&& **mount_state == comp::MountState::Unmounted *entity != client.entity()
) && **mount_state == comp::MountState::Unmounted
.map(|(entity, pos, _)| (entity, player_pos.0.distance_squared(pos.0))) })
.map(|(entity, pos, _)| {
(entity, player_pos.0.distance_squared(pos.0))
})
.filter(|(_, dist_sqr)| *dist_sqr < MAX_MOUNT_RANGE.powi(2)) .filter(|(_, dist_sqr)| *dist_sqr < MAX_MOUNT_RANGE.powi(2))
.min_by_key(|(_, dist_sqr)| OrderedFloat(*dist_sqr)); .min_by_key(|(_, dist_sqr)| OrderedFloat(*dist_sqr));
if let Some((mountee_entity, _)) = closest_mountable_entity { if let Some((mountee_entity, _)) = closest_mountable_entity {
@ -488,17 +495,21 @@ impl PlayState for SessionState {
if let Some(interactable) = interactable { if let Some(interactable) = interactable {
let mut client = self.client.borrow_mut(); let mut client = self.client.borrow_mut();
match interactable { match interactable {
Interactable::Block(block, pos) => if block.is_collectible() { Interactable::Block(block, pos) => {
client.collect_block(pos); if block.is_collectible() {
client.collect_block(pos);
}
}, },
Interactable::Entity(entity) => if client Interactable::Entity(entity) => {
.state() if client
.ecs() .state()
.read_storage::<comp::Item>() .ecs()
.get(entity) .read_storage::<comp::Item>()
.is_some() .get(entity)
{ .is_some()
client.pick_up(entity); {
client.pick_up(entity);
}
}, },
} }
} }
@ -1242,13 +1253,9 @@ fn select_interactable(
scene: &Scene, scene: &Scene,
) -> Option<Interactable> { ) -> Option<Interactable> {
span!(_guard, "select_interactable"); span!(_guard, "select_interactable");
use common::{ use common::{spiral::Spiral2d, terrain::TerrainChunk, vol::RectRasterableVol};
spiral::Spiral2d,
terrain::TerrainChunk,
vol::RectRasterableVol,
};
target_entity.map(Interactable::Entity) target_entity.map(Interactable::Entity)
.or_else(|| selected_pos.and_then(|sp| .or_else(|| selected_pos.and_then(|sp|
client.state().terrain().get(sp).ok().copied() client.state().terrain().get(sp).ok().copied()
.filter(Block::is_collectible).map(|b| Interactable::Block(b, sp)) .filter(Block::is_collectible).map(|b| Interactable::Block(b, sp))
)) ))
@ -1300,7 +1307,7 @@ fn select_interactable(
.take(((search_dist / TerrainChunk::RECT_SIZE.x as f32).ceil() as usize * 2 + 1).pow(2)) .take(((search_dist / TerrainChunk::RECT_SIZE.x as f32).ceil() as usize * 2 + 1).pow(2))
.flat_map(|offset| { .flat_map(|offset| {
let chunk_pos = player_chunk + offset; let chunk_pos = player_chunk + offset;
let chunk_voxel_pos = let chunk_voxel_pos =
Vec3::<i32>::from(chunk_pos * TerrainChunk::RECT_SIZE.map(|e| e as i32)); Vec3::<i32>::from(chunk_pos * TerrainChunk::RECT_SIZE.map(|e| e as i32));
terrain.get(chunk_pos).map(|data| (data, chunk_voxel_pos)) terrain.get(chunk_pos).map(|data| (data, chunk_voxel_pos))
}) })
@ -1311,7 +1318,7 @@ fn select_interactable(
.blocks_of_interest .blocks_of_interest
.interactables .interactables
.iter() .iter()
.map(move |block_offset| chunk_pos + block_offset) .map(move |block_offset| chunk_pos + block_offset)
}) })
// TODO: confirm that adding 0.5 here is correct // TODO: confirm that adding 0.5 here is correct
.map(|block_pos| ( .map(|block_pos| (