[MIRROR] Fixes permanent sechud from ablative trenchcoat hood [MDB IGNORE] (#16807)

* Fixes permanent sechud from ablative trenchcoat hood

* unit tests merge conflict

Co-authored-by: GoblinBackwards <22856555+GoblinBackwards@users.noreply.github.com>
Co-authored-by: Tastyfish <crazychris32@gmail.com>
This commit is contained in:
SkyratBot
2022-10-12 13:57:03 -04:00
committed by GitHub
co-authored by GoblinBackwards Tastyfish
parent 5b804b24a9
commit 2ddb1dde6c
3 changed files with 29 additions and 3 deletions
+3 -3
View File
@@ -39,14 +39,14 @@
return TRUE
/obj/item/clothing/suit/hooded/ablative/ToggleHood()
if (hood_up)
return ..()
. = ..()
if (!hood_up)
return
var/mob/living/carbon/user = loc
var/datum/atom_hud/hud = GLOB.huds[DATA_HUD_SECURITY_ADVANCED]
ADD_TRAIT(user, TRAIT_SECURITY_HUD, HELMET_TRAIT)
hud.show_to(user)
balloon_alert(user, "you put on the hood, and enable the hud")
return ..()
/obj/item/clothing/suit/hooded/ablative/RemoveHood()
if (!hood_up)
+1
View File
@@ -75,6 +75,7 @@
#include "~skyrat/opposing_force.dm"
#include "~skyrat/automapper.dm"
//SKYRAT EDIT END
#include "ablative_hud.dm"
#include "achievements.dm"
#include "anchored_mobs.dm"
#include "anonymous_themes.dm"
+25
View File
@@ -0,0 +1,25 @@
/// 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)
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
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.")
coat.ToggleHood()
TEST_ASSERT(HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person toggled the ablative hood but didn't gain a sechud.")
coat.ToggleHood()
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)
var/obj/item/clothing/suit/hooded/ablative/coat = allocate(/obj/item/clothing/suit/hooded/ablative)
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.")
coat.ToggleHood()
TEST_ASSERT(!HAS_TRAIT(person, TRAIT_SECURITY_HUD), "Person has gained a sechud from toggling the ablative hood despite already wearing a helmet.")