More block particles, changes ore vein colour

This commit is contained in:
Joshua Barretto 2021-06-22 14:04:58 +01:00
parent 28ee668dc0
commit 347a9e1fbf
6 changed files with 56 additions and 43 deletions

View File

@ -65,7 +65,7 @@
dirt: (69, 48, 15),
scaffold: (195, 190, 212),
lava: (184, 39, 0),
vein: (222, 140, 39),
vein: (61, 229, 198),
),
site: (
castle: (),

View File

@ -568,6 +568,11 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageDecoding for TriPngEncoding<AVERAGE_
g: 132,
b: 145,
},
GlowingRock => Rgb {
r: 61,
g: 229,
b: 198,
},
Grass => Rgb {
r: 51,
g: 160,

View File

@ -36,7 +36,7 @@ make_case_elim!(
// being *very* fast).
Rock = 0x10,
WeakRock = 0x11, // Explodable
Lava = 0x12,
Lava = 0x12, // TODO: Reevaluate whether this should be in the rock section
GlowingRock = 0x13,
// 0x12 <= x < 0x20 is reserved for future rocks
Grass = 0x20, // Note: *not* the same as grass sprites
@ -166,38 +166,40 @@ impl Block {
#[inline]
pub fn get_glow(&self) -> Option<u8> {
if matches!(self.kind, BlockKind::Lava | BlockKind::GlowingRock) {
return Some(24);
}
match self.get_sprite()? {
SpriteKind::StreetLamp | SpriteKind::StreetLampTall => Some(24),
SpriteKind::Ember => Some(20),
SpriteKind::WallLamp
| SpriteKind::WallLampSmall
| SpriteKind::WallSconce
| SpriteKind::FireBowlGround
| SpriteKind::Orb => Some(16),
SpriteKind::Velorite | SpriteKind::VeloriteFrag | SpriteKind::CeilingMushroom => {
Some(6)
match self.kind() {
BlockKind::Lava => Some(24),
BlockKind::GlowingRock => Some(12),
_ => match self.get_sprite()? {
SpriteKind::StreetLamp | SpriteKind::StreetLampTall => Some(24),
SpriteKind::Ember => Some(20),
SpriteKind::WallLamp
| SpriteKind::WallLampSmall
| SpriteKind::WallSconce
| SpriteKind::FireBowlGround
| SpriteKind::Orb => Some(16),
SpriteKind::Velorite
| SpriteKind::VeloriteFrag
| SpriteKind::Cauldron
| SpriteKind::CeilingMushroom => Some(6),
SpriteKind::CaveMushroom
| SpriteKind::CookingPot
| SpriteKind::CrystalHigh
| SpriteKind::CrystalLow => Some(10),
SpriteKind::Amethyst
| SpriteKind::Ruby
| SpriteKind::Sapphire
| SpriteKind::Diamond
| SpriteKind::Emerald
| SpriteKind::Topaz
| SpriteKind::AmethystSmall
| SpriteKind::TopazSmall
| SpriteKind::DiamondSmall
| SpriteKind::RubySmall
| SpriteKind::EmeraldSmall
| SpriteKind::SapphireSmall => Some(3),
SpriteKind::Lantern => Some(24),
_ => None,
},
SpriteKind::CaveMushroom
| SpriteKind::CookingPot
| SpriteKind::CrystalHigh
| SpriteKind::CrystalLow => Some(10),
SpriteKind::Amethyst
| SpriteKind::Ruby
| SpriteKind::Sapphire
| SpriteKind::Diamond
| SpriteKind::Emerald
| SpriteKind::Topaz
| SpriteKind::AmethystSmall
| SpriteKind::TopazSmall
| SpriteKind::DiamondSmall
| SpriteKind::RubySmall
| SpriteKind::EmeraldSmall
| SpriteKind::SapphireSmall => Some(3),
SpriteKind::Lantern => Some(24),
_ => None,
}
}

View File

@ -1,4 +1,4 @@
#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch
#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch
use crate::{
mesh::{
@ -463,11 +463,12 @@ fn should_draw_greedy(
) -> Option<(bool, FaceKind)> {
let from = flat_get(pos - delta);
let to = flat_get(pos);
let from_opaque = from.is_opaque();
if from_opaque == to.is_opaque() {
// Don't use `is_opaque`, because it actually refers to light transmission
let from_filled = from.is_filled();
if from_filled == to.is_filled() {
// Check the interface of liquid and non-tangible non-liquid (e.g. air).
let from_liquid = from.is_liquid();
if from_liquid == to.is_liquid() || from.is_opaque() || to.is_opaque() {
if from_liquid == to.is_liquid() || from.is_filled() || to.is_filled() {
None
} else {
// While liquid is not culled, we still try to keep a consistent orientation as
@ -476,11 +477,11 @@ fn should_draw_greedy(
Some((from_liquid, FaceKind::Fluid))
}
} else {
// If going from transparent to opaque, backward facing; otherwise, forward
// If going from unfilled to filled, backward facing; otherwise, forward
// facing. Also, if either from or to is fluid, set the meta accordingly.
Some((
from_opaque,
FaceKind::Opaque(if from_opaque {
from_filled,
FaceKind::Opaque(if from_filled {
to.is_liquid()
} else {
from.is_liquid()

View File

@ -89,6 +89,9 @@ impl BlocksOfInterest {
{
river.push(pos)
},
BlockKind::Lava if thread_rng().gen_range(0..5) == 0 => {
fires.push(pos + Vec3::unit_z())
},
BlockKind::Snow if thread_rng().gen_range(0..16) == 0 => snow.push(pos),
_ => match block.get_sprite() {
Some(SpriteKind::Ember) => {
@ -100,7 +103,7 @@ impl BlocksOfInterest {
Some(SpriteKind::StreetLamp) => fire_bowls.push(pos + Vec3::unit_z() * 2),
Some(SpriteKind::FireBowlGround) => fire_bowls.push(pos + Vec3::unit_z()),
Some(SpriteKind::StreetLampTall) => {
fire_bowls.push(pos + Vec3::unit_z() * 4)
fire_bowls.push(pos + Vec3::unit_z() * 3);
},
Some(SpriteKind::WallSconce) => fire_bowls.push(pos + Vec3::unit_z()),
Some(SpriteKind::Beehive) => beehives.push(pos),
@ -134,12 +137,14 @@ impl BlocksOfInterest {
interactables.push((pos, Interaction::Craft(CraftingTab::All)))
},
Some(SpriteKind::Cauldron) => {
fires.push(pos);
interactables.push((pos, Interaction::Craft(CraftingTab::Potion)))
},
Some(SpriteKind::Anvil) => {
interactables.push((pos, Interaction::Craft(CraftingTab::Weapon)))
},
Some(SpriteKind::CookingPot) => {
fires.push(pos);
interactables.push((pos, Interaction::Craft(CraftingTab::Food)))
},
_ => {},

View File

@ -253,7 +253,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) {
canvas.set(
Vec3::new(wpos2d.x, wpos2d.y, z),
Block::new(
BlockKind::WeakRock,
BlockKind::GlowingRock,
noisy_color(info.index().colors.layer.vein.into(), 16),
),
);
@ -265,7 +265,7 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) {
canvas.set(
Vec3::new(wpos2d.x, wpos2d.y, z),
Block::new(
BlockKind::WeakRock,
BlockKind::GlowingRock,
noisy_color(info.index().colors.layer.vein.into(), 16),
),
);