Skip to content

Commit

Permalink
Nightmare failures are now a runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Feb 23, 2024
1 parent a1c6ce1 commit efd8fee
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions code/modules/nightmare/nmtasks/mapload.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,31 @@
/datum/nmtask/mapload/proc/step_parse()
. = TRUE
if(!fexists(filepath))
log_debug("Nightmare Mapload: File does not exist: [filepath]")
return
CRASH("Nightmare Mapload: File does not exist: [filepath]")
if(!parsed)
parsed = new(file(filepath))
if(!parsed?.bounds)
log_debug("Nightmare Mapload: File loading failed: [filepath]")
return
CRASH("Nightmare Mapload: File loading failed: [filepath]")
if(isnull(parsed.bounds[1]))
log_debug("Nightmare Mapload: Map parsing failed: [filepath]")
return
CRASH("Nightmare Mapload: Map parsing failed: [filepath]")
return FALSE

/datum/nmtask/mapload/proc/step_loadmap(list/statsmap)
. = TRUE
UNTIL(!Master.map_loading)
target_turf = GLOB.nightmare_landmarks[landmark]
if(!target_turf?.z)
log_debug("Nightmare Mapload: Could not find landmark: [landmark]")
return
CRASH("Nightmare Mapload: Could not find landmark: [landmark]")
var/result = parsed.load(target_turf.x, target_turf.y, target_turf.z, crop_map = TRUE, no_changeturf = FALSE, place_on_top = FALSE, delete = replace)
if(!result || !parsed.bounds)
log_debug("Nightmare Mapload: Map insertion failed unexpectedly for file: [filepath]")
return
CRASH("Nightmare Mapload: Map insertion failed unexpectedly for file: [filepath]")
return FALSE

/datum/nmtask/mapload/proc/step_init(list/statsmap)
if(initialize_boundary_contents())
log_debug("Nightmare Mapload: Loaded '[filepath]' at '[landmark]' ([target_turf.x], [target_turf.y], [target_turf.z])")
return FALSE
log_debug("Nightmare Mapload: Loaded map file but could not initialize: '[filepath]' at ([target_turf.x], [target_turf.y], [target_turf.z])")
stack_trace("Nightmare Mapload: Loaded map file but could not initialize: '[filepath]' at ([target_turf.x], [target_turf.y], [target_turf.z])")
return TRUE

/// Initialize atoms/areas in bounds - basically a Nightmare version of [/datum/map_template/initTemplateBounds]
Expand Down

0 comments on commit efd8fee

Please sign in to comment.