Files
Bubberstation/code/modules/unit_tests/washing.dm
MrMelbert 4b77c6f7c0 Decouples "Is this affected by a mop" from layer var (#88465)
## About The Pull Request

Rather than checking for object layer if we can clean something, has a
trait which accomplishes this

This better allows us to pick and choose what objects we want to clean
when mopping

Note: I didn't apply the trait to everything it previously affected
Currently, it cleans stuff like pipes and plumbing, which I deemed not
necessary to carry over since they can't get dirty anyways
I can re-add this if desired though

Fixes #88445
Fixes #88150

## Changelog

🆑 Melbert
fix: Gibs get bulk cleaned if you clean the turf again
refactor: Changed how things determine "I can be bulk cleaned if I clean
the turf underneath me", let me know if you notice anything not getting
bulk cleaned or weird things getting bulk cleaned
/🆑
2024-12-18 00:50:08 +01:00

44 lines
1.7 KiB
Plaintext

/datum/unit_test/washing
/// Stuff we want to test that isn't cleanables, just to make sure they are getting cleaned when they should
var/list/cleanable_bonus_list = list(
/obj/effect/rune,
/obj/item/clothing/gloves/color/black,
/mob/living/carbon/human/dummy/consistent,
)
/// Tracks if we caught the clean signal, to know we washed successfully
VAR_PRIVATE/clean_sig_caught = 0
/datum/unit_test/washing/Run()
for(var/i in subtypesof(/obj/effect/decal/cleanable) + cleanable_bonus_list)
var/atom/movable/to_clean = allocate(i)
var/mopable = HAS_TRAIT(to_clean, TRAIT_MOPABLE)
clean_sig_caught = 0
RegisterSignal(to_clean, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(clean_caught))
run_loc_floor_bottom_left.wash(CLEAN_ALL)
// mopables are cleaned when their turf is cleaned
if(mopable)
if(clean_sig_caught == 0)
TEST_FAIL("[i] was not cleaned when its turf was cleaned (cleaning only mopables)!")
if(clean_sig_caught > 1)
TEST_FAIL("[i] was cleaned more than once when its turf was cleaned (cleaning only mopables)!")
// non-mopables require the all_contents = TRUE flag to be cleaned
else
if(clean_sig_caught != 0)
TEST_FAIL("[i] was cleaned when its turf was cleaned (cleaning only mopables)!")
run_loc_floor_bottom_left.wash(CLEAN_ALL, TRUE)
if(clean_sig_caught == 0)
TEST_FAIL("[i] was not cleaned when its turf was cleaned (cleaning all contents)!")
if(clean_sig_caught > 1)
TEST_FAIL("[i] was cleaned more than once when its turf was cleaned (cleaning all contents)!")
if(!QDELETED(to_clean))
if(istype(to_clean, /obj/effect/decal/cleanable))
TEST_FAIL("[i] was not deleted when its turf was cleaned!")
qdel(to_clean)
/datum/unit_test/washing/proc/clean_caught(...)
SIGNAL_HANDLER
clean_sig_caught += 1