Fixes Improper usages of Accessory Procs (#18350)

* everyday I lose more brain cells

* better fix

* implementing requested changes
This commit is contained in:
Sirryan2002
2022-07-13 13:11:23 -04:00
committed by GitHub
parent c043411b2f
commit 21749a73ed
2 changed files with 11 additions and 3 deletions
+6
View File
@@ -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
@@ -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, "<span class='warning'>You need a jumpsuit before you can attach this [I.name].</span>")
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, "<span class='warning'>You already have an accessory of this type attached to your [uniform].</span>")
return FALSE