Compare commits

..
Author SHA1 Message Date
Ratdoku Builder 77ff5b48de chore(release): v0.4.3-alpha
Bump version name to 0.4.3 and Android version code to 7. Document double-tap as the default and the one-time save migration.
2026-12-02 22:10:29 -06:00
Ratdoku Builder 82c5691d2e feat(input): make double-tap placement the default
New saves start in double-tap mode. Version 1 saves migrate once to double-tap and are rewritten as version 2, while the settings toggle still persists a later choice. Smoke tests now force hold mode for their hold checks; UI tests cover the fresh default and the migration.
2026-12-02 22:10:27 -06:00
Ratdoku Builder 15e79ae38c chore(release): v0.4.2-alpha
Bump version name to 0.4.2 and Android version code to 6. Document the scroll pass-through fix.
2026-12-02 20:32:24 -06:00
Ratdoku Builder d679a12e1d fix(input): let swipes reach scroll containers
Godot ScrollContainer only receives drag gestures when the controls under the finger pass them through. Guest Book cards, House Rules rows, and Settings rows now use PASS, so swiping scrolls while taps, toggles, sliders, and buttons still work. The tutorial board keeps its own input.
2026-12-02 20:32:23 -06:00
Ratdoku Builder dffdee63a6 chore(release): v0.4.1-alpha
Bump version name to 0.4.1 and Android version code to 5. Document the Guest Book guards and double-tap placement setting.
2026-12-02 20:10:45 -06:00
Ratdoku Builder af4951baf8 feat(input): guard Guest Book taps and add double-tap placement
Guest Book: only open a card on a short stationary tap, ignore drags and flings, and guard the detail Close button after opening. Board: add a persisted double-tap placement mode with deferred single taps, while hold stays the default and right-click works in both modes.
2026-12-02 20:10:44 -06:00
Ratdoku Builder bed81a2e05 docs: add v0.4.0-alpha release links 2026-12-02 10:56:21 -06:00
14 changed files with 489 additions and 28 deletions

No files matched your search

+30
View File
@@ -2,6 +2,36 @@
All notable alpha milestones for Ratdoku. All notable alpha milestones for Ratdoku.
## v0.4.3-alpha — Tap Twice
- Double-tap placement is now the default: tap marks X, two quick taps on the same cell check a guest in or out.
- Existing version 1 saves migrate once to double-tap. Turning **Double-tap to place** off restores hold-to-place and keeps that choice.
- Right-click still places guests in both modes.
- Android debug APK rebuilt at version `0.4.3` (version code 7).
## v0.4.2-alpha — Swipe & Scroll
- Finger swipes now scroll the Guest Book even when they start on a card.
- House Rules content passes swipes through labels and buttons, so the page scrolls anywhere outside the practice board.
- Settings rows pass swipes through too, keeping every row scrollable while toggles, sliders, and buttons still tap normally.
- Android debug APK rebuilt at version `0.4.2` (version code 6).
## v0.4.1-alpha — Front Desk Polish
- Guest Book cards only open on a short, stationary tap; dragging or flinging the list scrolls without opening a card.
- The detail sheet ignores Close for a moment after opening, so the opening tap cannot dismiss it.
- New **Double-tap to place** setting: tap marks X, two quick taps on the same cell check a guest in or out.
- Hold remains the default; right-click places guests in both modes, and the hold-time slider dims in double-tap mode.
- Home, House Rules, and the in-level hints follow the active placement mode.
- Android debug APK rebuilt at version `0.4.1` (version code 5).
## v0.4.0-alpha — Lobby Redesign
- 360×640 dp layout with safe-area spacing on mobile.
- Playful rounded-tile board, eight room motifs, and a per-level room legend.
- Guest Book, Settings sheet, and Home restyled; in-level settings keeps Resume primary.
- Smoke and UI tests updated; Android debug APK at version `0.4.0` (version code 4).
## v0.3.0-alpha — Thirty Rooms & Unique Guests ## v0.3.0-alpha — Thirty Rooms & Unique Guests
- 30 verified 8×8 rooms: 20 guest rooms plus 10 bonus rooms. - 30 verified 8×8 rooms: 20 guest rooms plus 10 bonus rooms.
+23 -11
View File
@@ -13,8 +13,9 @@ The project uses a portrait **360×640 dp canvas**, scaled to a 540×960 desktop
## How to play ## How to play
- **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it. - **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it.
- **Press and hold** (mobile) or **right-click** (PC) to check a guest in. Hold or right-click a guest to check them out. - **Double-tap** a cell to check a guest in or out. **Double-tap is on by default.**
- A gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed. - Prefer holding? Turn off **Double-tap to place** in Settings, then **press and hold** (mobile) or **right-click** (PC) to check a guest in. Right-click keeps working in both modes.
- In hold mode, a gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed.
- **Undo** and **Hint** are at the bottom. **Restart room** and **Back to lobby** live in the in-level settings sheet. - **Undo** and **Hint** are at the bottom. **Restart room** and **Back to lobby** live in the in-level settings sheet.
- A **gold ring** around a guest means they are already checked in and cannot be moved. - A **gold ring** around a guest means they are already checked in and cannot be moved.
- Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally. - Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally.
@@ -30,14 +31,14 @@ The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains
- **Pattern mode is on by default.** Each room carries a distinct motif — paw, cheese, key, bed, bell, leaf, fish, star — drawn over the colour. Turn it off in Settings for flat colours. - **Pattern mode is on by default.** Each room carries a distinct motif — paw, cheese, key, bed, bell, leaf, fish, star — drawn over the colour. Turn it off in Settings for flat colours.
- A **room legend** above the board shows the eight guests for the level, one per region colour. Solved rooms get a gold ring. - A **room legend** above the board shows the eight guests for the level, one per region colour. Solved rooms get a gold ring.
- The **gear in the top-right opens settings over the puzzle**, so patterns, timer, motion, and hold time can change without leaving the room. **Resume** is the primary action; restarting is deliberately secondary. - The **gear in the top-right opens settings over the puzzle**, so patterns, timer, motion, and placement mode can change without leaving the room. **Resume** is the primary action; restarting is deliberately secondary.
## Screens ## Screens
- **Home** — top hub with Crumb avatar, guest progress, and settings; Continue/Check in; Guest Book; House Rules. - **Home** — top hub with Crumb avatar, guest progress, and settings; Continue/Check in; Guest Book; House Rules.
- **Game** — top bar, rule strip for the first three rooms, room legend, board, timer, undo/hint, in-level settings, win overlay. - **Game** — top bar, rule strip for the first three rooms, room legend, board, timer, undo/hint, in-level settings, win overlay.
- **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number. - **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number. Tapping a card opens a detail sheet; swiping anywhere in the gallery scrolls it, including over cards.
- **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, hold time, how to play, restart/back, reset progress. - **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, double-tap placement (on by default), hold time, how to play, restart/back, reset progress.
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board. - **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
## Unlocks ## Unlocks
@@ -142,12 +143,12 @@ build/Ratdoku.apk
It is a **debug-signed, arm64-v8a** APK: It is a **debug-signed, arm64-v8a** APK:
- Package: `com.ratdoku.game` - Package: `com.ratdoku.game`
- Version: `0.4.0` (version code 4) - Version: `0.4.3` (version code 7)
- Min SDK: 24 (Android 7.0) - Min SDK: 24 (Android 7.0)
- Target SDK: 36 - Target SDK: 36
- Size: about 41 MB - Size: about 41 MB
- Portrait orientation - Portrait orientation
- Build label: `v0.4.0-alpha · build 2026-12-02` - Build label: `v0.4.3-alpha · build 2026-12-02`
To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging: To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging:
@@ -184,11 +185,11 @@ If you want a Play Store build, switch `gradle_build/export_format` to AAB, use
--headless --path . --script res://tools/ui_test.gd --headless --path . --script res://tools/ui_test.gd
``` ```
`ui_test.gd` checks settings propagation, room-1 → Pepper unlock, gallery progress, and the interactive 5×5 tutorial. Both tests reset the save when they finish. `ui_test.gd` checks the double-tap default and version 1 migration, settings propagation, hold/double-tap placement, tap-vs-drag guards in the Guest Book, scroll pass-through over cards and rules rows, the close guard, room-1 → Pepper unlock, gallery progress, and the interactive 5×5 tutorial. Both tests reset the save when they finish.
## Versioning and releases ## Versioning and releases
The current development build is **v0.4.0-alpha** (“Lobby Redesign”) with the build label on Home and in Settings. The current development build is **v0.4.3-alpha** (“Tap Twice”) with the build label on Home and in Settings.
Gitea repository: Gitea repository:
@@ -199,7 +200,18 @@ Alpha releases (all marked prerelease, each with a debug APK and source archive)
- **v0.1.0-alpha** — first playable 20-room prototype - **v0.1.0-alpha** — first playable 20-room prototype
- **v0.2.0-alpha** — Guest Book, Settings, House Rules, 25 guests - **v0.2.0-alpha** — Guest Book, Settings, House Rules, 25 guests
- **v0.3.0-alpha** — 30 rooms, unique guest per room, Android APK - **v0.3.0-alpha** — 30 rooms, unique guest per room, Android APK
- `redesign-360` — branch with the 360dp redesign work - **v0.4.0-alpha** — 360dp redesign, pattern motifs, room legend, in-level settings
- **v0.4.1-alpha** — Guest Book tap/scroll guards, close guard, double-tap placement
- **v0.4.2-alpha** — finger scrolling works over Guest Book cards, House Rules rows, and Settings rows
- **v0.4.3-alpha** — double-tap placement is the default, with a one-time migration for older saves
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.4.3-alpha
The v0.4.3-alpha APK is also at:
`https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.4.3-alpha/Ratdoku-v0.4.3-alpha.apk`
`redesign-360` is the branch with the current 360dp work; it is tagged `v0.4.3-alpha`.
The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`). The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`).
@@ -209,7 +221,7 @@ The version is set in three places: `project.godot` (`config/version`), `scripts
- Unique guest per room per level - Unique guest per room per level
- 360dp layout, Fredoka/Nunito typography, Lucide icons - 360dp layout, Fredoka/Nunito typography, Lucide icons
- Playful rounded tiles, 8 pattern motifs, room legend - Playful rounded tiles, 8 pattern motifs, room legend
- In-level settings sheet with patterns/timer/motion/hold/restart/lobby - In-level settings sheet with patterns/timer/motion/placement mode/restart/lobby
- Interactive 5×5 tutorial - Interactive 5×5 tutorial
- 25 guest portraits + Crumb - 25 guest portraits + Crumb
- Settings, gallery, rulebook, unlock flow - Settings, gallery, rulebook, unlock flow
+2 -2
View File
@@ -32,8 +32,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true architectures/arm64-v8a=true
architectures/x86=false architectures/x86=false
architectures/x86_64=false architectures/x86_64=false
version/code=4 version/code=7
version/name="0.4.0" version/name="0.4.3"
package/unique_name="com.ratdoku.game" package/unique_name="com.ratdoku.game"
package/name="Ratdoku" package/name="Ratdoku"
package/signed=true package/signed=true
+1 -1
View File
@@ -12,7 +12,7 @@ config_version=5
config/name="Ratdoku" config/name="Ratdoku"
run/main_scene="res://scenes/Main.tscn" run/main_scene="res://scenes/Main.tscn"
config/version="0.4.0-alpha" config/version="0.4.3-alpha"
config/features=PackedStringArray("4.7", "GL Compatibility") config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.png" config/icon="res://icon.png"
+52 -2
View File
@@ -11,6 +11,7 @@ signal mistake
const EMPTY := 0 const EMPTY := 0
const X := 1 const X := 1
const RAT := 2 const RAT := 2
const DOUBLE_TAP_MS := 220
var n := 8 var n := 8
var regions: Array = [] var regions: Array = []
@@ -33,6 +34,9 @@ var hold_fired := false
var hold_seconds := 0.35 var hold_seconds := 0.35
var show_patterns := true var show_patterns := true
var reduce_motion := false var reduce_motion := false
var double_tap_place := false
var pending_tap_cell := Vector2i(-1, -1)
var pending_tap_at := 0
var region_rats: Array = [] var region_rats: Array = []
var region_textures := {} var region_textures := {}
@@ -76,6 +80,7 @@ func _ready() -> void:
show_patterns = bool(save.get_setting("patterns")) show_patterns = bool(save.get_setting("patterns"))
reduce_motion = bool(save.get_setting("reduce_motion")) reduce_motion = bool(save.get_setting("reduce_motion"))
hold_seconds = float(save.get_setting("hold_seconds")) hold_seconds = float(save.get_setting("hold_seconds"))
double_tap_place = bool(save.get_setting("double_tap_place"))
save.settings_changed.connect(_on_settings_changed) save.settings_changed.connect(_on_settings_changed)
@@ -86,6 +91,15 @@ func _on_settings_changed() -> void:
show_patterns = bool(save.get_setting("patterns")) show_patterns = bool(save.get_setting("patterns"))
reduce_motion = bool(save.get_setting("reduce_motion")) reduce_motion = bool(save.get_setting("reduce_motion"))
hold_seconds = float(save.get_setting("hold_seconds")) hold_seconds = float(save.get_setting("hold_seconds"))
double_tap_place = bool(save.get_setting("double_tap_place"))
if not double_tap_place and pending_tap_cell.x >= 0:
var pending := pending_tap_cell
pending_tap_cell = Vector2i(-1, -1)
_tap(pending)
elif double_tap_place:
# Leave hold mode cleanly if it was mid-press.
press_cell = Vector2i(-1, -1)
hold_fired = false
queue_redraw() queue_redraw()
@@ -94,7 +108,13 @@ func _process(delta: float) -> void:
pop_time = max(0.0, pop_time - delta) pop_time = max(0.0, pop_time - delta)
queue_redraw() queue_redraw()
if press_cell.x >= 0 and not hold_fired: if pending_tap_cell.x >= 0 and Time.get_ticks_msec() - pending_tap_at >= DOUBLE_TAP_MS:
var pending := pending_tap_cell
pending_tap_cell = Vector2i(-1, -1)
_tap(pending)
queue_redraw()
if not double_tap_place and press_cell.x >= 0 and not hold_fired:
press_elapsed += delta press_elapsed += delta
if press_elapsed >= hold_seconds: if press_elapsed >= hold_seconds:
hold_fired = true hold_fired = true
@@ -137,6 +157,7 @@ func set_level(level: Dictionary) -> void:
fixed[Vector2i(r, c)] = true fixed[Vector2i(r, c)] = true
history.clear() history.clear()
pending_tap_cell = Vector2i(-1, -1)
conflict_cells.clear() conflict_cells.clear()
last_placed = Vector2i(-1, -1) last_placed = Vector2i(-1, -1)
pop_time = 0.0 pop_time = 0.0
@@ -183,7 +204,7 @@ func _draw() -> void:
draw_arc(center, cell_size * 0.42, 0.0, TAU, 32, Palette.RED, 3.0, true) draw_arc(center, cell_size * 0.42, 0.0, TAU, 32, Palette.RED, 3.0, true)
# Hold progress: fills a gold ring before checking a guest in. # Hold progress: fills a gold ring before checking a guest in.
if press_cell.x >= 0 and not hold_fired: if press_cell.x >= 0 and not hold_fired and not double_tap_place:
var center := _cell_rect(press_cell.x, press_cell.y).get_center() var center := _cell_rect(press_cell.x, press_cell.y).get_center()
var t: float = clamp(press_elapsed / hold_seconds, 0.0, 1.0) var t: float = clamp(press_elapsed / hold_seconds, 0.0, 1.0)
draw_arc(center, cell_size * 0.40, -PI * 0.5, -PI * 0.5 + TAU * t, 32, Palette.GOLD, 3.0, true) draw_arc(center, cell_size * 0.40, -PI * 0.5, -PI * 0.5 + TAU * t, 32, Palette.GOLD, 3.0, true)
@@ -417,6 +438,9 @@ func _gui_input(event: InputEvent) -> void:
hold_fired = false hold_fired = false
queue_redraw() queue_redraw()
if not fired and was_cell.x >= 0 and cell == was_cell: if not fired and was_cell.x >= 0 and cell == was_cell:
if double_tap_place:
_handle_tap(was_cell)
else:
_tap(was_cell) _tap(was_cell)
accept_event() accept_event()
@@ -452,10 +476,33 @@ func _tap(cell: Vector2i) -> void:
_set_cell(cell, X) _set_cell(cell, X)
## Double-tap mode: defer the single-tap action briefly so a second tap
## on the same cell can check a guest in instead.
func _handle_tap(cell: Vector2i) -> void:
if fixed.has(cell):
return
var now := Time.get_ticks_msec()
if pending_tap_cell == cell and now - pending_tap_at <= DOUBLE_TAP_MS:
pending_tap_cell = Vector2i(-1, -1)
_toggle_rat(cell)
return
if pending_tap_cell.x >= 0:
var old := pending_tap_cell
pending_tap_cell = Vector2i(-1, -1)
_tap(old)
pending_tap_cell = cell
pending_tap_at = now
## Hold (mobile/PC) or right-click (PC): check a guest in or out. ## Hold (mobile/PC) or right-click (PC): check a guest in or out.
func _toggle_rat(cell: Vector2i) -> void: func _toggle_rat(cell: Vector2i) -> void:
if fixed.has(cell): if fixed.has(cell):
return return
# A right-click or hold overrides any tap still waiting for a partner.
if pending_tap_cell == cell:
pending_tap_cell = Vector2i(-1, -1)
if int(cells[cell.x][cell.y]) == RAT: if int(cells[cell.x][cell.y]) == RAT:
_set_cell(cell, EMPTY) _set_cell(cell, EMPTY)
else: else:
@@ -504,11 +551,13 @@ func _copy_cells() -> Array:
func undo() -> void: func undo() -> void:
if history.is_empty(): if history.is_empty():
return return
pending_tap_cell = Vector2i(-1, -1)
cells = history.pop_back() cells = history.pop_back()
_after_change() _after_change()
func restart() -> void: func restart() -> void:
pending_tap_cell = Vector2i(-1, -1)
_push_history() _push_history()
for r in n: for r in n:
for c in n: for c in n:
@@ -520,6 +569,7 @@ func restart() -> void:
func hint() -> bool: func hint() -> bool:
if solution.size() != n: if solution.size() != n:
return false return false
pending_tap_cell = Vector2i(-1, -1)
for r in n: for r in n:
var c := int(solution[r]) var c := int(solution[r])
if int(cells[r][c]) == RAT: if int(cells[r][c]) == RAT:
+96 -3
View File
@@ -2,9 +2,17 @@ extends Control
signal back_pressed signal back_pressed
## A tap is only trusted when it is short and stationary. Anything that
## drifts or moves the scroll container is treated as a scroll gesture.
const TAP_MAX_MOVE := 12.0
const TAP_MAX_MS := 500
const DRAG_SUPPRESS_MS := 180
const DETAIL_CLOSE_GUARD_MS := 250
var grid: GridContainer var grid: GridContainer
var progress_label: Label var progress_label: Label
var status_label: Label var status_label: Label
var scroll: ScrollContainer
var detail_layer: ColorRect var detail_layer: ColorRect
var detail_portrait: TextureRect var detail_portrait: TextureRect
var detail_name: Label var detail_name: Label
@@ -14,6 +22,14 @@ var detail_bio: Label
var detail_snack: Label var detail_snack: Label
var detail_status: Label var detail_status: Label
var _press_active := false
var _press_at := 0
var _press_pos := Vector2.ZERO
var _press_scroll := 0
var _dragged := false
var _suppress_until := 0
var _detail_opened_at := 0
func _ready() -> void: func _ready() -> void:
var margin := MarginContainer.new() var margin := MarginContainer.new()
@@ -53,10 +69,12 @@ func _ready() -> void:
status_label.custom_minimum_size = Vector2(0, 20) status_label.custom_minimum_size = Vector2(0, 20)
column.add_child(status_label) column.add_child(status_label)
var scroll := ScrollContainer.new() scroll = ScrollContainer.new()
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
scroll.scroll_started.connect(_on_scroll_started)
scroll.scroll_ended.connect(_on_scroll_ended)
column.add_child(scroll) column.add_child(scroll)
grid = GridContainer.new() grid = GridContainer.new()
@@ -116,6 +134,10 @@ func refresh() -> void:
for guest in guests: for guest in guests:
grid.add_child(_make_card(guest)) grid.add_child(_make_card(guest))
# Let a finger drag reach the ScrollContainer even when it starts on a
# card; the card still gets its own press/release for tap detection.
UI.pass_scroll_input(grid)
func _make_card(guest: Dictionary) -> PanelContainer: func _make_card(guest: Dictionary) -> PanelContainer:
var id := str(guest["id"]) var id := str(guest["id"])
@@ -173,9 +195,62 @@ func _make_card(guest: Dictionary) -> PanelContainer:
return panel return panel
func _on_scroll_started() -> void:
_dragged = true
func _on_scroll_ended() -> void:
_dragged = true
_suppress_until = max(_suppress_until, Time.get_ticks_msec() + DRAG_SUPPRESS_MS)
func _on_card_input(event: InputEvent, guest: Dictionary, locked: bool) -> void: func _on_card_input(event: InputEvent, guest: Dictionary, locked: bool) -> void:
if not (event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT): if event is InputEventMouseMotion and _press_active:
var motion := event as InputEventMouseMotion
if motion.global_position.distance_to(_press_pos) > TAP_MAX_MOVE:
_dragged = true
return return
if not (event is InputEventMouseButton):
return
var button := event as InputEventMouseButton
if button.button_index != MOUSE_BUTTON_LEFT:
return
if button.pressed:
# Remember where and when the finger landed, and how far the list
# was scrolled, so a release can be checked against it.
_press_active = true
_press_at = Time.get_ticks_msec()
_press_pos = button.global_position
_press_scroll = scroll.scroll_vertical if scroll != null else 0
_dragged = false
return
if not _press_active:
return
_press_active = false
var now := Time.get_ticks_msec()
var moved: float = button.global_position.distance_to(_press_pos)
var scroll_now := scroll.scroll_vertical if scroll != null else 0
var scrolled := _dragged or absi(scroll_now - _press_scroll) > 1
var is_tap: bool = (
not scrolled
and moved <= TAP_MAX_MOVE
and now - _press_at <= TAP_MAX_MS
and now >= _suppress_until
)
if scrolled:
_suppress_until = now + DRAG_SUPPRESS_MS
# Do not consume the event: the ScrollContainer needs the release to end
# its drag. A real tap is still safe because the detail sheet guards
# Close for 250ms after opening.
if not is_tap:
return
if locked: if locked:
var room := int(guest.get("unlock_room", 0)) var room := int(guest.get("unlock_room", 0))
status_label.text = "Check in a guest from Room %d to meet them." % room status_label.text = "Check in a guest from Room %d to meet them." % room
@@ -192,14 +267,17 @@ func _build_detail() -> void:
detail_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) detail_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
detail_layer.mouse_filter = Control.MOUSE_FILTER_STOP detail_layer.mouse_filter = Control.MOUSE_FILTER_STOP
detail_layer.visible = false detail_layer.visible = false
detail_layer.gui_input.connect(_on_detail_input)
add_child(detail_layer) add_child(detail_layer)
var center := CenterContainer.new() var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
detail_layer.add_child(center) detail_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16) var panel := UI.panel(Palette.CREAM, 24, 16)
panel.custom_minimum_size = Vector2(320, 0) panel.custom_minimum_size = Vector2(320, 0)
panel.mouse_filter = Control.MOUSE_FILTER_STOP
center.add_child(panel) center.add_child(panel)
var box := VBoxContainer.new() var box := VBoxContainer.new()
@@ -230,7 +308,7 @@ func _build_detail() -> void:
var close := UI.button("Close", false, 44) var close := UI.button("Close", false, 44)
close.add_theme_font_size_override("font_size", 16) close.add_theme_font_size_override("font_size", 16)
close.pressed.connect(func() -> void: detail_layer.visible = false) close.pressed.connect(_try_close_detail)
box.add_child(close) box.add_child(close)
@@ -247,4 +325,19 @@ func _show_detail(guest: Dictionary) -> void:
detail_status.text = "Checked in · Room %d" % int(guest.get("unlock_room", 0)) detail_status.text = "Checked in · Room %d" % int(guest.get("unlock_room", 0))
if int(guest.get("unlock_room", 0)) == 0: if int(guest.get("unlock_room", 0)) == 0:
detail_status.text = "Resident · always in" detail_status.text = "Resident · always in"
_detail_opened_at = Time.get_ticks_msec()
detail_layer.visible = true detail_layer.visible = true
detail_layer.move_to_front()
func _on_detail_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and not event.pressed:
_try_close_detail()
func _try_close_detail() -> void:
# The opening tap can land where the sheet appears. Ignore close input
# for a moment so one deliberate tap opens and a second one closes.
if Time.get_ticks_msec() - _detail_opened_at < DETAIL_CLOSE_GUARD_MS:
return
detail_layer.visible = false
+5 -1
View File
@@ -7,6 +7,7 @@ signal rules_pressed
var progress_pill: Button var progress_pill: Button
var primary: Button var primary: Button
var hint_label: Label
func _ready() -> void: func _ready() -> void:
@@ -79,7 +80,8 @@ func _ready() -> void:
column.add_child(UI.label("Crumb, innkeeper", 12, Palette.MUTED)) column.add_child(UI.label("Crumb, innkeeper", 12, Palette.MUTED))
column.add_child(UI.label("Every guest gets a room of their own.", 15)) column.add_child(UI.label("Every guest gets a room of their own.", 15))
column.add_child(UI.label("Tap = X · Hold or right-click = check in", 11, Palette.MUTED)) hint_label = UI.label(UI.place_hint(), 11, Palette.MUTED)
column.add_child(hint_label)
var bottom_space := Control.new() var bottom_space := Control.new()
bottom_space.size_flags_vertical = Control.SIZE_EXPAND_FILL bottom_space.size_flags_vertical = Control.SIZE_EXPAND_FILL
@@ -113,10 +115,12 @@ func _ready() -> void:
column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED)) column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
SaveGame.progress_changed.connect(refresh) SaveGame.progress_changed.connect(refresh)
SaveGame.settings_changed.connect(refresh)
refresh() refresh()
func refresh() -> void: func refresh() -> void:
hint_label.text = UI.place_hint()
var guests := Guests.all() var guests := Guests.all()
var unlocked := SaveGame.unlocked_count(guests) var unlocked := SaveGame.unlocked_count(guests)
progress_pill.text = "%d / %d guests" % [unlocked, guests.size()] progress_pill.text = "%d / %d guests" % [unlocked, guests.size()]
+28 -3
View File
@@ -6,6 +6,7 @@ const BoardScene = preload("res://scenes/Board.tscn")
var tutorial_board: Board var tutorial_board: Board
var tutorial_status: Label var tutorial_status: Label
var checkin_body: Label
func _ready() -> void: func _ready() -> void:
@@ -54,7 +55,8 @@ func _ready() -> void:
content.add_child(_rule_row("No shared walls or corners", "Rats cannot touch, not even diagonally.", "touch")) content.add_child(_rule_row("No shared walls or corners", "Rats cannot touch, not even diagonally.", "touch"))
content.add_child(_heading("Checking in", 18)) content.add_child(_heading("Checking in", 18))
content.add_child(_body("Tap or left-click to mark X. Tap an X or a guest to clear it. Hold or right-click to check a guest in. Gold-ringed guests are already in.")) checkin_body = _body(_checkin_text())
content.add_child(checkin_body)
content.add_child(_body("Undo is unlimited. Hints are free and explain the next sensible move.")) content.add_child(_body("Undo is unlimited. Hints are free and explain the next sensible move."))
content.add_child(_heading("Try a tiny room", 18)) content.add_child(_heading("Try a tiny room", 18))
@@ -84,8 +86,9 @@ func _ready() -> void:
hint.pressed.connect(_on_tutorial_hint) hint.pressed.connect(_on_tutorial_hint)
controls.add_child(hint) controls.add_child(hint)
tutorial_status = UI.label("Tap = X · Hold or right-click = check in", 10, Palette.MUTED) tutorial_status = UI.label(UI.place_hint(), 10, Palette.MUTED)
content.add_child(tutorial_status) content.add_child(tutorial_status)
SaveGame.settings_changed.connect(_refresh_hints)
content.add_child(_heading("Housekeeping tips", 18)) content.add_child(_heading("Housekeeping tips", 18))
content.add_child(_body("Start with the smallest room. If a room's open cells all sit in one row, that row's guest belongs to that room. Every room has one solution and never requires guessing.")) content.add_child(_body("Start with the smallest room. If a room's open cells all sit in one row, that row's guest belongs to that room. Every room has one solution and never requires guessing."))
@@ -98,6 +101,11 @@ func _ready() -> void:
if not tutorial.is_empty(): if not tutorial.is_empty():
tutorial_board.set_level(tutorial) tutorial_board.set_level(tutorial)
# Everything in the rules list passes drags to the ScrollContainer, so
# a swipe works over labels and buttons. The practice board keeps its
# own input.
UI.pass_scroll_input(content, [tutorial_board])
func _body(text: String) -> Label: func _body(text: String) -> Label:
var label := UI.label(text, 12, Palette.MUTED) var label := UI.label(text, 12, Palette.MUTED)
@@ -152,9 +160,26 @@ func _load_tutorial() -> Dictionary:
return {} return {}
func _checkin_text() -> String:
var place := "Double-tap or right-click to check a guest in."
if not bool(SaveGame.get_setting("double_tap_place")):
place = "Hold or right-click to check a guest in."
return "Tap or left-click to mark X. Tap an X or a guest to clear it. %s Gold-ringed guests are already in." % place
func _refresh_hints() -> void:
if checkin_body != null:
checkin_body.text = _checkin_text()
if tutorial_status != null and (
tutorial_status.text == "Tap = X · Hold or right-click = check in"
or tutorial_status.text == "Tap = X · Double-tap or right-click = check in"
):
tutorial_status.text = UI.place_hint()
func _on_tutorial_reset() -> void: func _on_tutorial_reset() -> void:
tutorial_board.restart() tutorial_board.restart()
tutorial_status.text = "Tap = X · Hold or right-click = check in" tutorial_status.text = UI.place_hint()
tutorial_status.add_theme_color_override("font_color", Palette.MUTED) tutorial_status.add_theme_color_override("font_color", Palette.MUTED)
+12 -1
View File
@@ -13,6 +13,7 @@ const DEFAULTS := {
"show_timer": true, "show_timer": true,
"reduce_motion": false, "reduce_motion": false,
"hold_seconds": 0.35, "hold_seconds": 0.35,
"double_tap_place": true,
} }
var data := {} var data := {}
@@ -24,7 +25,7 @@ func _ready() -> void:
func _default_data() -> Dictionary: func _default_data() -> Dictionary:
return { return {
"version": 1, "version": 2,
"completed_rooms": [], "completed_rooms": [],
"unlocked_guests": [], "unlocked_guests": [],
"settings": DEFAULTS.duplicate(true), "settings": DEFAULTS.duplicate(true),
@@ -34,6 +35,7 @@ func _default_data() -> Dictionary:
func load_game() -> void: func load_game() -> void:
data = _default_data() data = _default_data()
var stored_version := 2
if FileAccess.file_exists(PATH): if FileAccess.file_exists(PATH):
var file := FileAccess.open(PATH, FileAccess.READ) var file := FileAccess.open(PATH, FileAccess.READ)
@@ -41,6 +43,7 @@ func load_game() -> void:
var parsed = JSON.parse_string(file.get_as_text()) var parsed = JSON.parse_string(file.get_as_text())
file.close() file.close()
if typeof(parsed) == TYPE_DICTIONARY: if typeof(parsed) == TYPE_DICTIONARY:
stored_version = int(parsed.get("version", 1))
for key in parsed: for key in parsed:
data[key] = parsed[key] data[key] = parsed[key]
@@ -50,6 +53,14 @@ func load_game() -> void:
if not data["settings"].has(key): if not data["settings"].has(key):
data["settings"][key] = DEFAULTS[key] data["settings"][key] = DEFAULTS[key]
# Version 2 makes double-tap the default. Older saves were written while
# hold was the default, so switch them once; the toggle still persists
# after that.
if stored_version < 2:
data["settings"]["double_tap_place"] = true
data["version"] = 2
save_game()
if typeof(data.get("completed_rooms")) != TYPE_ARRAY: if typeof(data.get("completed_rooms")) != TYPE_ARRAY:
data["completed_rooms"] = [] data["completed_rooms"] = []
if typeof(data.get("unlocked_guests")) != TYPE_ARRAY: if typeof(data.get("unlocked_guests")) != TYPE_ARRAY:
+21 -1
View File
@@ -9,6 +9,7 @@ var game_mode := false
var toggles := {} var toggles := {}
var hold_slider: HSlider var hold_slider: HSlider
var hold_value: Label var hold_value: Label
var hold_panel: PanelContainer
var game_actions: HBoxContainer var game_actions: HBoxContainer
var reset_row: Control var reset_row: Control
var resume_button: Button var resume_button: Button
@@ -84,6 +85,7 @@ func _ready() -> void:
_add_pattern_row(list) _add_pattern_row(list)
_add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer") _add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
_add_toggle(list, "Reduce motion", "Stop the bob and placement pop.", "reduce_motion") _add_toggle(list, "Reduce motion", "Stop the bob and placement pop.", "reduce_motion")
_add_toggle(list, "Double-tap to place", "Tap = mark · double-tap = check in.", "double_tap_place")
_add_hold_row(list) _add_hold_row(list)
list.add_child(UI.spacer(2)) list.add_child(UI.spacer(2))
@@ -98,6 +100,10 @@ func _ready() -> void:
reset_status = UI.label("", 10, Palette.MUTED) reset_status = UI.label("", 10, Palette.MUTED)
list.add_child(reset_status) list.add_child(reset_status)
# Let swipes reach the sheet's ScrollContainer even when they start on a
# label, toggle, or button.
UI.pass_scroll_input(list)
game_actions = HBoxContainer.new() game_actions = HBoxContainer.new()
game_actions.add_theme_constant_override("separation", 6) game_actions.add_theme_constant_override("separation", 6)
column.add_child(game_actions) column.add_child(game_actions)
@@ -152,6 +158,7 @@ func refresh() -> void:
if hold_slider != null: if hold_slider != null:
hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds"))) hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
hold_value.text = "%.2f s" % hold_slider.value hold_value.text = "%.2f s" % hold_slider.value
_update_hold_availability()
func _add_pattern_row(parent: VBoxContainer) -> void: func _add_pattern_row(parent: VBoxContainer) -> void:
@@ -197,7 +204,10 @@ func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: Stri
var check := CheckButton.new() var check := CheckButton.new()
check.button_pressed = bool(SaveGame.get_setting(key)) check.button_pressed = bool(SaveGame.get_setting(key))
check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting(key, on)) check.toggled.connect(func(on: bool) -> void:
SaveGame.set_setting(key, on)
_update_hold_availability()
)
row.add_child(check) row.add_child(check)
toggles[key] = check toggles[key] = check
parent.add_child(panel) parent.add_child(panel)
@@ -205,6 +215,7 @@ func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: Stri
func _add_hold_row(parent: VBoxContainer) -> void: func _add_hold_row(parent: VBoxContainer) -> void:
var panel := UI.panel(Palette.PAPER, 14, 8) var panel := UI.panel(Palette.PAPER, 14, 8)
hold_panel = panel
var column := VBoxContainer.new() var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 2) column.add_theme_constant_override("separation", 2)
panel.add_child(column) panel.add_child(column)
@@ -271,6 +282,15 @@ func _on_hold_changed(value: float) -> void:
SaveGame.set_setting("hold_seconds", snapped) SaveGame.set_setting("hold_seconds", snapped)
func _update_hold_availability() -> void:
if hold_slider == null or hold_panel == null:
return
var enabled := not bool(SaveGame.get_setting("double_tap_place"))
hold_slider.editable = enabled
hold_slider.mouse_filter = Control.MOUSE_FILTER_PASS if enabled else Control.MOUSE_FILTER_IGNORE
hold_panel.modulate = Color(1, 1, 1, 1.0 if enabled else 0.45)
func _on_scrim_input(event: InputEvent) -> void: func _on_scrim_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
_close() _close()
+20
View File
@@ -142,6 +142,26 @@ static func safe_bottom() -> int:
return 24 if OS.has_feature("mobile") else 14 return 24 if OS.has_feature("mobile") else 14
## Godot's ScrollContainer only sees a touch drag when the controls under the
## finger let the event through. PASS keeps buttons clickable while allowing
## the parent ScrollContainer to handle the same gesture. `skip` protects
## controls that must own their input, such as the tutorial Board.
static func pass_scroll_input(root: Node, skip: Array = []) -> void:
if root is Control and not skip.has(root):
root.mouse_filter = Control.MOUSE_FILTER_PASS
for child in root.get_children():
if skip.has(child):
continue
pass_scroll_input(child, skip)
## Short control hint that follows the saved placement mode.
static func place_hint() -> String:
if bool(SaveGame.get_setting("double_tap_place")):
return "Tap = X · Double-tap or right-click = check in"
return "Tap = X · Hold or right-click = check in"
static func _button_style(color: Color) -> StyleBoxFlat: static func _button_style(color: Color) -> StyleBoxFlat:
var s := StyleBoxFlat.new() var s := StyleBoxFlat.new()
s.bg_color = color s.bg_color = color
+3 -3
View File
@@ -1,7 +1,7 @@
class_name Version class_name Version
extends RefCounted extends RefCounted
const NUMBER := "0.4.0-alpha" const NUMBER := "0.4.3-alpha"
const CODENAME := "Lobby Redesign" const CODENAME := "Tap Twice"
const BUILD_DATE := "2026-12-02" const BUILD_DATE := "2026-12-02"
const BUILD_LABEL := "v0.4.0-alpha · build 2026-12-02" const BUILD_LABEL := "v0.4.3-alpha · build 2026-12-02"
+10
View File
@@ -93,6 +93,13 @@ func _run() -> void:
print("FAIL mapping: expected (3,4), got %s" % str(mapped)) print("FAIL mapping: expected (3,4), got %s" % str(mapped))
# Tap marks X, right-click checks in, and hold checks in without a tap. # Tap marks X, right-click checks in, and hold checks in without a tap.
# This section exercises hold mode explicitly; double-tap has its own
# checks in ui_test.gd.
var save = root.get_node_or_null("SaveGame")
var previous_mode := true
if save != null:
previous_mode = bool(save.get_setting("double_tap_place"))
save.set_setting("double_tap_place", false)
board.set_level(first) board.set_level(first)
board._update_layout() board._update_layout()
var tap_cell := _find_empty_cell(board) var tap_cell := _find_empty_cell(board)
@@ -122,6 +129,9 @@ func _run() -> void:
all_ok = false all_ok = false
print("FAIL hold release: guest was removed") print("FAIL hold release: guest was removed")
if save != null:
save.set_setting("double_tap_place", previous_mode)
print("SMOKE TEST: %s" % ("PASS" if all_ok else "FAIL")) print("SMOKE TEST: %s" % ("PASS" if all_ok else "FAIL"))
quit(0 if all_ok else 1) quit(0 if all_ok else 1)
+186
View File
@@ -33,6 +33,7 @@ func _run() -> void:
quit(1) quit(1)
return return
_test_save_defaults(save)
save.reset_progress() save.reset_progress()
main.game.start_level(0) main.game.start_level(0)
@@ -53,6 +54,16 @@ func _run() -> void:
_check(abs(main.game.board.hold_seconds - 0.50) < 0.001, "hold_seconds did not reach Board") _check(abs(main.game.board.hold_seconds - 0.50) < 0.001, "hold_seconds did not reach Board")
save.set_setting("hold_seconds", 0.35) save.set_setting("hold_seconds", 0.35)
_test_placement_modes(save, main.game.board)
main.open_settings("home")
await process_frame
_check(
main.settings_sheet.toggles["double_tap_place"].mouse_filter == Control.MOUSE_FILTER_PASS,
"settings rows should pass swipes to the ScrollContainer"
)
main.close_settings()
var unlocked: String = save.complete_room("room-01", 1) var unlocked: String = save.complete_room("room-01", 1)
_check(unlocked == "pepper", "room 1 should unlock Pepper") _check(unlocked == "pepper", "room 1 should unlock Pepper")
_check(save.is_guest_unlocked("pepper"), "Pepper should be unlocked") _check(save.is_guest_unlocked("pepper"), "Pepper should be unlocked")
@@ -64,12 +75,22 @@ func _run() -> void:
_check(main.guest_book != null, "Guest Book missing") _check(main.guest_book != null, "Guest Book missing")
if main.guest_book != null and main.guest_book.progress_label != null: if main.guest_book != null and main.guest_book.progress_label != null:
_check(main.guest_book.progress_label.text.find("6/25") >= 0, "Guest Book progress should be 6/25") _check(main.guest_book.progress_label.text.find("6/25") >= 0, "Guest Book progress should be 6/25")
_test_guest_book_input(main.guest_book)
_check(main.guest_book.grid.mouse_filter == Control.MOUSE_FILTER_PASS, "guest grid should pass swipes")
var first_card = main.guest_book.grid.get_child(0)
_check(first_card.mouse_filter == Control.MOUSE_FILTER_PASS, "guest cards should pass swipes")
main.show_screen("rules") main.show_screen("rules")
await process_frame await process_frame
var tutorial_board = main.rulebook.tutorial_board var tutorial_board = main.rulebook.tutorial_board
_check(tutorial_board != null, "Tutorial board missing") _check(tutorial_board != null, "Tutorial board missing")
if tutorial_board != null: if tutorial_board != null:
var rule_scrolls = main.rulebook.find_children("*", "ScrollContainer", true, false)
_check(rule_scrolls.size() > 0, "Rules ScrollContainer missing")
if rule_scrolls.size() > 0:
var rules_content = rule_scrolls[0].get_child(0)
_check(rules_content.mouse_filter == Control.MOUSE_FILTER_PASS, "rules content should pass swipes")
_check(tutorial_board.mouse_filter == Control.MOUSE_FILTER_STOP, "tutorial board should keep its own input")
for i in range(8): for i in range(8):
tutorial_board.hint() tutorial_board.hint()
await process_frame await process_frame
@@ -80,6 +101,171 @@ func _run() -> void:
save.set_setting("show_timer", true) save.set_setting("show_timer", true)
save.set_setting("reduce_motion", false) save.set_setting("reduce_motion", false)
save.set_setting("hold_seconds", 0.35) save.set_setting("hold_seconds", 0.35)
save.set_setting("double_tap_place", true)
print("UI TEST: ", "PASS" if failures == 0 else "FAIL (%d)" % failures) print("UI TEST: ", "PASS" if failures == 0 else "FAIL (%d)" % failures)
quit(0 if failures == 0 else 1) quit(0 if failures == 0 else 1)
func _test_save_defaults(save) -> void:
# A fresh save starts in double-tap mode at version 2.
var abs_path := ProjectSettings.globalize_path(save.PATH)
if FileAccess.file_exists(save.PATH):
DirAccess.remove_absolute(abs_path)
save.load_game()
_check(int(save.data.get("version", 0)) == 2, "fresh saves should be version 2")
_check(bool(save.get_setting("double_tap_place")), "fresh saves should default to double-tap")
# A version 1 save with hold selected migrates to double-tap once.
var old: Dictionary = save._default_data()
old["version"] = 1
old["settings"]["double_tap_place"] = false
var file := FileAccess.open(save.PATH, FileAccess.WRITE)
file.store_string(JSON.stringify(old, "\t"))
file.close()
save.load_game()
_check(int(save.data.get("version", 0)) == 2, "version 1 saves should migrate to version 2")
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
func _find_empty(board: Board) -> Vector2i:
for r in board.n:
for c in board.n:
if (
int(board.cells[r][c]) == Board.EMPTY
and not board.fixed.has(Vector2i(r, c))
and not board.auto_x[r][c]
):
return Vector2i(r, c)
return Vector2i(-1, -1)
func _test_placement_modes(save, board: Board) -> void:
board.restart()
save.set_setting("double_tap_place", true)
_check(board.double_tap_place, "double_tap_place did not reach Board")
# A first tap waits; a second tap on the same cell checks a guest in.
var cell := _find_empty(board)
board._handle_tap(cell)
_check(int(board.cells[cell.x][cell.y]) == Board.EMPTY, "first tap should wait in double-tap mode")
board._handle_tap(cell)
_check(int(board.cells[cell.x][cell.y]) == Board.RAT, "double tap should check a guest in")
board._handle_tap(cell)
board._handle_tap(cell)
_check(int(board.cells[cell.x][cell.y]) == Board.EMPTY, "double tap on a guest should check them out")
# A lone tap still marks an X once the double-tap window passes.
var cell2 := _find_empty(board)
board._handle_tap(cell2)
board.pending_tap_at -= Board.DOUBLE_TAP_MS + 1
board._process(0.0)
_check(int(board.cells[cell2.x][cell2.y]) == Board.X, "single tap should mark X after the window")
# Holding must not place a guest while double-tap mode is on.
board.press_cell = cell2
board.press_elapsed = 0.0
board.hold_fired = false
board._process(1.0)
_check(int(board.cells[cell2.x][cell2.y]) == Board.X, "hold should not place in double-tap mode")
board.press_cell = Vector2i(-1, -1)
board.hold_fired = false
# Right-click still checks a guest in and out in double-tap mode.
board.size = Vector2(320, 320)
board._update_layout()
var cell3 := _find_empty(board)
_right_click(board, cell3)
_check(int(board.cells[cell3.x][cell3.y]) == Board.RAT, "right-click should check in during double-tap mode")
_right_click(board, cell3)
_check(int(board.cells[cell3.x][cell3.y]) == Board.EMPTY, "right-click should check out during double-tap mode")
# Hold mode still works when the setting is off.
save.set_setting("double_tap_place", false)
_check(not board.double_tap_place, "double_tap_place did not turn off")
board.restart()
var cell4 := _find_empty(board)
board.press_cell = cell4
board.press_elapsed = 0.0
board.hold_fired = false
board._process(0.60)
_check(int(board.cells[cell4.x][cell4.y]) == Board.RAT, "hold should place in hold mode")
board.press_cell = Vector2i(-1, -1)
board.hold_fired = false
# Single tap marks X in hold mode.
var cell5 := _find_empty(board)
board.size = Vector2(320, 320)
board._update_layout()
_left_tap(board, cell5)
_check(int(board.cells[cell5.x][cell5.y]) == Board.X, "single tap should mark X in hold mode")
# The setting survives a save/load round trip.
save.set_setting("double_tap_place", true)
save.load_game()
_check(bool(save.get_setting("double_tap_place")), "double_tap_place should persist")
save.set_setting("double_tap_place", true)
board.restart()
func _left_tap(board: Board, cell: Vector2i) -> void:
var pos := board._cell_rect(cell.x, cell.y).get_center()
var down := InputEventMouseButton.new()
down.button_index = MOUSE_BUTTON_LEFT
down.pressed = true
down.position = pos
board._gui_input(down)
var up := InputEventMouseButton.new()
up.button_index = MOUSE_BUTTON_LEFT
up.pressed = false
up.position = pos
board._gui_input(up)
func _right_click(board: Board, cell: Vector2i) -> void:
var event := InputEventMouseButton.new()
event.button_index = MOUSE_BUTTON_RIGHT
event.pressed = true
event.position = board._cell_rect(cell.x, cell.y).get_center()
board._gui_input(event)
func _test_guest_book_input(book) -> void:
var guest: Dictionary = Guests.all()[0]
book.detail_layer.visible = false
# Dragging across a card is a scroll, not a tap.
_mouse(book, guest, Vector2(100, 300), true)
var motion := InputEventMouseMotion.new()
motion.global_position = Vector2(170, 300)
book._on_card_input(motion, guest, false)
_mouse(book, guest, Vector2(170, 300), false)
_check(not book.detail_layer.visible, "dragging should not open a guest card")
# A fling settling must not turn into a tap either.
book._suppress_until = Time.get_ticks_msec() + 1000
_mouse(book, guest, Vector2(100, 300), true)
_mouse(book, guest, Vector2(100, 300), false)
_check(not book.detail_layer.visible, "post-scroll tap should be ignored")
# A short, stationary tap opens the card.
book._suppress_until = 0
_mouse(book, guest, Vector2(100, 300), true)
_mouse(book, guest, Vector2(100, 300), false)
_check(book.detail_layer.visible, "a clean tap should open a guest card")
# The opening tap must not immediately close the sheet.
book._try_close_detail()
_check(book.detail_layer.visible, "close should be guarded right after opening")
book._detail_opened_at -= 300
book._try_close_detail()
_check(not book.detail_layer.visible, "close should work after the guard")
func _mouse(book, guest: Dictionary, pos: Vector2, pressed: bool) -> void:
var event := InputEventMouseButton.new()
event.button_index = MOUSE_BUTTON_LEFT
event.pressed = pressed
event.global_position = pos
book._on_card_input(event, guest, false)