From 71b3cd829f80de4c2cd3972d8bfd5ee470a5d180 Mon Sep 17 00:00:00 2001 From: Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> Date: Sat, 22 Jul 2023 21:05:42 +0200 Subject: init_test --- .../zylann.hterrain/hterrain_resource_saver.gd | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 game/addons/zylann.hterrain/hterrain_resource_saver.gd (limited to 'game/addons/zylann.hterrain/hterrain_resource_saver.gd') 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: +# ??? -- cgit v1.2.3-56-ga3b1