From: Ian Jackson Date: Wed, 27 Apr 2022 21:46:17 +0000 (+0100) Subject: script: piece_raise: allow overriding the actual implementation X-Git-Tag: otter-1.1.0~421 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ece8729e3f821017770926774bdd85b758432131;p=otter.git script: piece_raise: allow overriding the actual implementation We're going to need to do something else for multigrab. Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index e55185a2..25f8162a 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -887,13 +887,18 @@ function raise_targets(uo: UoRecord) { } function piece_raise(piece: PieceId, p: PieceInfo, - new_held_us_raising: HeldUsRaising) { + new_held_us_raising: HeldUsRaising, + implement: (piece: PieceId, p: PieceInfo, z: ZCoord) => void + = function(piece: PieceId, p: PieceInfo, z: ZCoord) { + api_piece("setz", piece,p, { z: z }); + }) +{ p.held_us_raising = new_held_us_raising; piece_set_zlevel(piece,p, (oldtop_piece) => { let oldtop_p = pieces[oldtop_piece]!; let z = wasm_bindgen.increment(oldtop_p.z); p.z = z; - api_piece("setz", piece,p, { z: z }); + implement(piece,p,z); }); }