From de8cb49a3b9f18a702c06a3ea4282d2786226fef Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 6 Jul 2021 01:42:37 +0100 Subject: [PATCH] script: bind 't' to new explicit raise feature Signed-off-by: Ian Jackson --- templates/script.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/templates/script.ts b/templates/script.ts index dc4d012e..d6a7acfb 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -337,6 +337,13 @@ function recompute_keybindings() { opname: "lower", desc: "send to bottom (below other pieces)", }); + add_uo(all_targets, { + def_key: 't', + kind: 'Client', + wrc: 'Predictable', + opname: "raise", + desc: "raise to top", + }); } if (all_targets.length) { let got = 0; @@ -803,6 +810,16 @@ function pin_unpin(uo: UoRecord, newpin: boolean) { // ----- raising ----- +keyops_local['raise'] = function (uo: UoRecord) { raise_targets(uo); } + +function raise_targets(uo: UoRecord) { + for (let piece of uo.targets!) { + let p = pieces[piece]!; + if (p.pinned || !piece_moveable(p)) continue; + piece_raise(piece, p, "NotYet"); + } +} + function piece_raise(piece: PieceId, p: PieceInfo, new_held_us_raising: HeldUsRaising) { p.held_us_raising = new_held_us_raising; -- 2.30.2