mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
## About The Pull Request Refactors the behaviour of "one clothing item deploying another clothing item" from `/obj/item/clothing/suit/hooded` and makes it into a component. This allows you to make hooded items which are not part of that typepath. It also means you could make (for instance) a hat which can deploy a pair of sunglasses into the eye slot or a jumpsuit with deployable clown shoes or something. I need to pass in an assload of callbacks because we have a bunch of special hoodies that want to do things when you raise and lower the hood, but for a normal item you would not need these. ## Why It's Good For The Game Frees people from the tyrrany of typepaths, mostly. Plausibly you could use it to do something fun we don't currently do. ## Changelog Not player facing, hopefully. As long as I did this all right.
28 lines
1.8 KiB
Plaintext
28 lines
1.8 KiB
Plaintext
/// Check that player gains and loses sec hud when toggling the ablative hood
|
|
/datum/unit_test/ablative_hood_hud
|
|
|
|
/datum/unit_test/ablative_hood_hud/Run()
|
|
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent)
|
|
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
|
|
var/datum/component/toggle_attached_clothing/hood = coat.GetComponent(/datum/component/toggle_attached_clothing)
|
|
person.equip_to_slot(coat, ITEM_SLOT_OCLOTHING)
|
|
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person already had a sechud before trying to equip the ablative hood.")
|
|
hood.toggle_deployable()
|
|
TEST_ASSERT(HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person toggled the ablative hood but didn't gain a sechud.")
|
|
hood.toggle_deployable()
|
|
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person lowered their ablative hood but still has a sechud.")
|
|
|
|
// Check that player doesn't gain sec hud if the hood is toggled when already wearing a helmet
|
|
/datum/unit_test/ablative_hood_hud_with_helmet
|
|
|
|
/datum/unit_test/ablative_hood_hud_with_helmet/Run()
|
|
var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent)
|
|
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
|
|
var/datum/component/toggle_attached_clothing/hood = coat.GetComponent(/datum/component/toggle_attached_clothing)
|
|
var/obj/item/clothing/head/helmet/hat = allocate(/obj/item/clothing/head/helmet)
|
|
person.equip_to_slot(coat, ITEM_SLOT_OCLOTHING)
|
|
person.equip_to_slot(hat, ITEM_SLOT_HEAD)
|
|
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person already had a sechud before trying to equip the ablative hood.")
|
|
hood.toggle_deployable()
|
|
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person has gained a sechud from toggling the ablative hood despite already wearing a helmet.")
|