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 bone2: ShipCentralSubSpec,
pub bone3: 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)] #[serde(default)]
pub custom_indices: HashMap<u8, DeBlock>, 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( let block_transform = volume_pos.get_block_and_transform(
&state.terrain(), &state.terrain(),
&state.ecs().read_resource(), &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(), &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( pos.get_block_and_transform(
&state.terrain(), &state.terrain(),
&state.ecs().read_resource(), &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(), &state.read_storage(),
) )
.map(|(mat, _)| mat.mul_point(Vec3::broadcast(0.5))) .map(|(mat, _)| mat.mul_point(Vec3::broadcast(0.5)))

View File

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

View File

@ -117,6 +117,9 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), bounds) (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>( pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>(
vol: V, vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): ( (greedy, opaque_mesh, offs, scale, bone_idx): (

View File

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

View File

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

View File

@ -16,7 +16,8 @@ use common::{
terrain::{Block, TerrainGrid, UnlockKind}, terrain::{Block, TerrainGrid, UnlockKind},
uid::{Uid, UidAllocator}, uid::{Uid, UidAllocator},
util::find_dist::{Cube, Cylinder, FindDist}, util::find_dist::{Cube, Cylinder, FindDist},
vol::ReadVol, CachedSpatialGrid, vol::ReadVol,
CachedSpatialGrid,
}; };
use common_base::span; use common_base::span;
@ -197,7 +198,6 @@ pub(super) fn select_interactable(
player_char_state, player_char_state,
); );
let spacial_grid = ecs.read_resource::<CachedSpatialGrid>(); let spacial_grid = ecs.read_resource::<CachedSpatialGrid>();
let entities = ecs.entities(); let entities = ecs.entities();

View File

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