feat(game-engine): Add environment-based conditional logic to disable screenshot capture in non-debug contexts

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-04-10 20:08:23 -07:00
parent 67933937c9
commit 7b45068213

View file

@ -12,15 +12,23 @@ var _captured: bool = false
func _ready() -> void:
## ScreenCapture is a persistent autoload; screenshot.sh opts in by setting
## SCREENSHOT_NAME/SCREENSHOT_SCENE. Without those env vars, stay dormant so
## normal play (and AI arena matches) don't get killed by the auto-quit
## scheduled below. Without this guard the arena loop can't complete.
var env_name: String = OS.get_environment("SCREENSHOT_NAME")
var env_scene: String = OS.get_environment("SCREENSHOT_SCENE")
if env_name.is_empty() and env_scene.is_empty():
return
var env_delay: String = OS.get_environment("SCREENSHOT_DELAY")
if not env_delay.is_empty():
_delay = float(env_delay)
var env_name: String = OS.get_environment("SCREENSHOT_NAME")
if not env_name.is_empty():
_name = env_name
_scene = OS.get_environment("SCREENSHOT_SCENE")
_scene = env_scene
get_viewport().size = Vector2i(1920, 1080)
DisplayServer.window_set_size(Vector2i(1920, 1080))