Merge branch 'uniior/barrels' into 'master'

Crate and Barrel sprites

See merge request veloren/veloren!4210
This commit is contained in:
flo 2023-12-17 16:17:14 +00:00
commit f075b1d654
5 changed files with 61 additions and 1 deletions

BIN
assets/voxygen/voxel/sprite/furniture/barrel.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/sprite/furniture/crate_block.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -4609,4 +4609,24 @@ HotSurface: Some((
variations: [],
wind_sway: 0.0,
)),
Barrel: Some((
variations: [
(
model: "voxygen.voxel.sprite.furniture.barrel",
offset: (-4.5, -4.5, 0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
CrateBlock: Some((
variations: [
(
model: "voxygen.voxel.sprite.furniture.crate_block",
offset: (-5.5, -5.5, 0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
}

View File

@ -268,6 +268,8 @@ make_case_elim!(
Quench0 = 0xEF,
IronSpike = 0xF0,
HotSurface = 0xF1,
Barrel = 0xF2,
CrateBlock = 0xF3,
}
);
@ -419,6 +421,8 @@ impl SpriteKind {
SpriteKind::GearWheel0 => 3.0 / 11.0,
SpriteKind::Quench0 => 8.0 / 11.0,
SpriteKind::HotSurface => 0.01,
SpriteKind::Barrel => 1.0,
SpriteKind::CrateBlock => 1.0,
_ => return None,
})
}

View File

@ -1,5 +1,9 @@
use super::*;
use crate::{site2::gen::PrimitiveTransform, Land};
use crate::{
site2::gen::PrimitiveTransform,
util::{RandomField, Sampler},
Land,
};
use common::terrain::{Block, BlockKind, SpriteKind};
use rand::prelude::*;
use std::f32::consts::PI;
@ -694,5 +698,31 @@ impl Structure for AirshipDock {
})
.rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base))
.fill(sprite_fill.clone());
// crate and barrel sprites
let mut sprite_positions = vec![];
for a in 0..5 {
sprite_positions.push(Vec2::new(center.x + 1 + a, center.y + 2));
}
for b in 0..=1 {
sprite_positions.push(Vec2::new(center.x, center.y + 3 + b));
}
for sprite_pos in sprite_positions {
let rows = (RandomField::new(0).get(sprite_pos.with_z(base)) % 3) as i32;
for r in 0..rows {
painter
.aabb(Aabb {
min: sprite_pos.with_z(height + 10 + r),
max: (sprite_pos + 1).with_z(height + 11 + r),
})
.rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base))
.fill(Fill::Block(Block::air(
match (RandomField::new(0).get(sprite_pos.with_z(base + r)) % 2) as i32 {
0 => SpriteKind::Barrel,
_ => SpriteKind::CrateBlock,
},
)));
}
}
}
}