extends SceneTree func _init(): print("=== SANDBOX PROBE START ===") probe_script_loading() probe_os_apis() probe_file_access() probe_network() probe_engine_apis() print("=== SANDBOX PROBE END ===") quit() func probe_script_loading(): print("--- Script loading ---") # Can we load a GDScript from a string at runtime? var gd = GDScript.new() gd.source_code = "extends RefCounted\nfunc hello():\n\treturn 42\n" var err = gd.reload() print("GDScript.reload() from source_code err=", err) if err == OK: var inst = gd.new() print(" instantiated, hello()=", inst.call("hello")) # Can we load a script resource from a path? var res = load("res://test_script.gd") print("load('res://test_script.gd') = ", res) func probe_os_apis(): print("--- OS APIs ---") # Can we execute shell commands? var out = [] var exit_code = OS.execute("echo", ["hello"], out) print("OS.execute('echo') exit=", exit_code, " out=", out) # Environment access print("OS.get_environment('HOME') = ", OS.get_environment("HOME")) # Process spawning print("OS.create_process available: ", OS.has_method("create_process")) func probe_file_access(): print("--- File access ---") # Can we read arbitrary files? var f = FileAccess.open("/etc/hostname", FileAccess.READ) print("FileAccess.open('/etc/hostname') = ", f) if f: print(" content: ", f.get_as_text()) f.close() # Can we write outside the project? var w = FileAccess.open("/tmp/godot_probe_write.txt", FileAccess.WRITE) print("FileAccess.open('/tmp/...', WRITE) = ", w) if w: w.store_string("probe") w.close() print(" wrote to /tmp OK") func probe_network(): print("--- Network ---") # Can we open raw sockets? var tcp = TCPServer.new() var bind_err = tcp.listen(0) print("TCPServer.listen(0) err=", bind_err) # HTTP client var http = HTTPClient.new() print("HTTPClient instantiated: ", http != null) func probe_engine_apis(): print("--- Engine APIs ---") # Can we access the scene tree / add nodes? var node = Node.new() print("Node.new() = ", node) # Can we access ProjectSettings? print("ProjectSettings.get_setting('application/config/name') = ", ProjectSettings.get_setting("application/config/name")) # Can we access the OS shell / clipboard? print("OS.get_clipboard() = ", OS.get_clipboard()) # Can we access the filesystem directory listing? var dir = DirAccess.open("/") print("DirAccess.open('/') = ", dir) if dir: var names = dir.get_files() print(" root files count: ", names.size())