mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improved spawn rates of castles and cave monsters
This commit is contained in:
parent
85ed5ad356
commit
9cefaaa7af
@ -1,12 +1,12 @@
|
||||
[
|
||||
(25, Velorite),
|
||||
(35, VeloriteFrag),
|
||||
(20, Velorite),
|
||||
(30, VeloriteFrag),
|
||||
(60, Stones),
|
||||
(15, PurpleFlower),
|
||||
(150, ShortGrass),
|
||||
(80, Mushroom),
|
||||
(130, ShortGrass),
|
||||
(120, Mushroom),
|
||||
(8, ShinyGem),
|
||||
(5, Chest),
|
||||
(15, Chest),
|
||||
(2, Crate),
|
||||
(1, Scarecrow),
|
||||
(0.25, Scarecrow),
|
||||
]
|
||||
|
@ -90,9 +90,9 @@ impl Civs {
|
||||
|
||||
for _ in 0..INITIAL_CIV_COUNT * 3 {
|
||||
attempt(5, || {
|
||||
let (kind, size) = match ctx.rng.gen_range(0, 2) {
|
||||
0 => (SiteKind::Dungeon, 0),
|
||||
_ => (SiteKind::Castle, 3),
|
||||
let (kind, size) = match ctx.rng.gen_range(0, 8) {
|
||||
0 => (SiteKind::Castle, 3),
|
||||
_ => (SiteKind::Dungeon, 0),
|
||||
};
|
||||
let loc = find_site_loc(&mut ctx, None, size)?;
|
||||
this.establish_site(&mut ctx.reseed(), loc, |place| Site {
|
||||
|
@ -51,9 +51,18 @@ pub fn apply_scatter_to<'a>(
|
||||
None,
|
||||
)
|
||||
}),
|
||||
(Twigs, false, |c| ((c.tree_density - 0.5).max(0.0) * 0.0025, None)),
|
||||
(Stones, false, |c| ((c.rockiness - 0.5).max(0.0) * 0.005, None)),
|
||||
(ShortGrass, false, |c| (close(c.temp, 0.3, 0.4).min(close(c.humidity, 0.6, 0.35)) * 0.05, Some((48.0, 0.4)))),
|
||||
(Twigs, false, |c| {
|
||||
((c.tree_density - 0.5).max(0.0) * 0.0025, None)
|
||||
}),
|
||||
(Stones, false, |c| {
|
||||
((c.rockiness - 0.5).max(0.0) * 0.005, None)
|
||||
}),
|
||||
(ShortGrass, false, |c| {
|
||||
(
|
||||
close(c.temp, 0.3, 0.4).min(close(c.humidity, 0.6, 0.35)) * 0.05,
|
||||
Some((48.0, 0.4)),
|
||||
)
|
||||
}),
|
||||
(MediumGrass, false, |c| {
|
||||
(
|
||||
close(c.temp, 0.0, 0.6).min(close(c.humidity, 0.6, 0.35)) * 0.05,
|
||||
@ -89,26 +98,30 @@ pub fn apply_scatter_to<'a>(
|
||||
|
||||
let underwater = col_sample.water_level > col_sample.alt;
|
||||
|
||||
let bk = scatter.iter().enumerate().find_map(|(i, (bk, is_underwater, f))| {
|
||||
let (density, patch) = f(chunk);
|
||||
if density <= 0.0
|
||||
|| patch
|
||||
.map(|(wavelen, threshold)| {
|
||||
index.noise.scatter_nz.get(
|
||||
wpos2d
|
||||
.map(|e| e as f64 / wavelen as f64 + i as f64 * 43.0)
|
||||
.into_array(),
|
||||
) < threshold as f64
|
||||
})
|
||||
.unwrap_or(false)
|
||||
|| !RandomField::new(i as u32).chance(Vec3::new(wpos2d.x, wpos2d.y, 0), density)
|
||||
|| underwater != *is_underwater
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some(*bk)
|
||||
}
|
||||
});
|
||||
let bk = scatter
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find_map(|(i, (bk, is_underwater, f))| {
|
||||
let (density, patch) = f(chunk);
|
||||
if density <= 0.0
|
||||
|| patch
|
||||
.map(|(wavelen, threshold)| {
|
||||
index.noise.scatter_nz.get(
|
||||
wpos2d
|
||||
.map(|e| e as f64 / wavelen as f64 + i as f64 * 43.0)
|
||||
.into_array(),
|
||||
) < threshold as f64
|
||||
})
|
||||
.unwrap_or(false)
|
||||
|| !RandomField::new(i as u32)
|
||||
.chance(Vec3::new(wpos2d.x, wpos2d.y, 0), density)
|
||||
|| underwater != *is_underwater
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some(*bk)
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(bk) = bk {
|
||||
let mut z = col_sample.alt as i32 - 4;
|
||||
@ -287,10 +300,10 @@ pub fn apply_caves_to<'a>(
|
||||
}
|
||||
|
||||
let cave_depth = (col_sample.alt - cave.alt).max(0.0);
|
||||
let difficulty = cave_depth / 200.0;
|
||||
let difficulty = cave_depth / 100.0;
|
||||
|
||||
// Scatter things in caves
|
||||
if RandomField::new(index.seed).chance(wpos2d.into(), 0.002 * difficulty)
|
||||
if RandomField::new(index.seed).chance(wpos2d.into(), 0.002 * difficulty.powf(1.5))
|
||||
&& cave_base < surface_z as i32 - 25
|
||||
{
|
||||
let kind = *assets::load_expect::<Lottery<BlockKind>>("common.cave_scatter")
|
||||
@ -343,7 +356,7 @@ pub fn apply_caves_supplement<'a>(
|
||||
let difficulty = cave_depth / 200.0;
|
||||
|
||||
// Scatter things in caves
|
||||
if RandomField::new(index.seed).chance(wpos2d.into(), 0.0001 * difficulty)
|
||||
if RandomField::new(index.seed).chance(wpos2d.into(), 0.00005 * difficulty)
|
||||
&& cave_base < surface_z as i32 - 40
|
||||
{
|
||||
let entity = EntityInfo::at(Vec3::new(
|
||||
|
@ -230,7 +230,14 @@ impl World {
|
||||
}
|
||||
|
||||
// Apply layer supplement
|
||||
layer::apply_caves_supplement(&mut rng, chunk_wpos2d, sample_get, &chunk, &self.index, &mut supplement);
|
||||
layer::apply_caves_supplement(
|
||||
&mut rng,
|
||||
chunk_wpos2d,
|
||||
sample_get,
|
||||
&chunk,
|
||||
&self.index,
|
||||
&mut supplement,
|
||||
);
|
||||
|
||||
// Apply site supplementary information
|
||||
sim_chunk.sites.iter().for_each(|site| {
|
||||
|
Loading…
Reference in New Issue
Block a user