Implement prototype: venue-driven simulation core, scenarios, tests, and playable entrance scene
CI / headless-tests (push) Canceled after 49s
CI / headless-tests (push) Canceled after 49s
- Godot 4.3 project scaffold with first-person guard, procedural world, interaction HUD, access inspection, radio forms, debug overlay, shift review - Simulation core: ShiftCoordinator, VenueScenario, EventScheduler, NPCController/FSM, AccessVerifier, EscalationManager, RadioSystem, IncidentRecorder, ReputationEvaluator, CrowdSystem, EventBus - Three authored scenarios (Hollywood Blvd building, The Joke Shop, TV studio) - Custom headless test runner (25 tests) replacing editor-dependent GUT, plus GitHub Actions CI - Documentation workflow live: README, PLAN (tech stack), TODO/DONE, MEMORY
This commit is contained in:
1 parent
e23f284ad4
commit
439e0a4281
45 files changed
+4368
-7
No files matched your search
@@ -0,0 +1,39 @@
|
||||
extends Node
|
||||
## Autoload for local persistence (JSON in user://). Wrapped in an autoload so UI
|
||||
## nodes never touch the filesystem directly.
|
||||
|
||||
const SHIFT_RESULTS_FILE := "shift_results.json"
|
||||
const SETTINGS_FILE := "settings.json"
|
||||
|
||||
func _load_json(file_name: String) -> Variant:
|
||||
var path := "user://" + file_name
|
||||
if not FileAccess.file_exists(path):
|
||||
return null
|
||||
var text := FileAccess.get_file_as_string(path)
|
||||
if text.is_empty():
|
||||
return null
|
||||
var parsed = JSON.parse_string(text)
|
||||
return parsed
|
||||
|
||||
func _save_json(file_name: String, data: Variant) -> Error:
|
||||
var path := "user://" + file_name
|
||||
var text := JSON.stringify(data, "\t")
|
||||
var f := FileAccess.open(path, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return FileAccess.get_open_error()
|
||||
f.store_string(text)
|
||||
f.close()
|
||||
return OK
|
||||
|
||||
## Load previous shift results. Returns Array of Dictionaries or [].
|
||||
func load_shift_results() -> Array:
|
||||
var data = _load_json(SHIFT_RESULTS_FILE)
|
||||
if data is Array:
|
||||
return data
|
||||
return []
|
||||
|
||||
## Append one shift result and save. Returns Error.
|
||||
func save_shift_result(result: Dictionary) -> Error:
|
||||
var results := load_shift_results()
|
||||
results.append(result)
|
||||
return _save_json(SHIFT_RESULTS_FILE, results)
|
||||
Reference in new issue
Block a user