mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Adds more unit tests for improper cables (#24262)
* cablening + remove a duplicate proc * okay compile im dumb * oops * okay im dumber than I thought * lmao * OKAY IT WORKS PROPERLY NOW * lets test these maps to see if they pass * maybe this works * undo the testing * unfuck map files * unfuck shit maybe? * PLEASE i think fucking merge hooks are fucking me * okay goodbye merge hooks * PLEASE
This commit is contained in:
@@ -124,3 +124,33 @@
|
||||
/datum/map_per_tile_test/nearspace_checker/CheckTile(turf/T)
|
||||
if(T.loc.type == /area/space/nearstation && !is_type_in_list(T, allowed_turfs))
|
||||
Fail(T, "nearspace area contains a non-space turf: [T], ([T.type])")
|
||||
|
||||
|
||||
/datum/map_per_tile_test/cable_adjacency_checker
|
||||
|
||||
/datum/map_per_tile_test/cable_adjacency_checker/CheckTile(turf/T)
|
||||
for(var/obj/structure/cable/cable in T.contents)
|
||||
check_direction(T, cable.d1, "d1")
|
||||
check_direction(T, cable.d2, "d2")
|
||||
|
||||
/datum/map_per_tile_test/cable_adjacency_checker/proc/check_direction(origin_turf, direction, report_name)
|
||||
if(!direction) // cable direction = 0, which means its a node
|
||||
return TRUE
|
||||
var/turf/potential_cable_turf = get_step(origin_turf, direction)
|
||||
var/reversed_direction = reverse_direction(direction)
|
||||
for(var/obj/structure/cable/other_cable in potential_cable_turf.contents)
|
||||
if(reversed_direction == other_cable.d1 || reversed_direction == other_cable.d2)
|
||||
return TRUE
|
||||
|
||||
Fail(origin_turf, "tile has an unconnected cable ([report_name] connection: [uppertext(dir2text(direction))]).")
|
||||
return FALSE
|
||||
|
||||
/datum/map_per_tile_test/duplicate_cable_check
|
||||
|
||||
/datum/map_per_tile_test/duplicate_cable_check/CheckTile(turf/T)
|
||||
var/obj/structure/cable/cable = locate() in T.contents
|
||||
for(var/obj/structure/cable/other_cable in T.contents)
|
||||
if(cable == other_cable)
|
||||
continue // same object, continue
|
||||
if(cable.d1 == other_cable.d1 && cable.d2 == other_cable.d2)
|
||||
Fail(T, "tile has duplicated cables.")
|
||||
|
||||
Reference in New Issue
Block a user