From: Ian Jackson Date: Mon, 5 Jul 2021 22:09:42 +0000 (+0100) Subject: api: Allow setz to strictly lower an occulter X-Git-Tag: otter-0.7.2~263 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=053ebbdce59513d65c45a284683cf52ebd94919a;p=otter.git 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 --- 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,