diff --git a/code/game/area/space_station_13_areas.dm b/code/game/area/space_station_13_areas.dm index 4d14130b9e7..90cb4b69899 100644 --- a/code/game/area/space_station_13_areas.dm +++ b/code/game/area/space_station_13_areas.dm @@ -49,6 +49,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station /area/testroom requires_power = FALSE + has_gravity = STANDARD_GRAVITY name = "Test Room" icon_state = "storage" diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index 6b815b8f8aa..54d9e27ea22 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -288,8 +288,8 @@ /obj/effect/decal/cleanable/blood/footprints/replace_decal(obj/effect/decal/cleanable/C) if(blood_state != C.blood_state) //We only replace footprints of the same type as us - return - ..() + return FALSE + return ..() /obj/effect/decal/cleanable/blood/footprints/can_bloodcrawl_in() if((blood_state != BLOOD_STATE_OIL) && (blood_state != BLOOD_STATE_NOT_BLOODY)) diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index a2ca5b8a6ea..120147b5c00 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -43,6 +43,7 @@ #include "anchored_mobs.dm" #include "bespoke_id.dm" #include "binary_insert.dm" +#include "bloody_footprints.dm" #include "breath.dm" #include "card_mismatch.dm" #include "chain_pull_through_space.dm" diff --git a/code/modules/unit_tests/bloody_footprints.dm b/code/modules/unit_tests/bloody_footprints.dm new file mode 100644 index 00000000000..bddad518760 --- /dev/null +++ b/code/modules/unit_tests/bloody_footprints.dm @@ -0,0 +1,61 @@ +///Tests to make sure bloody footprits work as expected +///So no stacking, they actually apply, and shoe staining thrown in for free +/datum/unit_test/bloody_footprints + +/datum/unit_test/bloody_footprints/Run() + var/mob/living/carbon/human/blood_master = allocate(/mob/living/carbon/human) + var/obj/item/clothing/shoes/holds_blood = allocate(/obj/item/clothing/shoes) + + blood_master.equip_to_slot_if_possible(holds_blood, ITEM_SLOT_FEET) + + var/turf/open/move_to = get_step(blood_master, get_dir(blood_master, run_loc_floor_top_right)) + //We need to not be "on" the same tile as the pool + blood_master.forceMove(move_to) + + var/obj/effect/decal/cleanable/blood/pool = allocate(/obj/effect/decal/cleanable/blood) + + //Max out the pools blood, so each step will make things stained enough to matter + pool.bloodiness = BLOOD_POOL_MAX + + pool.forceMove(run_loc_floor_bottom_left) + blood_master.forceMove(run_loc_floor_bottom_left) + + var/datum/component/bloodysoles/soles = holds_blood.GetComponent(/datum/component/bloodysoles) + var/blood_type = pool.blood_state + + TEST_ASSERT(soles.bloody_shoes[blood_type], "Shoes didn't become stained after stepping in a pool of [blood_type]") + + //The bloody soles component handles the order of stepping on blood/stepping on a bloody tile in a constranating way + //Which means it needs to check and see if any time has passed between steps, so it can be sure the player is stepping onto a new tile (that should become bloody) + //I on the other hand need to do all my movements in one tick, so we need to sidestep this check + //Please kill me slowly + soles.last_pickup -= 1 + + //Move off the bloody tile, time to do some testing + blood_master.forceMove(move_to) + + soles.last_pickup -= 1 + blood_master.forceMove(run_loc_floor_bottom_left) + + var/footprint_total = 0 + for(var/obj/effect/decal/cleanable/blood/footprints/print_set in move_to) + if(print_set.blood_state == blood_type) + footprint_total += 1 + + TEST_ASSERT(footprint_total, "The floor didn't get covered in [blood_type] after being walked over") + + soles.last_pickup -= 1 + + //Another set of movements to try and make some doubled up prints + blood_master.forceMove(move_to) + + soles.last_pickup -= 1 + blood_master.forceMove(run_loc_floor_bottom_left) + + footprint_total = 0 + for(var/obj/effect/decal/cleanable/blood/footprints/print_set in move_to) + if(print_set.blood_state == blood_type) + footprint_total += 1 + + TEST_ASSERT(footprint_total, "The floor somehow lost its footprints after being walked over") + TEST_ASSERT_EQUAL(footprint_total, 1, "The floor had more than one set of footprints in it, something is fucked") diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 3cacc1c4d2c..774578e32c6 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -50,7 +50,7 @@ GLOBAL_VAR(test_log) // clear the test area for (var/turf/turf in block(locate(1, 1, run_loc_floor_bottom_left.z), locate(world.maxx, world.maxy, run_loc_floor_bottom_left.z))) for (var/content in turf.contents) - if (iseffect(content)) + if (istype(content, /obj/effect/landmark)) continue qdel(content) return ..()