From 7aaa22cc8ba78114a6c7b4685754662e60b660c0 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Wed, 24 Mar 2021 16:03:40 -0400 Subject: [PATCH] Address MR 1987 review comments. --- server/src/rtsim/tick.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/server/src/rtsim/tick.rs b/server/src/rtsim/tick.rs index 8f5030ee15..c68d7a99b3 100644 --- a/server/src/rtsim/tick.rs +++ b/server/src/rtsim/tick.rs @@ -97,12 +97,12 @@ impl<'a> System<'a> for Sys { for id in to_reify { rtsim.reify_entity(id); let entity = &rtsim.entities[id]; + let body = entity.get_body(); let spawn_pos = terrain .find_space(entity.pos.map(|e| e.floor() as i32)) .map(|e| e as f32) - + Vec3::new(0.5, 0.5, 0.0); - let body = entity.get_body(); - let mut pos = comp::Pos(spawn_pos); + + Vec3::new(0.5, 0.5, body.flying_height()); + let pos = comp::Pos(spawn_pos); let agent = Some(comp::Agent::new( None, matches!(body, comp::Body::Humanoid(_)), @@ -112,15 +112,12 @@ impl<'a> System<'a> for Sys { )); let rtsim_entity = Some(RtSimEntity(id)); let event = match body { - comp::Body::Ship(ship) => { - pos.0 += Vec3::unit_z() * body.flying_height(); - ServerEvent::CreateShip { - pos, - ship, - mountable: false, - agent, - rtsim_entity, - } + comp::Body::Ship(ship) => ServerEvent::CreateShip { + pos, + ship, + mountable: false, + agent, + rtsim_entity, }, _ => ServerEvent::CreateNpc { pos: comp::Pos(spawn_pos),