extends SceneTree func _initialize() -> void: call_deferred("run") func run() -> void: var agent = load("res://core/network/managed_cabinet.gd").new() root.add_child(agent) var injected := false var started_at := -1 for i in range(350): await create_timer(.1).timeout if agent.phase == "playing" and started_at < 0: started_at = Time.get_ticks_msec() if agent.phase == "playing" and not injected: if agent.cabinet_id == "cabinet_02": injected = true agent.game._add_score(499) assert(agent.game.is_running and agent.game.state != "victory", "499 must not win") await create_timer(.3).timeout assert(agent.phase == "playing") agent.game._add_score(1) elif agent.cabinet_id == "cabinet_03" and agent.game.phase == "play": injected = true assert(agent.game.homes.count(true) == 0) agent.game.frog = Vector2(112,40) agent.game.hop_left = 0 agent.game.step_world(0.0) assert(agent.game.homes.count(true) == 1) if agent.phase == "won": if agent.cabinet_id == "cabinet_01": assert(Time.get_ticks_msec()-started_at >= 4800, "Timer must run for five seconds") elif agent.cabinet_id == "cabinet_02": assert(agent.game.score == 500) elif agent.cabinet_id == "cabinet_03": assert(agent.game.homes.count(true) == 1) await create_timer(1.0).timeout quit() return push_error("Objective integration timed out on " + agent.cabinet_id) quit(1)