diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 59a729057e4..61ae8acf204 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -290,7 +290,7 @@ visible_message("[src] rolls on the floor, trying to put [p_them()]self out!", \ "You stop, drop, and roll!") sleep(30) - if(fire_stacks <= 0) + if(fire_stacks <= 0 && !QDELETED(src)) visible_message("[src] successfully extinguishes [p_them()]self!", \ "You extinguish yourself.") ExtinguishMob() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index a0935606b36..fcaf327ad83 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -792,7 +792,7 @@ resist_buckle() //Breaking out of a container (Locker, sleeper, cryo...) - else if(loc) + else if(loc != get_turf(src)) loc.container_resist_act(src) else if(mobility_flags & MOBILITY_MOVE) diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 59f0f3853fa..ec3ef3d3760 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -24,6 +24,7 @@ #include "plantgrowth_tests.dm" #include "reagent_id_typos.dm" #include "reagent_recipe_collisions.dm" +#include "resist.dm" #include "say.dm" #include "siunit.dm" #include "spawn_humans.dm" diff --git a/code/modules/unit_tests/resist.dm b/code/modules/unit_tests/resist.dm new file mode 100644 index 00000000000..9fe5cd11149 --- /dev/null +++ b/code/modules/unit_tests/resist.dm @@ -0,0 +1,29 @@ +/// Test that stop, drop, and roll lowers fire stacks +/datum/unit_test/stop_drop_and_roll/Run() + var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human) + + TEST_ASSERT_EQUAL(human.fire_stacks, 0, "Human does not have 0 fire stacks pre-ignition") + + human.adjust_fire_stacks(5) + human.IgniteMob() + + TEST_ASSERT_EQUAL(human.fire_stacks, 5, "Human does not have 5 fire stacks pre-resist") + + // Stop, drop, and roll has a sleep call. This would delay the test, and is not necessary. + CallAsync(human, /mob/living/verb/resist) + + TEST_ASSERT(human.fire_stacks < 5, "Human did not lower fire stacks after resisting") + +/// Test that you can resist out of a container +/datum/unit_test/container_resist/Run() + var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human) + var/obj/structure/closet/closet = allocate(/obj/structure/closet, get_turf(human)) + + closet.open(human) + TEST_ASSERT(!(human in closet.contents), "Human was in the contents of an open closet") + + closet.close(human) + TEST_ASSERT(human in closet.contents, "Human was not in the contents of the closed closet") + + human.resist() + TEST_ASSERT(!(human in closet.contents), "Human resisted out of a standard closet, but was still in it")