mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Address review comments.
This commit is contained in:
parent
529533466c
commit
5af5ceb1f9
@ -125,6 +125,15 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: See if we can generalize this somehow.
|
||||
#[inline]
|
||||
pub const fn water(sprite: SpriteKind) -> Self {
|
||||
Self {
|
||||
kind: BlockKind::Water,
|
||||
attr: [sprite as u8, 0, 0],
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_color(&self) -> Option<Rgb<u8>> {
|
||||
if self.has_color() {
|
||||
|
@ -491,8 +491,6 @@ pub fn block_from_structure(
|
||||
let lerp = ((field.get(Vec3::from(structure_pos)).rem_euclid(256)) as f32 / 255.0) * 0.85
|
||||
+ ((field.get(pos + std::i32::MAX / 2).rem_euclid(256)) as f32 / 255.0) * 0.15;
|
||||
|
||||
const EMPTY_SPRITE: Rgb<u8> = Rgb::new(SpriteKind::Empty as u8, 0, 0);
|
||||
|
||||
match sblock {
|
||||
StructureBlock::None => None,
|
||||
StructureBlock::Hollow => Some(with_sprite(SpriteKind::Empty)),
|
||||
@ -501,12 +499,9 @@ pub fn block_from_structure(
|
||||
sample.surface_color.map(|e| (e * 255.0) as u8),
|
||||
)),
|
||||
StructureBlock::Normal(color) => Some(Block::new(BlockKind::Misc, color)),
|
||||
StructureBlock::Water => Some(Block::new(BlockKind::Water, EMPTY_SPRITE)),
|
||||
StructureBlock::GreenSludge => Some(Block::new(
|
||||
// TODO: If/when liquid supports other colors again, revisit this.
|
||||
BlockKind::Water,
|
||||
EMPTY_SPRITE,
|
||||
)),
|
||||
StructureBlock::Water => Some(Block::water(SpriteKind::Empty)),
|
||||
// TODO: If/when liquid supports other colors again, revisit this.
|
||||
StructureBlock::GreenSludge => Some(Block::water(SpriteKind::Empty)),
|
||||
// None of these BlockKinds has an orientation, so we just use zero for the other color
|
||||
// bits.
|
||||
StructureBlock::Liana => Some(with_sprite(SpriteKind::Liana)),
|
||||
|
@ -209,7 +209,7 @@ pub fn apply_caves_to<'a>(
|
||||
}
|
||||
#[allow(clippy::eval_order_dependence)]
|
||||
pub fn apply_caves_supplement<'a>(
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
dynamic_rng: &mut impl Rng,
|
||||
wpos2d: Vec2<i32>,
|
||||
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
|
||||
|
@ -416,7 +416,7 @@ impl Castle {
|
||||
#[allow(clippy::or_fun_call)] // TODO: Pending review in #587
|
||||
pub fn apply_supplement<'a>(
|
||||
&'a self,
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
_dynamic_rng: &mut impl Rng,
|
||||
_wpos2d: Vec2<i32>,
|
||||
_get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
|
||||
|
@ -163,7 +163,7 @@ impl Dungeon {
|
||||
#[allow(clippy::or_fun_call)] // TODO: Pending review in #587
|
||||
pub fn apply_supplement<'a>(
|
||||
&'a self,
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
dynamic_rng: &mut impl Rng,
|
||||
wpos2d: Vec2<i32>,
|
||||
_get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
|
||||
@ -417,7 +417,7 @@ impl Floor {
|
||||
#[allow(clippy::match_single_binding)] // TODO: Pending review in #587
|
||||
fn apply_supplement(
|
||||
&self,
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
dynamic_rng: &mut impl Rng,
|
||||
area: Aabr<i32>,
|
||||
origin: Vec3<i32>,
|
||||
|
@ -108,7 +108,7 @@ impl Site {
|
||||
|
||||
pub fn apply_supplement<'a>(
|
||||
&'a self,
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
dynamic_rng: &mut impl Rng,
|
||||
wpos2d: Vec2<i32>,
|
||||
get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
|
||||
|
@ -531,7 +531,7 @@ impl Archetype for House {
|
||||
.noise
|
||||
.chance(Vec3::new(center_offset.x, center_offset.y, z), 0.2)
|
||||
{
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
let mut dynamic_rng = rand::thread_rng();
|
||||
let furniture = match self.noise.get(Vec3::new(
|
||||
center_offset.x,
|
||||
|
@ -836,7 +836,7 @@ impl Settlement {
|
||||
#[allow(clippy::eval_order_dependence)] // TODO: Pending review in #587
|
||||
pub fn apply_supplement<'a>(
|
||||
&'a self,
|
||||
// NOTE: Used only for dynamic elemens like chests and entities!
|
||||
// NOTE: Used only for dynamic elements like chests and entities!
|
||||
dynamic_rng: &mut impl Rng,
|
||||
wpos2d: Vec2<i32>,
|
||||
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
|
||||
|
Loading…
Reference in New Issue
Block a user