From 737b5761f6aaa088c88778e4aa737fc9f8f6731a Mon Sep 17 00:00:00 2001 From: Uniior Date: Sun, 17 Dec 2023 16:17:14 +0000 Subject: [PATCH] Crate and Barrel sprites --- .../voxygen/voxel/sprite/furniture/barrel.vox | 3 ++ .../voxel/sprite/furniture/crate_block.vox | 3 ++ assets/voxygen/voxel/sprite_manifest.ron | 20 ++++++++++++ common/src/terrain/sprite.rs | 4 +++ world/src/site2/plot/airship_dock.rs | 32 ++++++++++++++++++- 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 assets/voxygen/voxel/sprite/furniture/barrel.vox create mode 100644 assets/voxygen/voxel/sprite/furniture/crate_block.vox diff --git a/assets/voxygen/voxel/sprite/furniture/barrel.vox b/assets/voxygen/voxel/sprite/furniture/barrel.vox new file mode 100644 index 0000000000..78858b9262 --- /dev/null +++ b/assets/voxygen/voxel/sprite/furniture/barrel.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e5bf9f6b005a46ec55e2155434257c783020e5eb62f2f9ea582a3801f9a14e8 +size 3416 diff --git a/assets/voxygen/voxel/sprite/furniture/crate_block.vox b/assets/voxygen/voxel/sprite/furniture/crate_block.vox new file mode 100644 index 0000000000..ec905a9392 --- /dev/null +++ b/assets/voxygen/voxel/sprite/furniture/crate_block.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab958279e6c8b97055721ac2cce177614c591e62cf12a606af2a76def0090b13 +size 5700 diff --git a/assets/voxygen/voxel/sprite_manifest.ron b/assets/voxygen/voxel/sprite_manifest.ron index 8566f8668c..0499ed9713 100644 --- a/assets/voxygen/voxel/sprite_manifest.ron +++ b/assets/voxygen/voxel/sprite_manifest.ron @@ -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, +)), } diff --git a/common/src/terrain/sprite.rs b/common/src/terrain/sprite.rs index 89e02d8950..381f9eb279 100644 --- a/common/src/terrain/sprite.rs +++ b/common/src/terrain/sprite.rs @@ -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, }) } diff --git a/world/src/site2/plot/airship_dock.rs b/world/src/site2/plot/airship_dock.rs index 36ed15f3c7..5fa4e998f3 100644 --- a/world/src/site2/plot/airship_dock.rs +++ b/world/src/site2/plot/airship_dock.rs @@ -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, + }, + ))); + } + } } }