feat: ISLA_BLUEPRINT_PATH + ISLA_EXPORT_DIR so tooling never touches the runtime root (terrain-water task 25, FILE SAFETY)

The task-25 file-safety rules make this structural rather than procedural. Two
env overrides, both loud on use:

  ISLA_BLUEPRINT_PATH — MapDataParser.LoadMapData loads an explicit blueprint
    FILE instead of the seed-named one in the runtime root, so capture tooling
    reads straight from a batch folder.
  ISLA_EXPORT_DIR     — MapGenerator writes EVERYTHING a run produces (both
    blueprints and every stage snapshot) into a task folder instead of the root.

Why this is needed and not merely tidy: generation ALWAYS wrote
user://MapData_Seed_<seed>.dat, and my task-22/23/24 capture scripts copied a
blueprint over that path and then rm'd it — which destroyed the blueprint the
developer had staged there to view a world in 3D. With these overrides a run
touches nothing in the root, so there is nothing to clean up afterwards and no
delete anywhere in the drivers. Verified this task: the developer's staged
MapData_Seed_1280587109.dat kept md5 dc2bc61b3eb7 across four generations and a
3D capture.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stewart Howe 2026-08-11 21:11:14 -04:00
parent 3cbe4c7967
commit 3fd14c0389
2 changed files with 51 additions and 6 deletions

View file

@ -163,6 +163,24 @@ namespace IslaApocalypse.Core
{
public static WorldBlueprint LoadMapData(string seedStr)
{
// ISLA_BLUEPRINT_PATH (task 25, FILE SAFETY): load an explicit blueprint
// FILE instead of the seed-named one in the runtime root. Capture and A/B
// tooling points this straight at a batch folder, so it never has to copy
// a blueprint over — or delete — the file the developer has staged at the
// root to view a world in 3D. Loud, so a forgotten env var cannot be
// mistaken for the root blueprint.
string envPath = OS.GetEnvironment("ISLA_BLUEPRINT_PATH");
if (!string.IsNullOrEmpty(envPath))
{
if (File.Exists(envPath))
{
GD.Print($"[MapDataParser] ⚠ ISLA_BLUEPRINT_PATH override: loading '{envPath}' " +
"(NOT the runtime-root blueprint).");
return LoadMapDataFromPath(envPath);
}
GD.PrintErr($"[MapDataParser] ISLA_BLUEPRINT_PATH set but '{envPath}' does not exist — " +
"falling back to the runtime-root blueprint.");
}
string filePath = ProjectSettings.GlobalizePath($"user://MapData_Seed_{seedStr}.dat");
return LoadMapDataFromPath(filePath);
}