From 1949320e8826f1f2d74f5f5b70eedeb386f937ac Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 21 Sep 2025 19:41:05 +0200 Subject: Add screenshot and sceneshot --- client/gui/menus/game.gd | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'client/gui') diff --git a/client/gui/menus/game.gd b/client/gui/menus/game.gd index 0bf44484..97c8cc1d 100644 --- a/client/gui/menus/game.gd +++ b/client/gui/menus/game.gd @@ -37,6 +37,20 @@ func _input(_event): await submenu("res://gui/menus/chat.tscn") chat_preview.visible = true + if Input.is_action_just_pressed("screenshot"): + get_viewport().get_texture().get_image().save_png(get_shot_path("screenshot-%s.png")) + if Input.is_action_just_pressed("sceneshot"): + var doc := GLTFDocument.new() + var state := GLTFState.new() + doc.append_from_scene(game, state) + doc.write_to_filesystem(state, get_shot_path("sceneshot-%s.glb")) + +func get_shot_path(template: String) -> String: + var path = Settings.read("gameplay.screenshot_path") + if path == "": path = "user://" + var filename = template % Time.get_datetime_string_from_system() + return "%s/%s" % [path, filename] + func _menu_cover(state): game.follow_camera.disable_input_menu = state game.follow_camera.update_disable_input() -- cgit v1.2.3-70-g09d2