From 053ebbdce59513d65c45a284683cf52ebd94919a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 5 Jul 2021 23:09:42 +0100 Subject: [PATCH] api: Allow setz to strictly lower an occulter This will be useful for various things, including in particular recovering from things stuck under occulters, and making the UI "b" work properly. Signed-off-by: Ian Jackson --- daemon/api.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/api.rs b/daemon/api.rs index 6b62f955..db4636a2 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -450,7 +450,9 @@ api_route!{ fn op(&self, a: ApiPieceOpArgs) -> PieceUpdate { let ApiPieceOpArgs { gs,piece, .. } = a; let gpc = gs.pieces.byid_mut(piece).unwrap(); - if gpc.occult.is_active() { throw!(OE::Occultation) } + if gpc.occult.is_active() { + if self.z >= gpc.zlevel.z { throw!(OE::Occultation) } + } gpc.zlevel = ZLevel { z: self.z.clone(), zg: gs.gen }; let update = PieceUpdateOp::SetZLevel(()); (WhatResponseToClientOp::Predictable, -- 2.30.2