Files
Bubberstation/code/modules/unit_tests/mapping_nearstation_test.dm
SkyratBot 1e4eea1177 [MIRROR] Unit tests for stuff accidentally placed in space by mappers (#28538)
* Unit tests for stuff accidentally placed in space by mappers (#84453)

This unit test detects all turfs & other movables that aren't in a lit
area (ie area/space/nearspace) on station zlevels

The grep detects movables placed on shuttles that do not have the
correct area assigned, which caused those atoms to break off of the
shuttle & literally get launched into random parts of space (usually on
station z-levels; the only reason I found this issue was cause the unit
test was detecting random shit ending up on station maps lol)

Minor fix for the mapload_space_verification unit test - it was falsely
detecting turfs that shuttle grids (that were template_noop) were parked
ontop of, which aren't effected by the shuttle in any way. This allowed
the following fix

Fixed a number of shuttles having atoms in /area/template_noop areas.
Atoms in these areas are treated as not actually part of the shuttle
itself & were launched off into random space tiles across all z-levels
via dump_in_space(). Corrected those grids to have the correct area, and
as such, shuttles now stay together properly.

🆑 ShizCalev
fix: Fixed a number of shuttles having parts (such as lattices)
completely disappearing.
fix: Fixed the ceilings above shuttles on station maps being
full-bright.
fix: Fixed lattices sometimes appearing at random locations in space on
station maps.
fix: Cleaned up a number of accidentally placed objects in space across
all station maps.
fix: Fixed a false positive with the mapload_space_verification unit
test failing on turfs that weren't actually part of shuttles.
code: Added a unit test that automatically finds all base space turfs
with objects on them, as well as non-space turfs that are set to space
areas (meaning that these squares weren't lit properly.)
/🆑

Shuttle Ceiling Fix:
Before

![2024-06-30_23-15-18-dreamseeker-Doctor_s_Spess_Junk_Eta](https://github.com/tgstation/tgstation/assets/6209658/4d1fb186-460a-409f-ab5d-3258b4e205f8)
Fixed
![Screenshot 2024-06-30
231528](https://github.com/tgstation/tgstation/assets/6209658/bd957384-4ba5-4fb6-9919-7f17f01d723c)

Shuttle Fix:
Before

![image](https://github.com/tgstation/tgstation/assets/6209658/4b408c40-0a25-4d8c-a9c7-65157eaf1172)
Fixed (look at the lattices in the middle. the stuff in the shuttle are
randomized / not part of this)

![image](https://github.com/tgstation/tgstation/assets/6209658/80a9e5f2-8c30-492e-8cd3-31f9b8ffb275)

* Unit tests for stuff accidentally placed in space by mappers

* Fixes maps for nearspace unit test (#28557)

Fixes maps

---------

Co-authored-by: Afevis <ShizCalev@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
2024-07-02 15:25:34 +05:30

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/mapping_nearstation_test
priority = TEST_PRE
/datum/unit_test/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).")