v0.2.0-alpha: Guest Book and House Rules

Adds the Guest Book, Settings, House Rules, and guest unlocks on the 20-room board. Rats still use the shared Crumb token.
This commit is contained in:
Ratdoku Builder committed 2026-12-02 10:32:45 -06:00
1 parent f4b4a773f3
commit f957cd3c4e
19 files changed
+905 -34

No files matched your search

+169
View File
@@ -0,0 +1,169 @@
extends Control
signal back_pressed
signal rules_pressed
var toggles := {}
var hold_slider: HSlider
var hold_value: Label
var reset_status: Label
var reset_dialog: ConfirmationDialog
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
margin.add_theme_constant_override("margin_left", 24)
margin.add_theme_constant_override("margin_right", 24)
margin.add_theme_constant_override("margin_top", 18)
margin.add_theme_constant_override("margin_bottom", 18)
add_child(margin)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 14)
margin.add_child(column)
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 10)
column.add_child(top)
var back := UI.button("‹", false, 44)
back.custom_minimum_size = Vector2(48, 44)
back.add_theme_font_size_override("font_size", 30)
back.pressed.connect(func() -> void: back_pressed.emit())
top.add_child(back)
var title := UI.label("Settings", 30)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title)
var scroll := ScrollContainer.new()
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
column.add_child(scroll)
var list := VBoxContainer.new()
list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
list.add_theme_constant_override("separation", 10)
scroll.add_child(list)
_add_toggle(list, "Region patterns", "Dots and stripes on the coloured rooms. Helps with colour blindness.", "patterns")
_add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
_add_toggle(list, "Reduce motion", "Stop the rat bob and placement pop. The hold ring still works.", "reduce_motion")
_add_hold_row(list)
list.add_child(UI.label("House Rules", 18, Palette.MUTED))
var rules := UI.button("Open the handbook", false, 52)
rules.pressed.connect(func() -> void: rules_pressed.emit())
list.add_child(rules)
list.add_child(UI.label("Progress", 18, Palette.MUTED))
var reset := UI.button("Reset progress", false, 52)
reset.add_theme_color_override("font_color", Palette.RED)
reset.add_theme_color_override("font_hover_color", Palette.RED)
reset.pressed.connect(_on_reset_pressed)
list.add_child(reset)
reset_status = UI.label("Completed rooms and unlocked guests will be cleared. Settings stay.", 15, Palette.MUTED)
list.add_child(reset_status)
list.add_child(UI.label("Ratdoku 0.2 · made with Godot · no ads, no tracking", 14, Palette.MUTED))
reset_dialog = ConfirmationDialog.new()
reset_dialog.title = "Reset progress?"
reset_dialog.dialog_text = "This clears completed rooms and unlocked guests. Your settings stay as they are."
reset_dialog.confirmed.connect(_on_reset_confirmed)
add_child(reset_dialog)
refresh()
func _add_toggle(parent: VBoxContainer, title: String, subtitle: String, key: String) -> void:
var panel := UI.panel(Palette.PAPER, 20, 14)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 10)
panel.add_child(row)
var text := VBoxContainer.new()
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
text.add_theme_constant_override("separation", 2)
row.add_child(text)
var label := UI.label(title, 19)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(label)
var detail := UI.label(subtitle, 14, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(detail)
var check := CheckButton.new()
check.button_pressed = bool(SaveGame.get_setting(key))
check.add_theme_font_size_override("font_size", 18)
check.add_theme_color_override("font_color", Palette.INK)
check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting(key, on))
row.add_child(check)
toggles[key] = check
parent.add_child(panel)
func _add_hold_row(parent: VBoxContainer) -> void:
var panel := UI.panel(Palette.PAPER, 20, 14)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 6)
panel.add_child(column)
var title := UI.label("Hold time", 19)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(title)
var detail := UI.label("How long to press before a guest checks in.", 14, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(detail)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 10)
column.add_child(row)
hold_slider = HSlider.new()
hold_slider.min_value = 0.20
hold_slider.max_value = 0.50
hold_slider.step = 0.05
hold_slider.value = float(SaveGame.get_setting("hold_seconds"))
hold_slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
hold_slider.custom_minimum_size = Vector2(180, 32)
hold_slider.value_changed.connect(_on_hold_changed)
row.add_child(hold_slider)
hold_value = UI.label("%.2f s" % hold_slider.value, 16, Palette.MUTED)
hold_value.custom_minimum_size = Vector2(64, 0)
row.add_child(hold_value)
parent.add_child(panel)
func refresh() -> void:
for key in toggles:
toggles[key].button_pressed = bool(SaveGame.get_setting(key))
if hold_slider != null:
hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
hold_value.text = "%.2f s" % hold_slider.value
func _on_hold_changed(value: float) -> void:
var snapped: float = snapped(value, 0.05)
hold_value.text = "%.2f s" % snapped
SaveGame.set_setting("hold_seconds", snapped)
func _on_reset_pressed() -> void:
reset_dialog.popup_centered()
func _on_reset_confirmed() -> void:
SaveGame.reset_progress()
reset_status.text = "Progress reset. Every guest is waiting to be met again."
reset_status.add_theme_color_override("font_color", Palette.INK)