Loads Away Missions for Unit Testing (#76245)

## About The Pull Request

Hey there,

A pretty bad bug (#76226) got through, but it was fixed pretty quickly
in #76241 (cf92862daf). I realized that if
we were testing all the away missions, that this could theoretically get
caught and not happen again. Regardless, unit testing gateway missions
has been on my to-do list for a while now, and I finally got it nailed
down.

Basically, we just have a really small "station" map with the bare bones
(_teeny_ bit of fluff, maploading is going to take 30 seconds tops
anyways let me have my kicks) with a JSON map datum flag that causes it
to load all away missions in the codebase (which are all in one folder).
Just in case some admins were planning on invoking the proc on
`SSmapping`, I also decided to gate a `tgui_alert()` behind it because
you never can be too sure of what people think is funny these days (it
really does lock up your game for a second or so at a time).

I also alphabetized the maps.txt config because that was annoying me.
## Why It's Good For The Game

Things that break on production could(?) be caught in unit testing? I
don't know if the linked issue I mentioned above would have been caught
in retrospect, but it's likely to catch more than a few upcoming bugs
(like the UO45 atmospherics thing at the very top) and ensure that these
gateway missions, which tend to be the most neglected part of mapping,
stay bug-free.

This is also helpful in case someone makes a new away mission and wants
to see if stuff's broken. Helps out maptainers a bit because very, very
technically broken mapping will throw up runtimes. Neato.
## Changelog
Nothing that players should be concerned about.

Let me know if there's a better way to approach this, but I really think
that having a super-duper light map with the bare basics to load up
gateway missions and then all nine-ish gateway missions can sequentially
load during init. I can't think of a better way to do it aside from some
really ugly `#ifdef` shit. Also also, it has the added benefit of being
a map that will always load your away mission without touching a single
shred of config (and it's not likely to break if you follow sane
practices such as making your own areas)
This commit is contained in:
san7890
2023-07-05 20:40:24 -06:00
committed by GitHub
parent 31179f059d
commit 755fa4db6d
16 changed files with 952 additions and 384 deletions
+5
View File
@@ -1769,3 +1769,8 @@
web_sound(usr, link_url, credit)
else if(href_list["debug_z_levels"])
if(!check_rights(R_DEBUG))
return
owner.debug_z_levels()
+35 -29
View File
@@ -319,9 +319,14 @@ GLOBAL_VAR_INIT(say_disabled, FALSE)
set name = "Debug Z-Levels"
set category = "Mapping"
var/list/z_list = SSmapping.z_list
to_chat(src, examine_block(gather_z_level_information(append_grid = TRUE)), confidential = TRUE)
/// Returns all necessary z-level information. Argument `append_grid` allows the user to see a table showing all of the z-level linkages, which is only visible and useful in-game.
/proc/gather_z_level_information(append_grid = FALSE)
var/list/messages = list()
messages += "<b>World</b>: [world.maxx] x [world.maxy] x [world.maxz]<br><br>"
var/list/z_list = SSmapping.z_list
messages += "\n<b>World</b>: [world.maxx] x [world.maxy] x [world.maxz]\n"
var/list/linked_levels = list()
var/min_x = INFINITY
@@ -331,49 +336,50 @@ GLOBAL_VAR_INIT(say_disabled, FALSE)
for(var/z in 1 to max(world.maxz, z_list.len))
if (z > z_list.len)
messages += "<b>[z]</b>: Unmanaged (out of bounds)<br>"
messages += "<b>[z]</b>: Unmanaged (out of bounds)"
continue
var/datum/space_level/S = z_list[z]
if (!S)
messages += "<b>[z]</b>: Unmanaged (null)<br>"
var/datum/space_level/level = z_list[z]
if (!level)
messages += "<b>[z]</b>: Unmanaged (null)"
continue
var/linkage
switch (S.linkage)
switch (level.linkage)
if (UNAFFECTED)
linkage = "no linkage"
if (SELFLOOPING)
linkage = "self-looping"
if (CROSSLINKED)
linkage = "linked at ([S.xi], [S.yi])"
linked_levels += S
min_x = min(min_x, S.xi)
min_y = min(min_y, S.yi)
max_x = max(max_x, S.xi)
max_y = max(max_y, S.yi)
linkage = "linked at ([level.xi], [level.yi])"
linked_levels += level
min_x = min(min_x, level.xi)
min_y = min(min_y, level.yi)
max_x = max(max_x, level.xi)
max_y = max(max_y, level.yi)
else
linkage = "unknown linkage '[S.linkage]'"
linkage = "unknown linkage '[level.linkage]'"
messages += "<b>[z]</b>: [S.name], [linkage], traits: [json_encode(S.traits)]<br>"
if (S.z_value != z)
messages += "-- z_value is [S.z_value], should be [z]<br>"
if (S.name == initial(S.name))
messages += "-- name not set<br>"
messages += "<b>[z]</b>: [level.name], [linkage], traits: [json_encode(level.traits)]"
if (level.z_value != z)
messages += "-- z_value is [level.z_value], should be [z]"
if (level.name == initial(level.name))
messages += "-- name not set"
if (z > world.maxz)
messages += "-- exceeds max z"
var/grid[max_x - min_x + 1][max_y - min_y + 1]
for(var/datum/space_level/S in linked_levels)
grid[S.xi - min_x + 1][S.yi - min_y + 1] = S.z_value
for(var/datum/space_level/linked_level in linked_levels)
grid[linked_level.xi - min_x + 1][linked_level.yi - min_y + 1] = linked_level.z_value
messages += "<br><table border='1'>"
for(var/y in max_y to min_y step -1)
var/list/part = list()
for(var/x in min_x to max_x)
part += "[grid[x - min_x + 1][y - min_y + 1]]"
messages += "<tr><td>[part.Join("</td><td>")]</td></tr>"
messages += "</table>"
if(append_grid)
messages += "<br><table border='1'>"
for(var/y in max_y to min_y step -1)
var/list/part = list()
for(var/x in min_x to max_x)
part += "[grid[x - min_x + 1][y - min_y + 1]]"
messages += "<tr><td>[part.Join("</td><td>")]</td></tr>"
messages += "</table>"
to_chat(src, examine_block(messages.Join("")), confidential = TRUE)
return messages.Join("\n")
/client/proc/station_food_debug()
set name = "Count Station Food"