From a38c59aab223e456bd38475b3ae5c9b95380cf9e Mon Sep 17 00:00:00 2001
From: SabreML <57483089+SabreML@users.noreply.github.com>
Date: Wed, 16 Dec 2020 19:40:26 +0000
Subject: [PATCH] Rapier Sheath quick-equip and sound effects (#15109)
* Rapier Sounds
* Regular click rather than alt-click
---
code/game/objects/items/weapons/melee/misc.dm | 2 +-
.../objects/items/weapons/storage/belt.dm | 50 +++++++++++++++----
2 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/code/game/objects/items/weapons/melee/misc.dm b/code/game/objects/items/weapons/melee/misc.dm
index 2c2eea24f56..fbc8c1031bd 100644
--- a/code/game/objects/items/weapons/melee/misc.dm
+++ b/code/game/objects/items/weapons/melee/misc.dm
@@ -38,7 +38,7 @@
w_class = WEIGHT_CLASS_BULKY
block_chance = 50
armour_penetration = 75
- sharp = 1
+ sharp = TRUE
origin_tech = "combat=5"
attack_verb = list("lunged at", "stabbed")
hitsound = 'sound/weapons/rapierhit.ogg'
diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm
index 2791ee28541..172a95d3cd0 100644
--- a/code/game/objects/items/weapons/storage/belt.dm
+++ b/code/game/objects/items/weapons/storage/belt.dm
@@ -602,22 +602,50 @@
max_w_class = WEIGHT_CLASS_BULKY
can_hold = list(/obj/item/melee/rapier)
-/obj/item/storage/belt/rapier/update_icon()
- icon_state = "[initial(icon_state)]"
- item_state = "[initial(item_state)]"
- if(contents.len)
- icon_state = "[initial(icon_state)]-rapier"
- item_state = "[initial(item_state)]-rapier"
- if(isliving(loc))
- var/mob/living/L = loc
- L.update_inv_belt()
- ..()
-
/obj/item/storage/belt/rapier/New()
..()
new /obj/item/melee/rapier(src)
update_icon()
+/obj/item/storage/belt/rapier/attack_hand(mob/user)
+ if(loc != user)
+ return ..()
+
+ if(!ishuman(user))
+ return
+ var/mob/living/carbon/human/H = user
+ if(H.incapacitated())
+ return
+
+ if(length(contents))
+ var/obj/item/I = contents[1]
+ H.visible_message("[H] takes [I] out of [src].", "You take [I] out of [src].")
+ H.put_in_hands(I)
+ update_icon()
+ else
+ to_chat(user, "[src] is empty!")
+
+/obj/item/storage/belt/rapier/handle_item_insertion(obj/item/W, prevent_warning)
+ if(!..())
+ return
+ playsound(src, 'sound/weapons/blade_sheath.ogg', 20)
+
+/obj/item/storage/belt/rapier/remove_from_storage(obj/item/W, atom/new_location)
+ if(!..())
+ return
+ playsound(src, 'sound/weapons/blade_unsheath.ogg', 20)
+
+/obj/item/storage/belt/rapier/update_icon()
+ . = ..()
+ icon_state = initial(icon_state)
+ item_state = initial(item_state)
+ if(length(contents))
+ icon_state = "[icon_state]-rapier"
+ item_state = "[item_state]-rapier"
+ if(isliving(loc))
+ var/mob/living/L = loc
+ L.update_inv_belt()
+
// -------------------------------------
// Bluespace Belt
// -------------------------------------