mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add lots of wind sources at the western border of map and make them tweakable
This commit is contained in:
parent
91f96a57f5
commit
bcb62df809
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5962,6 +5962,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"hashbrown 0.11.2",
|
||||
"humantime",
|
||||
"inline_tweak",
|
||||
"itertools 0.10.0",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
|
@ -21,7 +21,7 @@ common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
world = { package = "veloren-world", path = "../world" }
|
||||
network = { package = "veloren-network", path = "../network", features = ["metrics", "compression", "quic"], default-features = false }
|
||||
|
||||
# inline_tweak = "1.0.8"
|
||||
inline_tweak = "1.0.8"
|
||||
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["shred-derive"], rev = "f985bec5d456f7b0dd8aae99848f9473c2cd9d46" }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "8be2abcddf8f524cb5876e8dd20a7e47cfaf7573" }
|
||||
|
@ -7,6 +7,7 @@ use common::{
|
||||
use common_ecs::{Job, Origin, Phase, System};
|
||||
use specs::{Read, Write};
|
||||
use vek::*;
|
||||
use rand::Rng;
|
||||
|
||||
/// This system updates the wind grid for the entire map
|
||||
#[derive(Default)]
|
||||
@ -20,18 +21,26 @@ impl<'a> System<'a> for Sys {
|
||||
const PHASE: Phase = Phase::Create;
|
||||
|
||||
fn run(_job: &mut Job<Self>, (dt, mut windsim): Self::SystemData) {
|
||||
let wind_sources: Vec<(Pos, Vel)> = vec![(
|
||||
Pos(Vec3 {
|
||||
x: 9999.0,
|
||||
y: 9599.0,
|
||||
z: 200.0,
|
||||
}),
|
||||
Vel(Vec3 {
|
||||
x: 100.0,
|
||||
y: 100.0,
|
||||
z: 500.0,
|
||||
}),
|
||||
)];
|
||||
let mut rng = rand::thread_rng();
|
||||
let wind_sources: Vec<(Pos, Vel)> = (0..1000)
|
||||
.map(|y| {
|
||||
let r1 = rng.gen_range(0.0..std::f32::consts::PI / 2.0);
|
||||
let r2 = rng.gen_range(0.0..std::f32::consts::PI / 2.0);
|
||||
let r = (r1 + r2) / 2.0;
|
||||
(
|
||||
Pos(Vec3 {
|
||||
x: inline_tweak::tweak!(5000.0),
|
||||
y: y as f32 * 32.0,
|
||||
z: inline_tweak::tweak!(200.0),
|
||||
}),
|
||||
Vel(Vec3 {
|
||||
x: inline_tweak::tweak!(30.0) * r.sin(),
|
||||
y: inline_tweak::tweak!(30.0) * r.cos(),
|
||||
z: inline_tweak::tweak!(30.0) * rng.gen_range(-0.25..0.25),
|
||||
}),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
windsim.tick(wind_sources, &dt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user