22 lines
583 B
GDScript
22 lines
583 B
GDScript
extends ConfirmationDialog
|
|
|
|
var base_path = "user://saves/"
|
|
|
|
func _ready():
|
|
if not DirAccess.dir_exists_absolute(base_path):
|
|
DirAccess.make_dir_recursive_absolute(base_path)
|
|
|
|
func _on_about_to_popup():
|
|
pass # Replace with function body.
|
|
|
|
func _on_confirmed():
|
|
var filename=base_path+$LineEdit.text+".tscn"
|
|
print("Save: "+filename)
|
|
var packed_scene = PackedScene.new()
|
|
if packed_scene.pack($"../../Map") == OK:
|
|
var result = ResourceSaver.save(packed_scene,filename)
|
|
if result != OK:
|
|
print("Failed to save scene. Error #",result)
|
|
else:
|
|
print("Failed to pack scene.")
|