- tools/export_venues.gd (SceneTree script) saves the three factory scenarios to content/venues/<id>.tres via ResourceSaver. The factory stays the source of truth; the exported files are what an editor workflow would edit and ship. - New tests load the files back and check that id, name, event pool, profiles, policy (ID/wand), equipment, door-staff lines, shift phases, and locations all survive. They also fail when the exported files are missing or stale, so the export is re-run after content changes. - GUT is consciously not adopted: the custom headless runner already covers 157 assertions without an editor plugin and keeps CI dependency-free. Recorded in DONE.md. - TODO: the planned backlog is complete; only optional future ideas remain. - README/MEMORY updated. Version 0.2.16.
27 lines
980 B
GDScript
27 lines
980 B
GDScript
extends SceneTree
|
|
## Export the built-in scenarios to `.tres` resources for editor authoring.
|
|
##
|
|
## Usage:
|
|
## godot --headless --path . --script res://tools/export_venues.gd
|
|
##
|
|
## Writes content/venues/<id>.tres. These mirror ScenarioFactory exactly; the
|
|
## factory stays the source of truth for the prototype, and the exported files are
|
|
## what an editor-based workflow would edit and ship.
|
|
|
|
const Factory := preload("res://src/content/scenario_factory.gd")
|
|
|
|
func _initialize() -> void:
|
|
var out_dir := "res://content/venues"
|
|
DirAccess.make_dir_recursive_absolute(out_dir)
|
|
var scenarios := [Factory.hollywood_building(), Factory.joke_shop(), Factory.tv_studio()]
|
|
var failures := 0
|
|
for scenario in scenarios:
|
|
var path := "%s/%s.tres" % [out_dir, scenario.id]
|
|
var err: int = ResourceSaver.save(scenario, path)
|
|
if err == OK:
|
|
print("wrote %s" % path)
|
|
else:
|
|
printerr("failed to write %s (error %d)" % [path, err])
|
|
failures += 1
|
|
quit(0 if failures == 0 else 1)
|