From: Ian Jackson Date: Tue, 6 Jul 2021 00:57:05 +0000 (+0100) Subject: script: raise: log a message when nothing oculd be raised X-Git-Tag: otter-0.7.2~248 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=32d018e043330ddb4b893ef97380c3bd670ae159;p=otter.git script: raise: log a message when nothing oculd be raised Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index d6a7acfb..d8cd1b0c 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -813,11 +813,16 @@ function pin_unpin(uo: UoRecord, newpin: boolean) { keyops_local['raise'] = function (uo: UoRecord) { raise_targets(uo); } function raise_targets(uo: UoRecord) { + let any = false; for (let piece of uo.targets!) { let p = pieces[piece]!; if (p.pinned || !piece_moveable(p)) continue; + any = true; piece_raise(piece, p, "NotYet"); } + if (!any) { + add_log_message('No pieces could be raised.'); + } } function piece_raise(piece: PieceId, p: PieceInfo,