Merge pull request #4939 from Anewbe/accessories

Should fix an accessories oversight
This commit is contained in:
Anewbe
2018-02-24 11:29:50 -06:00
committed by GitHub
2 changed files with 24 additions and 20 deletions
+19 -17
View File
@@ -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 << "<span class='warning'>You cannot attach accessories of any kind to \the [src].</span>"
return
var/obj/item/clothing/accessory/A = I
if(can_attach_accessory(A))
user.drop_item()
attach_accessory(user, A)
return
else
user << "<span class='warning'>You cannot attach more accessories of this type to [src].</span>"
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, "<span class='warning'>You cannot attach accessories of any kind to \the [src].</span>")
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, "<span class='warning'>You cannot attach more accessories of this type to [src].</span>")
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"
@@ -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 << "<font color='red'>You are trying to eqip this item to an unsupported inventory slot. How the heck did you manage that? Stop it...</font>"
src << "<font color='red'>You are trying to equip this item to an unsupported inventory slot. How the heck did you manage that? Stop it...</font>"
return
if((W == src.l_hand) && (slot != slot_l_hand))