some comments

This commit is contained in:
Isse 2023-05-03 15:17:25 +02:00
parent 2e2e5680bc
commit a6665ed988
9 changed files with 46 additions and 24 deletions

View File

@ -194,6 +194,9 @@ pub mod figuredata {
pub bone2: ShipCentralSubSpec,
pub bone3: ShipCentralSubSpec,
// TODO: Use StructureBlock here instead. Which would require passing `IndexRef` and
// `Calendar` when loading the voxel colliders, which wouldn't work while it's stored in a
// static.
#[serde(default)]
pub custom_indices: HashMap<u8, DeBlock>,
}

View File

@ -146,7 +146,13 @@ pub fn handle_mount_volume(server: &mut Server, rider: EcsEntity, volume_pos: Vo
let block_transform = volume_pos.get_block_and_transform(
&state.terrain(),
&state.ecs().read_resource(),
|e| state.read_storage().get(e).copied().zip(state.read_storage().get(e).copied()),
|e| {
state
.read_storage()
.get(e)
.copied()
.zip(state.read_storage().get(e).copied())
},
&state.read_storage(),
);

View File

@ -754,7 +754,13 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
pos.get_block_and_transform(
&state.terrain(),
&state.ecs().read_resource(),
|e| state.read_storage().get(e).copied().zip(state.read_storage().get(e).copied()),
|e| {
state
.read_storage()
.get(e)
.copied()
.zip(state.read_storage().get(e).copied())
},
&state.read_storage(),
)
.map(|(mat, _)| mat.mul_point(Vec3::broadcast(0.5)))

View File

@ -4749,8 +4749,13 @@ impl Hud {
&client.state().terrain(),
&client.state().ecs().read_resource(),
|e| {
client.state().read_storage::<vcomp::Interpolated>().get(e)
.map(|interpolated| (comp::Pos(interpolated.pos), interpolated.ori))
client
.state()
.read_storage::<vcomp::Interpolated>()
.get(e)
.map(|interpolated| {
(comp::Pos(interpolated.pos), interpolated.ori)
})
},
&client.state().read_storage(),
)

View File

@ -117,6 +117,9 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), bounds)
}
// /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some
// /// point).
// TODO: this function name...
pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>(
vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): (

View File

@ -47,7 +47,7 @@ use common::{
mounting::{Rider, VolumeRider},
resources::{DeltaTime, Time},
states::{equipping, idle, utils::StageSection, wielding},
terrain::{Block, TerrainChunk, TerrainGrid, SpriteKind},
terrain::{Block, SpriteKind, TerrainChunk, TerrainGrid},
uid::UidAllocator,
util::Dir,
vol::{ReadVol, RectRasterableVol},
@ -2171,7 +2171,9 @@ impl FigureMgr {
)
},
_ => {
if let Some(sprite) = is_volume_rider.and_then(|is_volume_rider| is_volume_rider.block.get_sprite()) {
if let Some(sprite) = is_volume_rider
.and_then(|is_volume_rider| is_volume_rider.block.get_sprite())
{
match sprite {
SpriteKind::Helm => {
anim::character::DanceAnimation::update_skeleton(
@ -2181,21 +2183,19 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
)
}
_ => {
anim::character::SitAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
},
_ => anim::character::SitAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
}
} else {
target_base
}
}
},
};
state.skeleton = Lerp::lerp(&state.skeleton, &target_bones, dt_lerp);

View File

@ -719,8 +719,7 @@ impl Scene {
.filter_map(|(entity, interpolated, body, collider)| {
let vol = collider.get_vol(&voxel_colliders_manifest)?;
let (blocks_of_interest, offset) =
figure_mgr
.get_blocks_of_interest(entity, body, Some(collider))?;
figure_mgr.get_blocks_of_interest(entity, body, Some(collider))?;
let mat = Mat4::from(interpolated.ori.to_quat())
.translated_3d(interpolated.pos)

View File

@ -16,7 +16,8 @@ use common::{
terrain::{Block, TerrainGrid, UnlockKind},
uid::{Uid, UidAllocator},
util::find_dist::{Cube, Cylinder, FindDist},
vol::ReadVol, CachedSpatialGrid,
vol::ReadVol,
CachedSpatialGrid,
};
use common_base::span;
@ -197,7 +198,6 @@ pub(super) fn select_interactable(
player_char_state,
);
let spacial_grid = ecs.read_resource::<CachedSpatialGrid>();
let entities = ecs.entities();
@ -211,9 +211,9 @@ pub(super) fn select_interactable(
!&is_mount,
(stats.mask() | items.mask()).maybe(),
)
.join();
.join();
let closest_interactable_entity = spacial_grid.0.in_circle_aabr(player_pos.xy(), MAX_PICKUP_RANGE)
let closest_interactable_entity = spacial_grid.0.in_circle_aabr(player_pos.xy(), MAX_PICKUP_RANGE)
.filter(|&e| e != player_entity) // skip the player's entity
.filter_map(|e| entity_data.get(e, &entities))
.filter_map(|(e, p, b, s, c, cs, _, has_stats_or_item)| {

View File

@ -350,7 +350,7 @@ impl SessionState {
match inv_event {
InventoryUpdateEvent::BlockCollectFailed { pos, reason } => {
self.hud.add_failed_block_pickup(
// TODO: Support volumes.
// TODO: Possibly support volumes.
VolumePos::terrain(pos),
HudCollectFailedReason::from_server_reason(
&reason,