diff --git a/common/net/src/msg/compression.rs b/common/net/src/msg/compression.rs index 7d02c95efb..53fa1c3c21 100644 --- a/common/net/src/msg/compression.rs +++ b/common/net/src/msg/compression.rs @@ -621,6 +621,11 @@ impl VoxelImageDecoding for TriPngEncoding Rgb { + r: 150, + g: 190, + b: 255, + }, Earth => Rgb { r: 200, g: 140, diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 710b0e353c..0470964555 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -305,8 +305,9 @@ pub fn handle_move(data: &JoinData<'_>, update: &mut StateUpdate, efficiency: f3 fn basic_move(data: &JoinData<'_>, update: &mut StateUpdate, efficiency: f32) { let efficiency = efficiency * data.stats.move_speed_modifier * data.stats.friction_modifier; - let accel = if data.physics.on_ground.is_some() { - data.body.base_accel() + let accel = if let Some(block) = data.physics.on_ground { + // FRIC_GROUND temporarily used to normalize things around expected values + data.body.base_accel() * block.get_friction() / FRIC_GROUND } else { data.body.air_accel() } * efficiency; @@ -351,7 +352,10 @@ pub fn handle_forced_movement( match movement { ForcedMovement::Forward { strength } => { let strength = strength * data.stats.move_speed_modifier * data.stats.friction_modifier; - if let Some(accel) = data.physics.on_ground.map(|_| data.body.base_accel()) { + if let Some(accel) = data.physics.on_ground.map(|block| { + // FRIC_GROUND temporarily used to normalize things around expected values + data.body.base_accel() * block.get_friction() / FRIC_GROUND + }) { update.vel.0 += Vec2::broadcast(data.dt.0) * accel * (data.inputs.move_dir + Vec2::from(update.ori)) diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index 797d3a3b9f..9eb1049535 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -1,6 +1,7 @@ use super::SpriteKind; use crate::{ comp::{fluid_dynamics::LiquidKind, tool::ToolKind}, + consts::FRIC_GROUND, make_case_elim, }; use num_derive::FromPrimitive; @@ -49,6 +50,7 @@ make_case_elim!( Wood = 0x40, Leaves = 0x41, GlowingMushroom = 0x42, + Ice = 0x43, // 0x43 <= x < 0x50 is reserved for future tree parts // Covers all other cases (we sometimes have bizarrely coloured misc blocks, and also we // often want to experiment with new kinds of block without allocating them a @@ -226,6 +228,7 @@ impl Block { BlockKind::Leaves => (9, 255), BlockKind::Wood => (6, 2), BlockKind::Snow => (6, 2), + BlockKind::Ice => (4, 2), _ if self.is_opaque() => (0, 255), _ => (0, 0), } @@ -251,6 +254,7 @@ impl Block { BlockKind::Grass => Some(0.5), BlockKind::WeakRock => Some(0.75), BlockKind::Snow => Some(0.1), + BlockKind::Ice => Some(0.5), BlockKind::Lava => None, _ => self.get_sprite().and_then(|sprite| match sprite { sprite if sprite.is_container() => None, @@ -291,7 +295,9 @@ impl Block { #[inline] pub fn mine_tool(&self) -> Option { match self.kind() { - BlockKind::WeakRock | BlockKind::GlowingWeakRock => Some(ToolKind::Pick), + BlockKind::WeakRock | BlockKind::Ice | BlockKind::GlowingWeakRock => { + Some(ToolKind::Pick) + }, _ => self.get_sprite().and_then(|s| s.mine_tool()), } } @@ -306,6 +312,15 @@ impl Block { .unwrap_or(1.0) } + // Used to calculate surface friction when walking. Currently has no units. + #[inline] + pub fn get_friction(&self) -> f32 { + match self.kind() { + BlockKind::Ice => FRIC_GROUND * 0.1, + _ => FRIC_GROUND, + } + } + #[inline] pub fn kind(&self) -> BlockKind { self.kind } diff --git a/common/src/terrain/map.rs b/common/src/terrain/map.rs index 34c3d434b1..5fb3101e46 100644 --- a/common/src/terrain/map.rs +++ b/common/src/terrain/map.rs @@ -588,7 +588,7 @@ impl<'a> MapConfig<'a> { let b_water = 64.0 * water_color_factor; if has_river { // Rudimentary ice check - if !rgb.map(|e| e > 0.6).reduce_and() { + if !rgb.map(|e| e > 0.35).reduce_and() { let water_rgb = Rgb::new(0, ((g_water) * 1.0) as u8, ((b_water) * 1.0) as u8) .map(|e| e as f64 / 255.0); rgb = water_rgb; diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index c48894fccc..cbd26a0019 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -1692,8 +1692,18 @@ fn box_voxel_collision<'a, T: BaseVol + ReadVol>( physics_state.on_wall = on_wall; let fric_mod = read.stats.get(entity).map_or(1.0, |s| s.friction_modifier); - if physics_state.on_ground.is_some() || (physics_state.on_wall.is_some() && climbing) { - vel.0 *= (1.0 - FRIC_GROUND.min(1.0) * fric_mod).powf(dt.0 * 60.0); + let ground_fric = physics_state + .on_ground + .map(|b| b.get_friction()) + .unwrap_or(0.0); + let wall_fric = if physics_state.on_wall.is_some() && climbing { + FRIC_GROUND + } else { + 0.0 + }; + let fric = ground_fric.max(wall_fric); + if fric > 0.0 { + vel.0 *= (1.0 - fric.min(1.0) * fric_mod).powf(dt.0 * 60.0); physics_state.ground_vel = ground_vel; } diff --git a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs index 132f34e17e..afb0ceebf6 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs @@ -206,7 +206,9 @@ impl MovementEventMapper { } else { match underfoot_block_kind { BlockKind::Snow => SfxEvent::Run(BlockKind::Snow), - BlockKind::Rock | BlockKind::WeakRock => SfxEvent::Run(BlockKind::Rock), + BlockKind::Rock | BlockKind::WeakRock | BlockKind::Ice => { + SfxEvent::Run(BlockKind::Rock) + }, BlockKind::Sand => SfxEvent::Run(BlockKind::Sand), BlockKind::Air => SfxEvent::Idle, _ => SfxEvent::Run(BlockKind::Grass), diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 073b390f28..473c17ae3b 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -210,8 +210,7 @@ impl<'a> BlockGen<'a> { let over_water = height < water_height; // Water if over_water && (wposf.z as f32 - water_height).abs() < ice_depth { - // TODO: Ice block - Some(Block::new(BlockKind::WeakRock, CONFIG.ice_color)) + Some(Block::new(BlockKind::Ice, CONFIG.ice_color)) } else if (wposf.z as f32) < water_height { // Ocean Some(water) diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index e54de9d2c1..5975c1eb1e 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -91,7 +91,13 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { wpos, |chunk| if chunk.river.near_water() { 1.0 } else { 0.0 }, )?; - let water_vel = sim.get_interpolated(wpos, |chunk| chunk.river.velocity)?; + let water_vel = sim.get_interpolated(wpos, |chunk| { + if chunk.river.river_kind.is_some() { + chunk.river.velocity + } else { + Vec3::zero() + } + })?; let alt = sim.get_interpolated_monotone(wpos, |chunk| chunk.alt)?; let surface_veg = sim.get_interpolated_monotone(wpos, |chunk| chunk.surface_veg)?; let sim_chunk = sim.get(chunk_pos)?; diff --git a/world/src/config.rs b/world/src/config.rs index 2a4430885e..6945b043f7 100644 --- a/world/src/config.rs +++ b/world/src/config.rs @@ -74,7 +74,7 @@ pub const CONFIG: Config = Config { river_max_width: 2.0, river_min_height: 0.25, river_width_to_depth: 8.0, - ice_color: Rgb::new(175, 200, 255), + ice_color: Rgb::new(140, 175, 255), }; #[derive(Deserialize)] diff --git a/world/src/site/tree.rs b/world/src/site/tree.rs index 9852b734ae..5446648519 100644 --- a/world/src/site/tree.rs +++ b/world/src/site/tree.rs @@ -26,7 +26,7 @@ impl Tree { alt: land.get_alt_approx(origin) as i32, seed: rng.gen(), tree: { - let config = TreeConfig::giant(rng, 4.0, false); + let config = TreeConfig::giant(rng, 4.0, true); ProceduralTree::generate(config, rng) }, } @@ -60,7 +60,7 @@ impl Tree { let wpos = wpos2d.with_z(self.alt + z); let rposf = (wpos - self.origin.with_z(self.alt)).map(|e| e as f32 + 0.5); - let (branch, leaves, _, _) = self.tree.is_branch_or_leaves_at(rposf); + let (branch, leaves, platform, air) = self.tree.is_branch_or_leaves_at(rposf); if (branch || leaves) && above && col.snow_cover { canvas.set( @@ -69,7 +69,9 @@ impl Tree { ); } - let block = if leaves { + let block = if air { + Some(Block::empty()) + } else if leaves { if above && dynamic_rng.gen_bool(0.0005) { canvas.spawn( EntityInfo::at(wpos.map(|e| e as f32) + Vec3::unit_z()) @@ -96,6 +98,8 @@ impl Tree { Some(Block::new(BlockKind::Leaves, leaf_col.map(|e| e as u8))) } else if branch { Some(Block::new(BlockKind::Wood, Rgb::new(80, 32, 0))) + } else if platform { + Some(Block::new(BlockKind::Wood, Rgb::new(180, 130, 50))) } else { None };