diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index a213199bcdf..4e4eb56b51a 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -22,6 +22,7 @@ return var/obj/item/clothing/accessory/A = attacking_item + A.before_attached(src, user) if(can_attach_accessory(A)) user.drop_item() attach_accessory(user, A) diff --git a/code/modules/clothing/suits/modular_armor.dm b/code/modules/clothing/suits/modular_armor.dm index bd974d04b20..0f621002a59 100644 --- a/code/modules/clothing/suits/modular_armor.dm +++ b/code/modules/clothing/suits/modular_armor.dm @@ -141,6 +141,14 @@ bomb = ARMOR_BOMB_PADDED ) +/obj/item/clothing/accessory/armor_plate/before_attached(var/obj/item/clothing/clothing, var/mob/user) + if(!clothing.valid_accessory_slots || !(slot in clothing.valid_accessory_slots)) + return + var/obj/item/clothing/accessory/armor_plate/existing_plate = locate() in clothing.accessories + if(!existing_plate) + return + clothing.remove_accessory(user, existing_plate) + /obj/item/clothing/accessory/armor_plate/generic name = "standard armor plate" desc = "A light-weight kevlar armor plate in drab black colors. A galactic favourite of Zavodskoi fans." diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index b5d2bb7b142..b30828dd923 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -83,6 +83,10 @@ accessory_mob_overlay.appearance_flags = RESET_ALPHA|RESET_COLOR return accessory_mob_overlay +/// Gets called before 'can_attach_accessory()' is called in clothing_accessories.dm +/obj/item/clothing/accessory/proc/before_attached(var/obj/item/clothing/S, var/mob/user) + return + //when user attached an accessory to S /obj/item/clothing/accessory/proc/on_attached(var/obj/item/clothing/S, var/mob/user) if(!istype(S)) diff --git a/code/modules/clothing/under/accessories/armor.dm b/code/modules/clothing/under/accessories/armor.dm index 033b412d8fb..ffac39e018b 100644 --- a/code/modules/clothing/under/accessories/armor.dm +++ b/code/modules/clothing/under/accessories/armor.dm @@ -20,6 +20,14 @@ drop_sound = 'sound/items/drop/boots.ogg' pickup_sound = 'sound/items/pickup/boots.ogg' +/obj/item/clothing/accessory/leg_guard/before_attached(var/obj/item/clothing/clothing, var/mob/user) + if(!clothing.valid_accessory_slots || !(slot in clothing.valid_accessory_slots)) + return + var/obj/item/clothing/accessory/leg_guard/existing_guard = locate() in clothing.accessories + if(!existing_guard) + return + clothing.remove_accessory(user, existing_guard) + /obj/item/clothing/accessory/leg_guard/generic name = "standard leg guards" icon_state = "legguards_generic" @@ -160,6 +168,14 @@ drop_sound = 'sound/items/drop/axe.ogg' pickup_sound = 'sound/items/pickup/axe.ogg' +/obj/item/clothing/accessory/arm_guard/before_attached(var/obj/item/clothing/clothing, var/mob/user) + if(!clothing.valid_accessory_slots || !(slot in clothing.valid_accessory_slots)) + return + var/obj/item/clothing/accessory/arm_guard/existing_guard = locate() in clothing.accessories + if(!existing_guard) + return + clothing.remove_accessory(user, existing_guard) + /obj/item/clothing/accessory/arm_guard/generic name = "standard arm guards" icon_state = "armguards_generic" diff --git a/html/changelogs/geeves-quick_swap.yml b/html/changelogs/geeves-quick_swap.yml new file mode 100644 index 00000000000..ec6f2a0b0f9 --- /dev/null +++ b/html/changelogs/geeves-quick_swap.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "You can now instantly replace the armor accessories on plate carriers by clicking on it with the new plate or guard you want to replace them with." \ No newline at end of file