From 99312f323d534da88bb06265c5427a282d5977c4 Mon Sep 17 00:00:00 2001 From: Anewbe Date: Fri, 23 Feb 2018 21:57:50 -0600 Subject: [PATCH] Should fix an accessories oversight --- code/modules/clothing/clothing_accessories.dm | 36 ++++++++++--------- .../mob/living/carbon/human/inventory.dm | 8 +++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index b0068c6190..85496ee48d 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -15,19 +15,7 @@ /obj/item/clothing/attackby(var/obj/item/I, var/mob/user) if(istype(I, /obj/item/clothing/accessory)) - - if(!valid_accessory_slots || !valid_accessory_slots.len) - usr << "You cannot attach accessories of any kind to \the [src]." - return - - var/obj/item/clothing/accessory/A = I - if(can_attach_accessory(A)) - user.drop_item() - attach_accessory(user, A) - return - else - user << "You cannot attach more accessories of this type to [src]." - return + attempt_attach_accessory(I, user) if(accessories.len) for(var/obj/item/clothing/accessory/A in accessories) @@ -79,10 +67,19 @@ * user is the user doing the attaching. Can be null, such as when attaching * items on spawn */ -/obj/item/clothing/proc/update_accessory_slowdown() - slowdown = initial(slowdown) - for(var/obj/item/clothing/accessory/A in accessories) - slowdown += A.slowdown +/obj/item/clothing/proc/attempt_attach_accessory(mob/user, obj/item/clothing/accessory/A) + if(!valid_accessory_slots || !valid_accessory_slots.len) + to_chat(user, "You cannot attach accessories of any kind to \the [src].") + return FALSE + + var/obj/item/clothing/accessory/acc = A + if(can_attach_accessory(acc)) + user.drop_item() + attach_accessory(user, acc) + return TRUE + else + to_chat(user, "You cannot attach more accessories of this type to [src].") + return FALSE /obj/item/clothing/proc/attach_accessory(mob/user, obj/item/clothing/accessory/A) accessories += A @@ -100,6 +97,11 @@ update_accessory_slowdown() update_clothing_icon() +/obj/item/clothing/proc/update_accessory_slowdown() + slowdown = initial(slowdown) + for(var/obj/item/clothing/accessory/A in accessories) + slowdown += A.slowdown + /obj/item/clothing/proc/removetie_verb() set name = "Remove Accessory" set category = "Object" diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 871145d8a9..b6c9cd81b0 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -32,7 +32,6 @@ This saves us from having to call add_fingerprint() any time something is put in qdel(W) return null - /mob/living/carbon/human/proc/has_organ(name) var/obj/item/organ/external/O = organs_by_name[name] return (O && !O.is_stump()) @@ -318,9 +317,12 @@ This saves us from having to call add_fingerprint() any time something is put in W.loc = src.back if(slot_tie) for(var/obj/item/clothing/C in worn_clothing) - C.attackby(W, usr) + if(istype(W, /obj/item/clothing/accessory)) + var/obj/item/clothing/accessory/A = W + if(C.attempt_attach_accessory(usr, A)) + return else - src << "You are trying to eqip this item to an unsupported inventory slot. How the heck did you manage that? Stop it..." + src << "You are trying to equip this item to an unsupported inventory slot. How the heck did you manage that? Stop it..." return if((W == src.l_hand) && (slot != slot_l_hand))