From: Ian Jackson Date: Tue, 6 Jul 2021 00:42:37 +0000 (+0100) Subject: script: bind 't' to new explicit raise feature X-Git-Tag: otter-0.7.2~249 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=de8cb49a3b9f18a702c06a3ea4282d2786226fef;p=otter.git script: bind 't' to new explicit raise feature Signed-off-by: Ian Jackson --- 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;