Moves the departmental delivery area check to a unit test so it stops spamming logs (#83215)

## About The Pull Request

So, thanks to the map not being loaded yet when jobs are initialized,
the logs are needlessly spammed by a check that can never pass.

![image](https://github.com/tgstation/tgstation/assets/49160555/add92847-9d41-49b0-a951-4f40fdfd283f)

Also adds some possible locations to engineering and science

As such, I just moved all this logging stuff and screaming at
mappers/coders into a unit test. I honestly only have very vague
understanding of how these work so someone with more knowledge please
check if I did everything right.
This commit is contained in:
Waterpig
2024-05-15 10:17:18 +02:00
committed by GitHub
parent 32ff8d1b52
commit e143e52a8a
6 changed files with 31 additions and 11 deletions
+1
View File
@@ -7,6 +7,7 @@
"load_all_away_missions": true,
"ignored_unit_tests": [
"/datum/unit_test/antag_moodlets",
"/datum/unit_test/cargo_dep_order_locations",
"/datum/unit_test/job_roundstart_spawnpoints",
"/datum/unit_test/required_map_items",
"/datum/unit_test/space_dragon_expiration",
+1
View File
@@ -4,6 +4,7 @@
"map_path": "map_files/debug",
"map_file": "multiz.dmm",
"ignored_unit_tests": [
"/datum/unit_test/cargo_dep_order_locations",
"/datum/unit_test/job_roundstart_spawnpoints",
"/datum/unit_test/required_map_items",
"/datum/unit_test/spy_bounty"
+1
View File
@@ -5,6 +5,7 @@
"map_file": "runtimestation.dmm",
"space_ruin_levels": 1,
"ignored_unit_tests": [
"/datum/unit_test/cargo_dep_order_locations",
"/datum/unit_test/job_roundstart_spawnpoints",
"/datum/unit_test/required_map_items",
"/datum/unit_test/spy_bounty"
+9 -11
View File
@@ -28,15 +28,6 @@
/// A list of generic access flags people in this department generally have.
var/list/department_access = list()
/datum/job_department/New()
. = ..()
for(var/delivery_area_type in department_delivery_areas)
if(GLOB.areas_by_type[delivery_area_type])
return
//every area fallback didn't exist on this map so throw a mapping error and set some generic area that uuuh please exist okay
log_mapping("[type] has no valid areas to deliver to on this map, add some more fallback areas to its \"department_delivery_areas\" var.")
department_delivery_areas = list(/area/station/hallway/primary/central) //if this doesn't exist like honestly fuck your map man
/// Handles adding jobs to the department and setting up the job bitflags.
/datum/job_department/proc/add_job(datum/job/job)
department_jobs += job
@@ -111,7 +102,10 @@
label_class = "engineering"
ui_color = "#dfb567"
nation_prefixes = list("Atomo", "Engino", "Power", "Teleco")
department_delivery_areas = list(/area/station/engineering/main)
department_delivery_areas = list(
/area/station/engineering/main,
/area/station/engineering/lobby,
)
associated_cargo_groups = list("Engineering", "Engine Construction", "Canisters & Materials")
head_of_staff_access = ACCESS_CE
department_access = REGION_ACCESS_ENGINEERING
@@ -144,7 +138,11 @@
label_class = "science"
ui_color = "#c973c9"
nation_prefixes = list("Sci", "Griffa", "Geneti", "Explosi", "Mecha", "Xeno", "Nani", "Cyto")
department_delivery_areas = list(/area/station/science/research)
department_delivery_areas = list(
/area/station/science/research,
/area/station/science/lobby,
/area/station/science/lab,
)
associated_cargo_groups = list("Science", "Livestock", "Canisters & Materials")
head_of_staff_access = ACCESS_RD
department_access = REGION_ACCESS_RESEARCH
+1
View File
@@ -109,6 +109,7 @@
#include "cable_powernets.dm"
#include "card_mismatch.dm"
#include "cardboard_cutouts.dm"
#include "cargo_dep_order_locations.dm"
#include "cargo_selling.dm"
#include "chain_pull_through_space.dm"
#include "changeling.dm"
@@ -0,0 +1,18 @@
/datum/unit_test/cargo_dep_order_locations
/datum/unit_test/cargo_dep_order_locations/Run()
for(var/datum/job_department/department as anything in SSjob.joinable_departments)
var/delivery_areas = department.department_delivery_areas
if(!length(delivery_areas))
continue
if(check_valid_delivery_location(delivery_areas))
continue
TEST_FAIL("[department.type] failed to find a valid delivery location on this map.")
/datum/unit_test/cargo_dep_order_locations/proc/check_valid_delivery_location(list/delivery_areas)
for(var/delivery_area_type in delivery_areas)
if(GLOB.areas_by_type[delivery_area_type])
return TRUE
return FALSE