From 5d9181319296bfa7482a764881b598526adb1469 Mon Sep 17 00:00:00 2001 From: Jason Reed Date: Sun, 10 Dec 2023 18:11:17 -0500 Subject: [PATCH] Fix dynamite tool (fix #108) --- src/core/intent.ts | 3 +-- src/core/state-helpers.ts | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/intent.ts b/src/core/intent.ts index 1bd5690..232470d 100644 --- a/src/core/intent.ts +++ b/src/core/intent.ts @@ -26,8 +26,7 @@ export type Intent = ; function dynamiteableCell(cell: CellContents): boolean { - // XXX more things should be dynamiteable (#108) - return cell.t == 'tile' || (cell.t == 'bonus' && cell.bonus.t == 'block'); + return cell.t == 'tile' || (cell.t == 'bonus' && (cell.bonus.t != 'empty')); } export function getIntentOfMouseDown(tool: Tool, wp: WidgetPoint, button: number, mods: Set, hoverCell: CellContents, pinned: boolean): Intent { diff --git a/src/core/state-helpers.ts b/src/core/state-helpers.ts index a99071c..7a53b9b 100644 --- a/src/core/state-helpers.ts +++ b/src/core/state-helpers.ts @@ -200,7 +200,8 @@ export function checkValid(state: CoreState): CoreState { s.animations = animations; // XXX: is this the right place to do this? - s.currentTool = 'pointer'; + if (state.currentTool != 'dynamite') + s.currentTool = 'pointer'; }); }