fix
This commit is contained in:
@@ -22,7 +22,7 @@ use rand::{RngExt, SeedableRng};
|
||||
pub fn task_executor_system(
|
||||
mut commands: Commands,
|
||||
tilemap: Res<TileMap>,
|
||||
time: Res<Time>,
|
||||
mut rng_q: Query<&mut WyRand, With<GlobalRng>>,
|
||||
mut query: Query<(
|
||||
Entity,
|
||||
&mut TaskQueue,
|
||||
@@ -34,21 +34,17 @@ pub fn task_executor_system(
|
||||
mut completed_writer: MessageWriter<TaskCompleted>,
|
||||
mut failed_writer: MessageWriter<TaskFailed>,
|
||||
) {
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
let mut hasher = DefaultHasher::new();
|
||||
crate::constants::SEED.hash(&mut hasher);
|
||||
time.elapsed_secs().to_bits().hash(&mut hasher);
|
||||
let seed = hasher.finish();
|
||||
let mut rng = WyRand::seed_from_u64(seed);
|
||||
let Ok(mut rng) = rng_q.single_mut() else {
|
||||
return;
|
||||
};
|
||||
|
||||
for (entity, mut queue, mut state, mut ambulatory, transform) in query.iter_mut() {
|
||||
// If queue empty, assign default Idle task
|
||||
if queue.is_empty() {
|
||||
let origin = (transform.translation / ITILE_SIZE as f32).as_ivec3();
|
||||
let origin = transform.translation.as_ivec3();
|
||||
queue.push(Task::Idle {
|
||||
target: origin,
|
||||
wander_radius: 10,
|
||||
wander_radius: 64,
|
||||
origin,
|
||||
});
|
||||
}
|
||||
@@ -134,7 +130,7 @@ pub fn task_executor_system(
|
||||
let origin = (transform.translation / ITILE_SIZE as f32).as_ivec3();
|
||||
queue.push(Task::Idle {
|
||||
target: origin,
|
||||
wander_radius: 10,
|
||||
wander_radius: 64,
|
||||
origin,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user