Files
CHOMPStation2/code/unit_tests/zas_tests.dm
Leshana c837078105 Replaced "area" shuttles with "landmark" shuttles.
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits.

 - Shuttles no longer require a separate area for each location they jump to.
   Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle.
   This means that more than one shuttle could use the same docking port (not at the same time of course).
 - Enhanced shuttle control computers to use nanoui if they didn't.
 - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes.
 - Allows the possibility of shuttles (or destinations) that start on late-loaded maps.
 - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests

This all required a bit of infrastructure improvements.

 - ChangeArea proc, for changing the area of a turf.
 - Fixed lighting overlays actually being able to be destroyed.
 - Added a few utility macros and procs.
 - Added "turf translation" procs which are like move_contents_to but more flexible.
2020-03-05 10:29:08 -05:00

122 lines
3.2 KiB
Plaintext

#define UT_NORMAL 1
#define UT_VACUUM 2
#define UT_NORMAL_COLD 3
/datum/unit_test/zas_area_test
name = "ZAS: Area Test Template"
var/area_path = null
var/expectation = UT_NORMAL
/datum/unit_test/zas_area_test/proc/test_air_in_area(var/test_area, var/expectation = UT_NORMAL)
var/test_result = list("result" = 0, "msg" = "")
var/area/A = locate(test_area)
if(!istype(A, test_area))
test_result["msg"] = "Unable to get [test_area]"
return test_result
var/list/GM_checked = list()
for(var/turf/simulated/T in A)
if(!istype(T) || isnull(T.zone) || istype(T, /turf/simulated/floor/airless) || istype(T,/turf/simulated/shuttle/plating/airless))
continue
if(T.zone.air in GM_checked)
continue
var/t_msg = "Turf: [T] | Location: [T.x] // [T.y] // [T.z]"
var/datum/gas_mixture/GM = T.return_air()
var/pressure = GM.return_pressure()
var/temp = GM.temperature
switch(expectation)
if(UT_VACUUM)
if(pressure > 10)
test_result["msg"] = "Pressure out of bounds: [pressure] | [t_msg]"
return test_result
if(UT_NORMAL || UT_NORMAL_COLD)
if(abs(pressure - ONE_ATMOSPHERE) > 10)
test_result["msg"] = "Pressure out of bounds: [pressure] | [t_msg]"
return test_result
if(expectation == UT_NORMAL)
if(abs(temp - T20C) > 10)
test_result["msg"] = "Temperature out of bounds: [temp] | [t_msg]"
return test_result
if(expectation == UT_NORMAL_COLD)
if(temp > 120)
test_result["msg"] = "Temperature out of bounds: [temp] | [t_msg]"
return test_result
GM_checked.Add(GM)
if(GM_checked.len)
test_result["result"] = 1
test_result["msg"] = "Checked [GM_checked.len] zones"
else
test_result["msg"] = "No zones checked."
return test_result
/datum/unit_test/zas_area_test/start_test()
var/list/test = test_air_in_area(area_path, expectation)
if(isnull(test))
fail("Check Runtimed")
if(test["result"] == 1)
pass(test["msg"])
else
fail(test["msg"])
return 1
/datum/unit_test/zas_area_test/supply_centcomm
name = "ZAS: Supply Shuttle"
area_path = /area/shuttle/supply
/datum/unit_test/zas_area_test/emergency_shuttle
name = "ZAS: Emergency Shuttle"
area_path = /area/shuttle/escape
/datum/unit_test/zas_area_test/ai_chamber
name = "ZAS: AI Chamber"
area_path = /area/ai
// VOREStation Edit - We don't have this anymore - Tether
// /datum/unit_test/zas_area_test/mining_shuttle_at_station
// name = "ZAS: Mining Shuttle (Station)"
// area_path = /area/shuttle/mining/station
/datum/unit_test/zas_area_test/cargo_maint
name = "ZAS: Cargo Maintenance"
area_path = /area/maintenance/cargo
// VOREStation Edit - We don't have this anymore - Tether
// /datum/unit_test/zas_area_test/eng_shuttle
// name = "ZAS: Construction Site Shuttle (Station)"
// area_path = /area/shuttle/constructionsite/station
/datum/unit_test/zas_area_test/virology
name = "ZAS: Virology"
area_path = /area/medical/virology
/datum/unit_test/zas_area_test/xenobio
name = "ZAS: Xenobiology"
area_path = /area/rnd/xenobiology
/datum/unit_test/zas_area_test/mining_area
name = "ZAS: Mining Area (Vacuum)"
area_path = /area/mine/explored
expectation = UT_VACUUM
/datum/unit_test/zas_area_test/cargo_bay
name = "ZAS: Cargo Bay"
area_path = /area/quartermaster/storage