Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick Armor Swap #19902

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/modules/clothing/clothing_accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions code/modules/clothing/suits/modular_armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
4 changes: 4 additions & 0 deletions code/modules/clothing/under/accessories/accessory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
16 changes: 16 additions & 0 deletions code/modules/clothing/under/accessories/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions html/changelogs/geeves-quick_swap.yml
Original file line number Diff line number Diff line change
@@ -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."
Loading