Skip to content

Commit

Permalink
Nightmare Insert Fixes & Elevated Nightmare Errors (#5796)
Browse files Browse the repository at this point in the history
# About the pull request

This PR elevates nightmare insert errors to a runtime so they fail
checks and corrects errors, removes, or properly disables inserts that
were causing the errors in the first place.

# Explain why it's good for the game

Fixes #5558 Various nightmares were not loading because of issues; this
should restore various nightmares.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/76988376/5d883704-806b-4d32-8b21-82bad7eebac7)

</details>


# Changelog
:cl: Drathek BadAtThisGame
maptweak: Fixed various nightmare inserts that were not spawning;
removing or disabling others that were not in use.
maptweak: Updated containerroom_xenos insert for Solaris Ridge to
include coms tower (BadAtThisGame)
code: Nightmare errors are now a runtime.
/:cl:
  • Loading branch information
Drulikar committed Feb 29, 2024
1 parent c8abab5 commit 5bdc65d
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 336 deletions.
1 change: 1 addition & 0 deletions code/_globalvars/lists/mapping_globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ GLOBAL_LIST_EMPTY(teleporter_landmarks)

GLOBAL_LIST_INIT(cardinals, list(NORTH, SOUTH, EAST, WEST))
GLOBAL_LIST_EMPTY(nightmare_landmarks)
GLOBAL_LIST_EMPTY(nightmare_landmark_tags_removed)

GLOBAL_LIST_EMPTY(ship_areas)

Expand Down
8 changes: 5 additions & 3 deletions code/game/objects/effects/landmarks/landmarks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@
return
GLOB.nightmare_landmarks[insert_tag] = get_turf(src)
/obj/effect/landmark/nightmare/Destroy()
if(insert_tag && autoremove \
&& GLOB.nightmare_landmarks[insert_tag] == get_turf(src))
GLOB.nightmare_landmarks.Remove(insert_tag)
if(insert_tag)
var/turf/turf = get_turf(src)
if(autoremove && GLOB.nightmare_landmarks[insert_tag] == turf)
GLOB.nightmare_landmarks.Remove(insert_tag)
GLOB.nightmare_landmark_tags_removed += insert_tag
return ..()

/obj/effect/landmark/ert_spawns/distress
Expand Down
2 changes: 1 addition & 1 deletion code/modules/nightmare/nmnodes/mapload.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
. = ..()
if(!.) return
var/dir_path = context.get_file_path(filepath, "map")
var/regex/matcher = new(@"^([0-9]+)([\.\+])([^_]+)(_.*)?\.dmm$", "i")
var/regex/matcher = new(@"^([0-9]+)([\.\+])(([^_]+)(_.*))?\.dmm$", "i")
var/list/dircontents = flist(dir_path)
for(var/filename in dircontents)
if(!matcher.Find(filename))
Expand Down
21 changes: 10 additions & 11 deletions code/modules/nightmare/nmtasks/mapload.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,35 @@
/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
if(landmark in GLOB.nightmare_landmark_tags_removed)
log_debug("Nightmare Mapload: Could not find landmark: [landmark] because it was deleted")
return
else
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
40 changes: 23 additions & 17 deletions maps/map_files/BigRed/BigRed.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -12602,7 +12602,7 @@
/area/bigredv2/outside/office_complex)
"aLh" = (
/obj/effect/landmark/nightmare{
insert_tag = "lz1north"
insert_tag = "lz1north_mining"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/space_port)
Expand Down Expand Up @@ -27195,6 +27195,12 @@
icon_state = "red"
},
/area/bigredv2/outside/marshal_office)
"cGv" = (
/obj/effect/landmark/nightmare{
insert_tag = "containerroom_xenos"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/nw/ceiling)
"cGQ" = (
/obj/structure/blocker/forcefield/multitile_vehicles,
/turf/open/floor{
Expand Down Expand Up @@ -28358,7 +28364,7 @@
/area/bigredv2/outside/dorms)
"ers" = (
/obj/effect/landmark/nightmare{
insert_tag = "etatunnel"
insert_tag = "etatunnel_open"
},
/turf/closed/wall/solaris/rock,
/area/bigredv2/caves)
Expand Down Expand Up @@ -28711,7 +28717,7 @@
/area/bigredv2/caves/mining)
"eUT" = (
/obj/effect/landmark/nightmare{
insert_tag = "viro-rock"
insert_tag = "viro-rock_open"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/virology)
Expand Down Expand Up @@ -31090,7 +31096,7 @@
/area/bigredv2/outside/space_port_lz2)
"iIp" = (
/obj/effect/landmark/nightmare{
insert_tag = "chapel"
insert_tag = "chapel_cult"
},
/turf/closed/wall/solaris,
/area/bigredv2/outside/chapel)
Expand Down Expand Up @@ -31315,7 +31321,7 @@
/area/bigredv2/caves/mining)
"jcn" = (
/obj/effect/landmark/nightmare{
insert_tag = "tcomms"
insert_tag = "tcomms_open"
},
/turf/closed/wall/solaris/rock,
/area/bigredv2/caves)
Expand Down Expand Up @@ -31467,7 +31473,7 @@
dir = 5
},
/obj/effect/landmark/nightmare{
insert_tag = "dorms"
insert_tag = "dorms_party"
},
/turf/open/floor,
/area/bigredv2/outside/dorms)
Expand Down Expand Up @@ -33265,7 +33271,7 @@
/area/bigredv2/caves/mining)
"lMt" = (
/obj/effect/landmark/nightmare{
insert_tag = "cargo"
insert_tag = "cargo_containers"
},
/turf/closed/wall/solaris,
/area/bigredv2/outside/cargo)
Expand All @@ -33280,7 +33286,7 @@
/area/bigredv2/caves_lambda)
"lMB" = (
/obj/effect/landmark/nightmare{
insert_tag = "lz1cave"
insert_tag = "lz1cave_flank"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/space_port)
Expand Down Expand Up @@ -34454,7 +34460,7 @@
/area/bigredv2/outside/filtration_cave_cas)
"nGt" = (
/obj/effect/landmark/nightmare{
insert_tag = "admin"
insert_tag = "admin_pmc"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/admin_building)
Expand Down Expand Up @@ -35469,7 +35475,7 @@
/area/bigredv2/outside/admin_building)
"pdN" = (
/obj/effect/landmark/nightmare{
insert_tag = "lz1entrance"
insert_tag = "lz1entrance_v2"
},
/turf/open/mars,
/area/bigredv2/outside/nw)
Expand Down Expand Up @@ -36590,7 +36596,7 @@
/area/bigredv2/caves/mining)
"qTu" = (
/obj/effect/landmark/nightmare{
insert_tag = "viro"
insert_tag = "viro_open"
},
/turf/closed/wall/solaris/rock,
/area/bigredv2/caves)
Expand Down Expand Up @@ -36927,7 +36933,7 @@
/area/bigredv2/caves/mining)
"rrl" = (
/obj/effect/landmark/nightmare{
insert_tag = "filtration"
insert_tag = "filtration_restored"
},
/turf/open/mars_cave{
icon_state = "mars_cave_2"
Expand Down Expand Up @@ -38943,7 +38949,7 @@
/area/bigredv2/caves/mining)
"tYM" = (
/obj/effect/landmark/nightmare{
insert_tag = "prison"
insert_tag = "prison_breakout"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/outside/marshal_office)
Expand Down Expand Up @@ -39277,7 +39283,7 @@
/area/bigredv2/caves/mining)
"uCD" = (
/obj/effect/landmark/nightmare{
insert_tag = "reactor"
insert_tag = "reactor_meltdown"
},
/turf/closed/wall/solaris/rock,
/area/bigredv2/caves)
Expand Down Expand Up @@ -39883,7 +39889,7 @@
/area/bigredv2/caves/eta/research)
"vvi" = (
/obj/effect/landmark/nightmare{
insert_tag = "lz1containers"
insert_tag = "lz1containers_scramble"
},
/turf/open/floor{
dir = 4;
Expand Down Expand Up @@ -41717,7 +41723,7 @@
/area/bigredv2/outside/n)
"yfe" = (
/obj/effect/landmark/nightmare{
insert_tag = "eta"
insert_tag = "eta_carp"
},
/turf/closed/wall/solaris/reinforced,
/area/bigredv2/caves/eta/xenobiology)
Expand Down Expand Up @@ -49956,7 +49962,7 @@ axv
anp
anp
anp
anp
cGv
ajx
ajY
akK
Expand Down
Loading

0 comments on commit 5bdc65d

Please sign in to comment.