From f530753d19fe7c013550e03c33dbff801472a7c7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Mar 2021 01:08:02 +0000 Subject: [PATCH] occult: Prevent restacking of occulting pieces (servr) Signed-off-by: Ian Jackson --- daemon/api.rs | 2 +- templates/script.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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(); } -- 2.30.2