Save game when the window is closed
parent
a3814445db
commit
aa87dabbf1
|
@ -1,6 +1,7 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
onready var _light = $DirectionalLight
|
onready var _light = $DirectionalLight
|
||||||
|
onready var _terrain = $VoxelTerrain
|
||||||
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
func _unhandled_input(event):
|
||||||
|
@ -11,3 +12,14 @@ func _unhandled_input(event):
|
||||||
# Toggle shadows
|
# Toggle shadows
|
||||||
_light.shadow_enabled = not _light.shadow_enabled
|
_light.shadow_enabled = not _light.shadow_enabled
|
||||||
|
|
||||||
|
|
||||||
|
func _notification(what: int):
|
||||||
|
match what:
|
||||||
|
NOTIFICATION_WM_QUIT_REQUEST:
|
||||||
|
# Save game when the user closes the window
|
||||||
|
_save_world()
|
||||||
|
|
||||||
|
|
||||||
|
func _save_world():
|
||||||
|
_terrain.save_modified_blocks()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue