From 8255935704fefb29fa2c859b871706e9aa78fbe4 Mon Sep 17 00:00:00 2001 From: DreamySkrell <107256943+DreamySkrell@users.noreply.github.com> Date: Sun, 16 Jun 2024 04:58:22 +0200 Subject: [PATCH] BAPI - mapmanip insert/extract failsafe (#19466) ![image](https://github.com/Aurorastation/Aurora.3/assets/107256943/2f68fb6c-716b-46c3-81b8-b89c84db830a) ![image](https://github.com/Aurorastation/Aurora.3/assets/107256943/9c2547b2-7977-4e16-ab75-61b2f22a6afd) !fixes https://github.com/Aurorastation/Aurora.3/issues/19456 --------- Co-authored-by: DreamySkrell <> --- code/modules/maps/reader.dm | 12 ++++++++++-- .../DreamySkrell-bapi-insert-extract-failsafe.yml | 7 +++++++ maps/sccv_horizon/sccv_horizon-1_deck_1.dmm | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/DreamySkrell-bapi-insert-extract-failsafe.yml diff --git a/code/modules/maps/reader.dm b/code/modules/maps/reader.dm index faa66bf4e16..fe7aa408ce6 100644 --- a/code/modules/maps/reader.dm +++ b/code/modules/maps/reader.dm @@ -50,8 +50,16 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new) /dmm_suite/proc/load_map_impl(dmm_file, x_offset, y_offset, z_offset, cropMap, measureOnly, no_changeturf, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper = INFINITY) var/tfile = dmm_file//the map file we're creating if(isfile(tfile)) - // tfile = file2text(tfile) - tfile = bapi_read_dmm_file("[tfile]") // `tfile` is of type `File`, this makes it into just a string of its path + // name/path of dmm file, new var so as to not rename the `tfile` var + // to maybe maintain compatibility with other codebases + var/tfilepath = "[tfile]" + // use bapi to read, parse, process, mapmanip etc + // this will "crash"/stacktrace on fail + tfile = bapi_read_dmm_file(tfilepath) + // if bapi for whatever reason fails and returns null + // try to load it the old dm way instead + if(!tfile) + tfile = file2text(tfilepath) if(!x_offset) x_offset = 1 diff --git a/html/changelogs/DreamySkrell-bapi-insert-extract-failsafe.yml b/html/changelogs/DreamySkrell-bapi-insert-extract-failsafe.yml new file mode 100644 index 00000000000..c1be223220d --- /dev/null +++ b/html/changelogs/DreamySkrell-bapi-insert-extract-failsafe.yml @@ -0,0 +1,7 @@ + +author: DreamySkrell + +delete-after: True + +changes: + - rscadd: "BAPI - mapmanip insert/extract failsafe." diff --git a/maps/sccv_horizon/sccv_horizon-1_deck_1.dmm b/maps/sccv_horizon/sccv_horizon-1_deck_1.dmm index ba712bd3b25..c553428ba0f 100644 --- a/maps/sccv_horizon/sccv_horizon-1_deck_1.dmm +++ b/maps/sccv_horizon/sccv_horizon-1_deck_1.dmm @@ -21038,7 +21038,7 @@ /area/hangar/auxiliary) "owJ" = ( /obj/effect/map_effect/marker/mapmanip/submap/insert/sccv_horizon/ops_warehouse_small_storage, -/turf/template_noop, +/turf/simulated/floor/plating, /area/operations/storage) "owM" = ( /obj/structure/shuttle_part/scc/research{ @@ -30346,7 +30346,7 @@ /turf/simulated/floor/plating, /area/shuttle/intrepid/cockpit) "uTy" = ( -/turf/template_noop, +/turf/simulated/floor/plating, /area/operations/storage) "uTz" = ( /obj/machinery/atmospherics/pipe/simple/hidden/supply,