Add the campaign shell, pause-safe checkpoint resume, post-shift campaign continue, confirmed campaign reset, difficulty presets, searchable Help, content-matrix validation, recovery events, contextual dialogue, policy/debrief context and eligible-event previews. Extend persistence with atomic separate files and add campaign/checkpoint/tutorial smokes. Headless 247/247, Python 94/94, tutorial/campaign/session/scenario smokes green.
71 lines
2.1 KiB
GDScript
71 lines
2.1 KiB
GDScript
extends SceneTree
|
|
## Campaign shell + checkpoint smoke. Use an isolated user-data dir:
|
|
## XDG_DATA_HOME=/tmp/gigline-campaign godot --path . --fixed-fps 60 \
|
|
## --script res://src/test/smoke_campaign.gd
|
|
|
|
var gm: Node = null
|
|
var frames := 0
|
|
var step := 0
|
|
var failures: Array[String] = []
|
|
|
|
func _initialize() -> void:
|
|
root.size = Vector2i(960, 540)
|
|
root.add_child(load("res://scenes/main.tscn").instantiate())
|
|
|
|
func _process(_delta: float) -> bool:
|
|
frames += 1
|
|
if gm == null:
|
|
gm = root.find_child("GameManager", true, false)
|
|
return false
|
|
match step:
|
|
0:
|
|
if frames < 5: return false
|
|
gm.call("_on_venue_selected", "hollywood_building")
|
|
gm.coordinator.elapsed_s = 123.0
|
|
gm.call("_save_shift_checkpoint")
|
|
gm.call("_show_start_menu")
|
|
_check(gm.start_menu.visible, "campaign menu opens")
|
|
_check(gm.start_menu.find_child("ContinueButton", true, false) != null,
|
|
"continue button exists")
|
|
step = 1
|
|
frames = 0
|
|
1:
|
|
if frames < 4: return false
|
|
gm.call("_on_campaign_continue")
|
|
step = 2
|
|
frames = 0
|
|
2:
|
|
if frames < 20: return false
|
|
_check(gm.active_scenario_id == "hollywood_building", "resume keeps the venue")
|
|
_check(gm.coordinator.elapsed_s >= 123.0, "resume keeps elapsed time")
|
|
gm.call("_on_shift_ended", gm.coordinator.build_review())
|
|
_check(gm.campaign.shift_number == 2, "campaign advances after a shift")
|
|
_check(gm.campaign.next_venue() == "joke_shop", "next venue is the Joke Shop")
|
|
gm.call("_on_review_continue")
|
|
step = 3
|
|
frames = 0
|
|
3:
|
|
if frames < 20: return false
|
|
_check(gm.active_scenario_id == "joke_shop", "review continue starts the next venue")
|
|
gm.call("_open_help")
|
|
_check(gm.help_overlay.visible, "help overlay opens")
|
|
gm.help_overlay.close_panel()
|
|
_finish()
|
|
return false
|
|
|
|
func _check(condition: bool, message: String) -> void:
|
|
if condition: print("ok: " + message)
|
|
else: _fail(message)
|
|
|
|
func _fail(message: String) -> void:
|
|
failures.append(message)
|
|
_finish()
|
|
|
|
func _finish() -> void:
|
|
if failures.is_empty():
|
|
print("SMOKE OK: campaign, checkpoint resume, review continue, help")
|
|
quit(0)
|
|
else:
|
|
for message in failures: printerr("SMOKE FAIL: " + message)
|
|
quit(1)
|