diff options
author | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
---|---|---|
committer | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
commit | 71b3cd829f80de4c2cd3972d8bfd5ee470a5d180 (patch) | |
tree | b4280fde6eef2ae6987648bc7bf8e00e9011bb7f /game/addons/zylann.hterrain/hterrain_resource_saver.gd | |
parent | ce9022d0df74d6c33db3686622be2050d873ab0b (diff) |
init_testtest3d
Diffstat (limited to 'game/addons/zylann.hterrain/hterrain_resource_saver.gd')
-rw-r--r-- | game/addons/zylann.hterrain/hterrain_resource_saver.gd | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/hterrain_resource_saver.gd b/game/addons/zylann.hterrain/hterrain_resource_saver.gd new file mode 100644 index 0000000..be757e8 --- /dev/null +++ b/game/addons/zylann.hterrain/hterrain_resource_saver.gd @@ -0,0 +1,29 @@ +@tool +class_name HTerrainDataSaver +extends ResourceFormatSaver + + +const HTerrainData = preload("./hterrain_data.gd") + + +func _get_recognized_extensions(res: Resource) -> PackedStringArray: + if res != null and res is HTerrainData: + return PackedStringArray([HTerrainData.META_EXTENSION]) + return PackedStringArray() + + +func _recognize(res: Resource) -> bool: + return res is HTerrainData + + +func _save(resource: Resource, path: String, flags: int) -> Error: + if resource.save_data(path.get_base_dir()): + return OK + # This can occur if at least one map of the terrain fails to save. + # It doesnt necessarily mean the entire terrain failed to save. + return FAILED + + +# TODO Handle UIDs +# func _set_uid(path: String, uid: int) -> int: +# ??? |