mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## 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>
63 lines
4.4 KiB
Plaintext
63 lines
4.4 KiB
Plaintext
/// Verifies that there are no space turfs inside a station area, or on any planetary z-level. Sometimes, these are introduced during the load of the map and are not present in the DMM itself.
|
|
/// Let's just make sure that we have a stop-gap measure in place to catch these if they pop up so we don't put it onto production servers should something errant come up.
|
|
/datum/unit_test/maptest_mapload_space_verification
|
|
// This test is quite taxing time-wise, so let's run it later than other faster tests.
|
|
priority = TEST_LONGER
|
|
|
|
/datum/unit_test/maptest_mapload_space_verification/Run()
|
|
// Is our current map a planetary station (NO space turfs allowed)? If so, check for ANY space turfs.
|
|
if(SSmapping.is_planetary())
|
|
validate_planetary_map()
|
|
return
|
|
|
|
// Let's explicitly outline valid areas to catch anything that we're... okay with for now, because there are some valid use cases (though we should try to avoid them).
|
|
var/list/excluded_area_typecache = typecacheof(list(
|
|
// Space! This is likely an intentional space turf, so let's not worry about it.
|
|
/area/space,
|
|
// Transit areas have space turfs in a valid placement.
|
|
/area/shuttle/transit,
|
|
// Space Ruins do their own thing (dilapidated lattices over space turfs, for instance). Rather than fuss over it, let's just let it through.
|
|
/area/ruin/space,
|
|
/area/ruin/unpowered/no_grav,
|
|
// Same stipulation as space ruins, but they're (ruined) shuttles instead.
|
|
/area/shuttle/ruin,
|
|
/area/shuttle/abandoned,
|
|
// Solars have lattices over space turfs, and are a valid placement for space turfs in a station area.
|
|
/area/station/solars,
|
|
//Birdshot Atmos has a special area, so we'll exclude that from lints here.
|
|
/area/station/engineering/atmos/space_catwalk,
|
|
))
|
|
|
|
// We aren't planetary, so let's check area placements and ensure stuff lines up.
|
|
for(var/turf/iterated_turf in ALL_TURFS())
|
|
var/area/turf_area = get_area(iterated_turf)
|
|
if(!isspaceturf(iterated_turf) || is_type_in_typecache(turf_area, excluded_area_typecache))
|
|
continue // Alright, so let's assume we have intended behavior. If something yorks, we'll get a bare `/area` (maploader?) or a mapper is doing something they shouldn't be doing.
|
|
if(HAS_TRAIT(iterated_turf, TRAIT_HYPERSPACE_STOPPED))
|
|
continue // This means that a shuttle with a noop template turf is just temporarily parked ontop of us and that we're not actually a part of it. We don't have to care about it as it will leave us alone when it flies away.
|
|
// We need turf_area.type for the error message because we have fifteen million ruin areas named "Unexplored Location" and it's completely unhelpful here.
|
|
TEST_FAIL("Space turf [iterated_turf.type] found in non-allowed area ([turf_area.type]) at [AREACOORD(iterated_turf)]! Please ensure that all space turfs are in an /area/space!")
|
|
|
|
|
|
/// Verifies that there are ZERO space turfs on a valid planetary station. We NEVER want space turfs here, so we do not check for /area/space here since something completely undesirable is happening.
|
|
/// There are also a few considerations specific to planetary stations included within, so let's spin it out into a separate proc for clarity.
|
|
/datum/unit_test/maptest_mapload_space_verification/proc/validate_planetary_map()
|
|
// We want to get both the station level and the mining level (if the two are seperate for any reason).
|
|
var/list/testable_levels = list()
|
|
testable_levels += SSmapping.levels_by_trait(ZTRAIT_STATION) // Station z-levels get to be in by default because they can derail an entire round and cause LINDA to weep if a space turf is present.
|
|
|
|
var/list/mining_levels = SSmapping.levels_by_trait(ZTRAIT_MINING)
|
|
// Add in mining levels should they exist, and dupecheck to make sure we don't have any duplicates because it's valid to have a station and mining level be the same.
|
|
for(var/mining_level in mining_levels)
|
|
if(mining_level in testable_levels)
|
|
continue
|
|
testable_levels += mining_level
|
|
|
|
for(var/level in testable_levels)
|
|
var/testable_turfs = Z_TURFS(level)
|
|
// Remember, any space turf is a failure.
|
|
for(var/turf/open/space/iterated_turf in testable_turfs)
|
|
// grab the type of the area that we're in too, because there's three different types of area types that have the name "Icemoon Wastes", for example
|
|
var/area/invalid_area = get_area(iterated_turf)
|
|
TEST_FAIL("Space turf found on planetary map! [AREACOORD(iterated_turf)] ([invalid_area.type]) Please verify the map file and remove any space turfs.")
|