From: Ian Jackson Date: Tue, 30 Mar 2021 23:24:54 +0000 (+0100) Subject: script: Handle piece deletion X-Git-Tag: otter-0.5.0~341 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4688402a860707191245d4060bca25d640707b0c;p=otter.git script: Handle piece deletion Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 46fc96d8..9c844cae 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -1093,6 +1093,17 @@ pieceops.Modify = function piece_modify(piece, p, info, false); } +pieceops.Delete = function +(piece: PieceId, p: PieceInfo, info: {}) { + console.log('PIECE UPDATE DELETE ', piece) + p.uelem.remove(); + p.delem.remove(); + delete pieces[piece]; + if (p.held == us) { + recompute_keybindings(); + } +} + piece_error_handlers.PosOffTable = function() { return true ; } piece_error_handlers.Conflict = function()