diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 53f312ccdc6..c3d55e7167b 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -475,8 +475,10 @@ ///Get all items in our possession that should affect our movespeed /mob/proc/get_equipped_speed_mod_items() - return get_equipped_items(INCLUDE_HELD|INCLUDE_ABSTRACT|INCLUDE_PROSTHETICS) - + . = get_equipped_items(INCLUDE_ABSTRACT|INCLUDE_PROSTHETICS) + for(var/obj/item/thing in held_items) + if(thing.item_flags & SLOWS_WHILE_IN_HAND) + . += thing /** * Returns the items that were successfully unequipped. */ diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 54a6f1db363..2ef6664a605 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -177,6 +177,7 @@ #include "gloves_and_shoes_armor.dm" #include "greyscale_config.dm" #include "hallucination_icons.dm" +#include "held_slowdown.dm" #include "heretic_knowledge.dm" #include "heretic_rituals.dm" #include "high_five.dm" diff --git a/code/modules/unit_tests/held_slowdown.dm b/code/modules/unit_tests/held_slowdown.dm new file mode 100644 index 00000000000..0dbacd51246 --- /dev/null +++ b/code/modules/unit_tests/held_slowdown.dm @@ -0,0 +1,11 @@ +/// Tests SLOWS_WHILE_IN_HAND +/datum/unit_test/held_slowdown + +/datum/unit_test/held_slowdown/Run() + var/mob/living/carbon/human/consistent/dummy = EASY_ALLOCATE() + var/obj/item/restraints/legcuffs/bola/bola = EASY_ALLOCATE() + dummy.put_in_hands(bola) + TEST_ASSERT(!(bola in dummy.get_equipped_speed_mod_items()), "Bola slows while held, when it shouldn't.") + + bola.item_flags |= SLOWS_WHILE_IN_HAND + TEST_ASSERT((bola in dummy.get_equipped_speed_mod_items()), "Bola should slow while held now that it has the SLOWS_WHILE_IN_HAND flag.")