utils/godot_dev_tools/tests/stub_host.gd
Krzysztof kuhy Rudnicki db2650b9c9 Add godot_dev_tools 0.1.0
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWXs4gEhEUMr9rgYG9V
2026-11-16 14:29:48 +01:00

49 lines
1.3 KiB
GDScript

extends RefCounted
## A minimal host for the dev_tools addon: what a game would hand in, with a
## fixed answer for everything, and a record of what the addon asked of it.
## No class_name (tests load it by path).
var game := "stub-game"
var feedback_env := "STUB_FEEDBACK_DIR"
var colors := {"mark": Color(0.0, 1.0, 0.0)}
var menu: Array = []
var menu_closed := 0
var resets := 0
var telemetry: RefCounted = null
func debug_state() -> Dictionary:
return {"screen": "hub", "items": [{"id": "thing"}]}
func pick_at(at: Vector2) -> Dictionary:
if at.x < 100.0:
return {"kind": "stub", "id": "thing", "state": "idle", "position": [at.x, at.y]}
return {}
func context(state: Dictionary) -> Dictionary:
return {"screen": state["screen"], "mode": "stub", "variant": {"seed": 7}}
func reset_progress() -> int:
resets += 1
return 3
func add_menu_entry(id: String, icon: Texture2D, spoken: String, on_press: Callable) -> void:
menu.append({"id": id, "icon": icon, "spoken": spoken, "press": on_press})
func close_menu() -> void:
menu_closed += 1
func attach_telemetry(p_telemetry: RefCounted) -> void:
telemetry = p_telemetry
telemetry.entry("host_attached", {"game": game})
func summary_line(record: Dictionary) -> String:
return "- Stub screen `%s`" % record.get("screen", "-")