From 21749a73ed39e6bf01c3bd5fc6814242c43c4e9a Mon Sep 17 00:00:00 2001
From: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
Date: Wed, 13 Jul 2022 13:11:23 -0400
Subject: [PATCH] Fixes Improper usages of Accessory Procs (#18350)
* everyday I lose more brain cells
* better fix
* implementing requested changes
---
code/modules/clothing/clothing.dm | 6 ++++++
code/modules/mob/living/carbon/human/species/_species.dm | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 6a8a6fd228a..82c46884d1c 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -677,6 +677,12 @@ BLIND // can't see anything
QDEL_LIST(accessories)
return ..()
+/*
+ * # can_attach_accessory
+ *
+ * Arguments:
+ * * A - The accessory object being checked. MUST BE TYPE /obj/item/clothing/accessory
+*/
/obj/item/clothing/under/proc/can_attach_accessory(obj/item/clothing/accessory/A)
if(length(accessories) >= MAX_EQUIPABLE_ACCESSORIES) //this is neccesary to prevent chat spam when examining clothing
return FALSE
diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm
index 68c24b0242c..8221fd2d7ec 100644
--- a/code/modules/mob/living/carbon/human/species/_species.dm
+++ b/code/modules/mob/living/carbon/human/species/_species.dm
@@ -785,12 +785,14 @@
return TRUE
return FALSE
if(slot_tie)
- if(!H.w_uniform)
+ if(!istype(I, /obj/item/clothing/accessory))
+ return FALSE
+ var/obj/item/clothing/under/uniform = H.w_uniform
+ if(!uniform)
if(!disable_warning)
to_chat(H, "You need a jumpsuit before you can attach this [I.name].")
return FALSE
- var/obj/item/clothing/under/uniform = H.w_uniform
- if(uniform.accessories.len && !uniform.can_attach_accessory(H))
+ if(length(uniform.accessories) && !uniform.can_attach_accessory(I))
if(!disable_warning)
to_chat(H, "You already have an accessory of this type attached to your [uniform].")
return FALSE