Files
Bubberstation/code/modules/unit_tests/mapping_nearstation_test.dm
SimplyLogan 2faa874b3b Speed up Mapper testing with a prefix "maptest_" in VSCode (#93238)
## About The Pull Request

One of the development hell cycles with mapping is how long it takes to
fix quality or run issues with maps.

By adding a prefix called "maptest_" to some of the unit tests it allows
mappers to only target some tests instead of the usual 350+ tests to run
each time or trying to trigger them individually and faffing.

This does not rename the unit test files themselves to preserve history
but just the "/datum/unit_test/" in each file.

This does not break the current CI or obstruct other tests - A few other
map files that call these tests specifically have been edited to point
at the new datum name.

This assumes you are using the TG testing extension to do this.

| All Tests | maptest_ |
|--------|--------|
| <img width="426" height="106" alt="image"
src="https://github.com/user-attachments/assets/d1d6f81e-16bd-473a-88da-e8b56f8bd3d0"
/> | <img width="434" height="96" alt="image"
src="https://github.com/user-attachments/assets/ea1c47fe-a6ce-40c6-b2cb-65b9c8e94a29"
/> |
| <img width="360" height="886" alt="image"
src="https://github.com/user-attachments/assets/65bcd774-79ad-432e-8211-c67fb9d3e443"
/> | <img width="370" height="833" alt="Screenshot 2025-10-01 204609"
src="https://github.com/user-attachments/assets/ad360796-5698-42fd-bd2e-51de1a02ab87"
/> |
## Why It's Good For The Game

- Should make it easier for mappers to test locally, saving CI/Github
resource for TG
- Mappers can now test their work 56% faster
## Changelog
🆑
code: Mappers can now run just mapping unit tests - Should be 56% faster
- Should have no player impact
/🆑

Co-authored-by: loganuk <falseemail@aol.com>
2025-10-05 16:25:51 -06:00

41 lines
2.3 KiB
Plaintext

///Detects movables that may have been accidentally placed in space, as well as movables which do not have the proper nearspace area (meaning they aren't lit properly.)
/datum/unit_test/maptest_mapping_nearstation_test
priority = TEST_PRE
/datum/unit_test/maptest_mapping_nearstation_test/Run()
if(SSmapping.is_planetary())
return //No need to test for orphaned spaced atoms on this map.
var/list/safe_atoms = typecacheof(list(
/atom/movable/mirage_holder,
/obj/docking_port,
/obj/effect/landmark,
/obj/effect/abstract,
/obj/effect/mapping_error,
)) //Mapping stuff that we don't actually have to be concerned about.
var/list/safe_areas = typecacheof(list(
/area/misc/testroom,
/area/station/holodeck,
))
for(var/station_z in SSmapping.levels_by_trait(ZTRAIT_STATION))
var/list/turfs_to_check = Z_TURFS(station_z)
for(var/turf/station_turf as anything in turfs_to_check)
var/area/turf_area = station_turf.loc
if(turf_area.static_lighting || is_type_in_typecache(turf_area, safe_areas)) //Only care about turfs that don't have lighting enabled.
continue
var/has_thing = FALSE
for(var/atom/movable/thing_on_the_turf as anything in station_turf.contents) //Find an item on the turf, this can help the mapper identify the turf more easily when combined with the exact coords.
if(is_type_in_typecache(thing_on_the_turf, safe_atoms))
continue
TEST_FAIL("[station_turf.x], [station_turf.y], [station_turf.z]: [thing_on_the_turf.type] with area of type [turf_area.type]")
has_thing = TRUE
break
if(!has_thing && !isspaceturf(station_turf) && !istype(station_turf, /turf/open/openspace)) //In case it's just a turf without an area
if(istype(station_turf, /turf/open/floor/engine/hull/ceiling))
TEST_FAIL("[station_turf.x], [station_turf.y], [station_turf.z]: [station_turf.type] with area of type [turf_area.type]. The turf on the z-level below is a shuttle dock and generated me! An error landmark has been generated on the map for easier debugging!")
else
TEST_FAIL("[station_turf.x], [station_turf.y], [station_turf.z]: [station_turf.type] with area of type [turf_area.type]")
if(!succeeded)
TEST_FAIL("Movable Atom located without a proper area. Please verify they are supposed to be there. If they are correct, change the area to /area/space/nearstation (or the correct surrounding type).")