From: Ian Jackson Date: Mon, 15 Mar 2021 01:08:02 +0000 (+0000) Subject: occult: Prevent restacking of occulting pieces (servr) X-Git-Tag: otter-0.4.0~35 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f530753d19fe7c013550e03c33dbff801472a7c7;p=otter.git occult: Prevent restacking of occulting pieces (servr) Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 11971129..54ac9947 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -363,9 +363,9 @@ api_route!{ as: #[throws(ApiPieceOpError)] fn op(&self, a: ApiPieceOpArgs) -> PieceUpdate { - // xxx prevent restzcking anything that is occulting let ApiPieceOpArgs { gs,piece, .. } = a; let gpc = gs.pieces.byid_mut(piece).unwrap(); + if gpc.occult.is_active() { throw!(OE::Occultation) } gpc.zlevel = ZLevel { z: self.z.clone(), zg: gs.gen }; let update = PieceUpdateOp::SetZLevel(()); (WhatResponseToClientOp::Predictable, diff --git a/templates/script.ts b/templates/script.ts index 9ba638bb..f167d67e 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -719,6 +719,7 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) { drag_add_piece(tpiece,tp); } } else if (held == null || wresting) { + // xxx prevent clicking on anything that is occulting, unless wresting if (!shifted) { ungrab_all(); }