From ba3367615ff6854114cca02823430974d8aa1bef Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 5 Jul 2021 23:17:17 +0100 Subject: [PATCH] script: When lowering, avoid raising It can happen that the z of the piece which sets the z_top for the end of the plan (with z_bot == null) will cause the first lowered piece to actually be raised. This is particularly troublesome if the piece is an occulting one, which the server will not allowe to be raised. Handle this case specially: if necessary, set the z_top to top piece of that plan entry. Signed-off-by: Ian Jackson --- templates/script.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/script.ts b/templates/script.ts index e069f04d..933781b5 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -741,6 +741,11 @@ function lower_pieces(targets_todo: LowerTodoList): for (const pe of plan) { if (pe.z_top != null) z_top = pe.z_top; let z_bot = pe.z_bot; + if (pe.content.length != 0 && z_bot == null) { + let first_z = pe.content[0].p.z; + if (z_top >= first_z) + z_top = first_z; + } let zrange = wasm_bindgen.range(z_bot, z_top, pe.content.length); console.log('LOQER PLAN PE', pe, z_bot, z_top, pe.content.length, zrange.debug()); -- 2.30.2