From 9ab15613ab3f431f236c8d4eac96038550ad2a36 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 21 Oct 2023 20:21:11 +0200 Subject: [PATCH] [MIRROR] Adds Oxyloss KO unit test [MDB IGNORE] (#24480) * Adds Oxyloss KO unit test (#79112) ## About The Pull Request Adds a unit test ensuring mobs over 50 oxyloss pass out correctly (and likewise, mobs below 50 wake up). See #79034 * Adds Oxyloss KO unit test --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/oxyloss_suffocation.dm | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 code/modules/unit_tests/oxyloss_suffocation.dm diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 4b6c7a737a9..914f902baf2 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -196,6 +196,7 @@ #include "organ_set_bonus.dm" #include "organs.dm" #include "outfit_sanity.dm" +#include "oxyloss_suffocation.dm" #include "paintings.dm" #include "pills.dm" #include "plane_double_transform.dm" diff --git a/code/modules/unit_tests/oxyloss_suffocation.dm b/code/modules/unit_tests/oxyloss_suffocation.dm new file mode 100644 index 00000000000..a44911ebbba --- /dev/null +++ b/code/modules/unit_tests/oxyloss_suffocation.dm @@ -0,0 +1,10 @@ +/// Test getting over a certain threshold of oxy damage results in KO +/datum/unit_test/oxyloss_suffocation + +/datum/unit_test/oxyloss_suffocation/Run() + var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent) + + dummy.setOxyLoss(75) + TEST_ASSERT(HAS_TRAIT_FROM(dummy, TRAIT_KNOCKEDOUT, OXYLOSS_TRAIT), "Dummy should have been knocked out from taking oxy damage.") + dummy.setOxyLoss(0) + TEST_ASSERT(!HAS_TRAIT_FROM(dummy, TRAIT_KNOCKEDOUT, OXYLOSS_TRAIT), "Dummy should have woken up from KO when healing to 0 oxy damage.")