add hirdrasil ornament variants and fix clippy

This commit is contained in:
Christof Petig 2023-12-16 12:10:17 +01:00
parent 611b55b279
commit 4b7f3d07d2
7 changed files with 27 additions and 10 deletions

BIN
assets/voxygen/voxel/sprite/furniture/hirdrasil-antler-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

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

Binary file not shown.

View File

@ -2240,6 +2240,16 @@ ChristmasOrnament: Some((
offset: (-5.5, 0.5, 0.0),
lod_axes: (1.0, 1.0, 1.0),
),
(
model: "voxygen.voxel.sprite.furniture.hirdrasil-antler",
offset: (-10.5, -2.5, -3.0),
lod_axes: (1.0, 1.0, 1.0),
),
(
model: "voxygen.voxel.sprite.furniture.hirdrasil-antler-1",
offset: (-6.5, -2.5, -3.0),
lod_axes: (1.0, 1.0, 1.0),
),
(
model: "voxygen.voxel.sprite.furniture.moravian-star-orange",
offset: (-5.5, -7.5, 0.0),

View File

@ -326,8 +326,11 @@ fn entity_drops(entity_config: &str) -> Result<(), Box<dyn Error>> {
asset_path: &str,
) -> Result<(), Box<dyn Error>> {
let entity_config = EntityConfig::load_expect(asset_path).read();
let entity_info = EntityInfo::at(Vec3::new(0.0, 0.0, 0.0))
.with_asset_expect(asset_path, &mut rand::thread_rng());
let entity_info = EntityInfo::at(Vec3::new(0.0, 0.0, 0.0)).with_asset_expect(
asset_path,
&mut rand::thread_rng(),
None,
);
let name = entity_info.name.unwrap_or_default();
// Create initial entry in drop table

View File

@ -102,8 +102,6 @@ impl ItemSpec {
// Check if ItemSpec is valid and can be turned into Item
#[cfg(test)]
fn validate(&self) -> Result<(), ValidationError> {
use itertools::Itertools;
let mut rng = rand::thread_rng();
match self {
ItemSpec::Item(item_asset) => Item::new_from_asset(item_asset)

View File

@ -270,18 +270,18 @@ pub fn get_sprite_instances<'a, I: 'a>(
.overflowing_add((wpos.x as u64).overflowing_mul(wpos.y as u64).0)
.0; // Awful PRNG
// % 4 is non uniform, take 7 and combine two where >0
// % 4 is non uniform, take 7 and combine two lesser probable outcomes
let ori = (block.get_ori().unwrap_or((((seed % 7) + 1) / 2) as u8 * 2)) & 0b111;
if !cfg.variations.is_empty() {
// try to make the variation more uniform as the PRNG is highly unfair
let variation = match cfg.variations.len() {
// try to make the variation more uniform as the PRNG is unfair
1 => 0,
2 => (seed as usize % 4) / 3,
3 => (seed as usize % 5) / 2,
4 => ((seed as usize % 7) + 1) / 2,
// for four use a different seed than for ori to not have them match always
4 => (((seed.overflowing_add(wpos.x as u64).0) as usize % 7) + 1) / 2,
_ => seed as usize % cfg.variations.len(),
};
// let variation = seed as usize % cfg.variations.len();
if sprite == SpriteKind::ChristmasOrnament {
println!("{sprite:?} {variation} {wpos:?} {seed}");
}

View File

@ -345,7 +345,7 @@ mod tests {
info!("Index created");
let mut sim = sim::WorldSim::generate(seed, opts, &threadpool, &|_| {});
info!("World loaded");
let _civs = crate::civ::Civs::generate(seed, &mut sim, &mut index, &|_| {});
let _civs = crate::civ::Civs::generate(seed, &mut sim, &mut index, None, &|_| {});
info!("Civs created");
crate::sim2::simulate(&mut index, &mut sim);
show_economy(&index.sites, &None);
@ -374,7 +374,7 @@ mod tests {
let mut names = None;
let regenerate_input = false;
if regenerate_input {
let _civs = crate::civ::Civs::generate(seed, &mut sim, &mut index, &|_| {});
let _civs = crate::civ::Civs::generate(seed, &mut sim, &mut index, None, &|_| {});
info!("Civs created");
let mut outarr: Vec<EconomySetup> = Vec::new();
for i in index.sites.values() {