feat(meowdoku): identity, gifts, achievements and wallpapers
Local-only v0.8.0 build. Adds player name/ID, achievements, claimable 7-day gift, daily share/stats, saved boards, 2048px rat-track wallpapers, difficulty/volume settings, and save v6. Not pushed or published.
This commit is contained in:
1 parent
5c00b35e90
commit
6d302f5cb9
21 files changed
+623
-41
No files matched your search
+33
-4
@@ -46,6 +46,7 @@ func _run() -> void:
|
||||
_test_daily(save)
|
||||
_test_frames(save)
|
||||
_test_avatars_and_streak(save)
|
||||
_test_v6_features(save)
|
||||
_test_game_data(save)
|
||||
_test_icons()
|
||||
|
||||
@@ -192,7 +193,7 @@ func _test_save_migrations(save) -> void:
|
||||
# (a) No save file at all -> fresh version-4 defaults.
|
||||
_remove_save(save)
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 5, "fresh save should be version 5")
|
||||
_check(int(save.data.get("version", 0)) == 6, "fresh save should be version 6")
|
||||
_check(bool(save.get_setting("double_tap_place")), "fresh save should default to double-tap")
|
||||
_check(_is_default_daily(save, save.daily_data()), "fresh save should have default daily stats")
|
||||
_check(save.selected_frame() == "plain", "fresh save should select the plain frame")
|
||||
@@ -207,7 +208,7 @@ func _test_save_migrations(save) -> void:
|
||||
v1.erase("profile_frame")
|
||||
_write_save(save, v1)
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 5, "version 1 should migrate to version 5")
|
||||
_check(int(save.data.get("version", 0)) == 6, "version 1 should migrate to version 6")
|
||||
_check(bool(save.get_setting("double_tap_place")), "version 1 should migrate to double-tap")
|
||||
_check(_is_default_daily(save, save.daily_data()), "version 1 missing daily should become defaults")
|
||||
_check(save.selected_frame() == "plain", "version 1 missing frame should become plain")
|
||||
@@ -220,7 +221,7 @@ func _test_save_migrations(save) -> void:
|
||||
v2.erase("profile_frame")
|
||||
_write_save(save, v2)
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 5, "version 2 should migrate to version 5")
|
||||
_check(int(save.data.get("version", 0)) == 6, "version 2 should migrate to version 6")
|
||||
_check(not bool(save.get_setting("double_tap_place")), "version 2 double_tap=false should stay false")
|
||||
_check(_is_default_daily(save, save.daily_data()), "version 2 missing daily should become defaults")
|
||||
_check(save.selected_frame() == "plain", "version 2 missing frame should become plain")
|
||||
@@ -233,7 +234,7 @@ func _test_save_migrations(save) -> void:
|
||||
else:
|
||||
_check(false, "could not write wrong-shape save")
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 5, "wrong-shape save should restore version 5 defaults")
|
||||
_check(int(save.data.get("version", 0)) == 6, "wrong-shape save should restore version 6 defaults")
|
||||
_check(bool(save.get_setting("double_tap_place")), "wrong-shape save should restore double-tap default")
|
||||
_check(_is_default_daily(save, save.daily_data()), "wrong-shape save should restore daily defaults")
|
||||
_check(save.selected_frame() == "plain", "wrong-shape save should restore plain frame")
|
||||
@@ -470,6 +471,34 @@ func _test_frames(save) -> void:
|
||||
# 4. Level and guest data
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
func _test_v6_features(save) -> void:
|
||||
_note("6. v6 systems")
|
||||
_check(save.player_name() == "Innkeeper", "default player name should be Innkeeper")
|
||||
_check(save.player_id().begins_with("RAT-"), "player ID should be generated")
|
||||
save.set_player_name("Ahri")
|
||||
_check(save.player_name() == "Ahri", "player name should save")
|
||||
_check(bool(save.get_setting("music")), "music should default on")
|
||||
_check(absf(float(save.get_setting("music_volume")) - 0.7) < 0.001, "music volume should default to 0.7")
|
||||
_check(bool(save.get_setting("sfx")), "sfx should default on")
|
||||
_check(save.theme_id() == "cream", "default wallpaper should be cream")
|
||||
_check(not save.is_theme_unlocked("gold"), "gold wallpaper should start locked")
|
||||
save.data["daily"]["best_streak"] = 7
|
||||
save.save_game()
|
||||
_check(save.claim_gift(), "7-day gift should be claimable")
|
||||
_check(not save.claim_gift(), "7-day gift should not double claim")
|
||||
_check(save.is_theme_unlocked("gold"), "gift should unlock gold wallpaper")
|
||||
save.select_theme("gold")
|
||||
_check(save.theme_id() == "gold", "gold wallpaper should be selectable")
|
||||
var snap := {"level_id": "probe", "n": 8, "cells": [], "auto_x": [], "history": []}
|
||||
save.save_board("campaign", snap)
|
||||
_check(save.load_board("campaign") == snap, "board snapshot should round trip")
|
||||
save.clear_board("campaign")
|
||||
_check(save.load_board("campaign").is_empty(), "board snapshot should clear")
|
||||
var state: Dictionary = save.achievements()
|
||||
_check(bool(state.get("streak_7", false)), "achievements should reflect streak")
|
||||
_reset_to_clean(save)
|
||||
|
||||
|
||||
func _test_game_data(save) -> void:
|
||||
_note("4. level/guest data")
|
||||
|
||||
|
||||
@@ -249,6 +249,20 @@ func _test_board_modes(save) -> void:
|
||||
"switching to double-tap should clear a held press")
|
||||
_check(not board.hold_fired, "switching to double-tap should clear hold_fired")
|
||||
|
||||
# Board snapshot round-trip for save/resume.
|
||||
var snap_cell := _find_empty(board)
|
||||
if snap_cell.x >= 0:
|
||||
save.set_setting("double_tap_place", false)
|
||||
_mouse_button(board, snap_cell, true)
|
||||
_mouse_button(board, snap_cell, false)
|
||||
var snap := board.snapshot()
|
||||
board.set_level(levels[1])
|
||||
board.set_level(level)
|
||||
var restored := board.restore_state(snap)
|
||||
_check(restored, "board snapshot should restore")
|
||||
_check(str(board.cells) == str(snap.get("cells")), "restored cells should match snapshot")
|
||||
_check(str(board.history) == str(snap.get("history")), "restored history should match snapshot")
|
||||
|
||||
board.free()
|
||||
|
||||
|
||||
|
||||
@@ -111,6 +111,12 @@ func _test_settings(main, save) -> void:
|
||||
_check(not main.music_player.playing, "music should stop when disabled")
|
||||
save.set_setting("music", true)
|
||||
_check(main.music_player.playing, "music should play when enabled")
|
||||
_check(main.settings_sheet.music_volume_slider != null, "music volume slider missing")
|
||||
_check(main.settings_sheet.difficulty_button.text.find("Difficulty") >= 0, "difficulty control missing")
|
||||
main.settings_sheet._cycle_difficulty()
|
||||
_check(str(save.get_setting("difficulty")) == "easy", "difficulty should cycle")
|
||||
save.set_setting("difficulty", "normal")
|
||||
_check(main.background_rect.texture != null, "wallpaper texture should load")
|
||||
|
||||
# Changes made through SaveGame must be reflected after an explicit refresh.
|
||||
save.set_setting("patterns", false)
|
||||
@@ -246,6 +252,14 @@ func _test_profile(main, save) -> void:
|
||||
if profile == null:
|
||||
return
|
||||
|
||||
_check(profile.player_id_label.text.begins_with("RAT-"), "profile should show player ID")
|
||||
_check(profile.achievements_box.get_child_count() == 8, "profile should list achievements")
|
||||
profile._show_rename()
|
||||
profile.name_input.text = "Ahri"
|
||||
profile._save_name()
|
||||
_check(save.player_name() == "Ahri", "name edit should save")
|
||||
save.set_player_name("Innkeeper")
|
||||
|
||||
profile._set_tab("frame")
|
||||
await process_frame
|
||||
var expected: int = frames.all().size()
|
||||
@@ -331,6 +345,10 @@ func _test_profile(main, save) -> void:
|
||||
var night_text := "Unlocked" if best >= 7 else "%d to go" % (7 - best)
|
||||
_check(main.streak.regular_milestone.text == regular_text, "regular milestone should match best streak")
|
||||
_check(main.streak.night_milestone.text == night_text, "night owl milestone should match best streak")
|
||||
_check(main.streak.stats_label.text.find("daily rooms solved") >= 0, "streak should show total dailies")
|
||||
_check(main.streak.countdown_label.text.find("Next room") >= 0, "streak should show next-daily countdown")
|
||||
main.streak._share_result()
|
||||
_check(main.streak.gift_status.text.find("clipboard") >= 0, "share result should confirm copy")
|
||||
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
|
||||
main.show_screen("profile", false)
|
||||
|
||||
@@ -438,6 +456,16 @@ func _restore_defaults(save) -> void:
|
||||
save.set_setting("reduce_motion", false)
|
||||
save.set_setting("hold_seconds", 0.35)
|
||||
save.set_setting("double_tap_place", true)
|
||||
save.set_setting("music", true)
|
||||
save.set_setting("music_volume", 0.7)
|
||||
save.set_setting("sfx", true)
|
||||
save.set_setting("sfx_volume", 0.8)
|
||||
save.set_setting("difficulty", "normal")
|
||||
save.set_player_name("Innkeeper")
|
||||
save.data["achievements"] = {}
|
||||
save.data["gift_claimed"] = []
|
||||
save.data["saved_boards"] = {}
|
||||
save.select_theme("cream")
|
||||
save.save_game()
|
||||
_check(save.rooms_completed() == 0, "save progress should be restored")
|
||||
_check(save.daily_data() == save._default_daily(), "save daily should be restored")
|
||||
|
||||
+3
-3
@@ -216,12 +216,12 @@ func _test_daily_and_frames(save, main) -> void:
|
||||
|
||||
|
||||
func _test_save_defaults(save) -> void:
|
||||
# A fresh save starts in double-tap mode at version 4.
|
||||
# A fresh save starts in double-tap mode at version 6.
|
||||
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)) == 4, "fresh saves should be version 4")
|
||||
_check(int(save.data.get("version", 0)) == 6, "fresh saves should be version 6")
|
||||
_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.
|
||||
@@ -233,7 +233,7 @@ func _test_save_defaults(save) -> void:
|
||||
file.close()
|
||||
|
||||
save.load_game()
|
||||
_check(int(save.data.get("version", 0)) == 4, "version 1 saves should migrate to version 4")
|
||||
_check(int(save.data.get("version", 0)) == 6, "version 1 saves should migrate to version 6")
|
||||
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user