Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure there is a line of sight #114

Open
github-actions bot opened this issue Jan 4, 2024 · 0 comments
Open

ensure there is a line of sight #114

github-actions bot opened this issue Jan 4, 2024 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jan 4, 2024

ensure there is a line of sight

loop {

sleep_ticks(&mut server_msg_rcvr, 1).await;

let chunk = self_position.chunk_column();

let player_positions = h.world.observe_entities(chunk, |entity| {

let network_entity = entity.to_network().unwrap();

TryAsEntityRef::<Player>::try_as_entity_ref(entity).map(|player| {

(player.get_entity().position.clone(), network_entity)

})

}).await;

let target_object = CollisionShape {

x1: target_position.x - network_entity.width() as f64 / 2.0,

y1: target_position.y,

z1: target_position.z - network_entity.width() as f64 / 2.0,

x2: target_position.x + network_entity.width() as f64 / 2.0,

y2: target_position.y + network_entity.height() as f64,

z2: target_position.z + network_entity.width() as f64 / 2.0,

};

let mut translation = Translation {

x: target_position.x - self_position.x,

y: target_position.y - self_position.y,

z: target_position.z - self_position.z,

};

translation.set_norm(ZOMBIE_SPEED);

e.get_entity_mut().position += authorized_translation;

(e.get_entity().position.clone(), EntityChanges::position())

}).await;

self_position = match new_pos {

Some(pos) => pos,

None => break,

};

// TODO: ensure there is a line of sight

@github-actions github-actions bot added the todo label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants