<commit_before>/obj/item/clothing/accessory/holster
	name = "shoulder holster"
	desc = "A handgun holster."
	icon_state = "holster"
	_color = "holster"
	slot = "utility"
	var/holster_allow = /obj/item/weapon/gun
	var/obj/item/weapon/gun/holstered = null
	action_button_name = "Holster"
	w_class = 3.0 // so it doesn't fit in pockets

//subtypes can override this to specify what can be holstered
/obj/item/clothing/accessory/holster/proc/can_holster(obj/item/weapon/gun/W)
	if(!W.isHandgun())
		return 0
	else if(!istype(W,holster_allow))
		return 0
	else
		return 1

/obj/item/clothing/accessory/holster/attack_self()
	var/holsteritem = usr.get_active_hand()
	if(!holstered)
		holster(holsteritem, usr)
	else
		unholster(usr)

/obj/item/clothing/accessory/holster/proc/holster(obj/item/I, mob/user as mob)
	if(holstered)
		user << "<span class='warning'>There is already a [holstered] holstered here!</span>"
		return

	if (!istype(I, /obj/item/weapon/gun))
		user << "<span class='warning'>Only guns can be holstered!</span>"
		return

	var/obj/item/weapon/gun/W = I
	if (!can_holster(W))
		user << "<span class='warning'>This [W] won't fit in the [src]!</span>"
		return

	holstered = W
	user.unEquip(holstered)
	holstered.loc = src
	holstered.add_fingerprint(user)
	user.visible_message("<span class='notice'>[user] holsters the [holstered].</span>", "<span class='notice'>You holster the [holstered].</span>")

/obj/item/clothing/accessory/holster/proc/unholster(mob/user as mob)
	if(!holstered)
		return

	if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj))
		user << "<span class='warning'>You need an empty hand to draw the [holstered]!</span>"
	else
		if(user.a_intent == "hurt")
			usr.visible_message("\red [user] draws the [holstered], ready to shoot!</span>", \
			"<span class='warning'>You draw the [holstered], ready to shoot!</span>")
		else
			user.visible_message("<span class='notice'>[user] draws the [holstered], pointing it at the ground.</span>", \
			"<span class='notice'>You draw the [holstered], pointing it at the ground.</span>")
		user.put_in_hands(holstered)
		holstered.add_fingerprint(user)
		holstered = null

/obj/item/clothing/accessory/holster/attack_hand(mob/user as mob)
	if (has_suit)	//if we are part of a suit
		if (holstered)
			unholster(user)
		return<commit_msg>Fixes wrong a_intent, blame 8fae0f02<commit_after>/obj/item/clothing/accessory/holster
	name = "shoulder holster"
	desc = "A handgun holster."
	icon_state = "holster"
	_color = "holster"
	slot = "utility"
	var/holster_allow = /obj/item/weapon/gun
	var/obj/item/weapon/gun/holstered = null
	action_button_name = "Holster"
	w_class = 3.0 // so it doesn't fit in pockets

//subtypes can override this to specify what can be holstered
/obj/item/clothing/accessory/holster/proc/can_holster(obj/item/weapon/gun/W)
	if(!W.isHandgun())
		return 0
	else if(!istype(W,holster_allow))
		return 0
	else
		return 1

/obj/item/clothing/accessory/holster/attack_self()
	var/holsteritem = usr.get_active_hand()
	if(!holstered)
		holster(holsteritem, usr)
	else
		unholster(usr)

/obj/item/clothing/accessory/holster/proc/holster(obj/item/I, mob/user as mob)
	if(holstered)
		user << "<span class='warning'>There is already a [holstered] holstered here!</span>"
		return

	if (!istype(I, /obj/item/weapon/gun))
		user << "<span class='warning'>Only guns can be holstered!</span>"
		return

	var/obj/item/weapon/gun/W = I
	if (!can_holster(W))
		user << "<span class='warning'>This [W] won't fit in the [src]!</span>"
		return

	holstered = W
	user.unEquip(holstered)
	holstered.loc = src
	holstered.add_fingerprint(user)
	user.visible_message("<span class='notice'>[user] holsters the [holstered].</span>", "<span class='notice'>You holster the [holstered].</span>")

/obj/item/clothing/accessory/holster/proc/unholster(mob/user as mob)
	if(!holstered)
		return

	if(istype(user.get_active_hand(),/obj) && istype(user.get_inactive_hand(),/obj))
		user << "<span class='warning'>You need an empty hand to draw the [holstered]!</span>"
	else
		if(user.a_intent == I_HARM)
			usr.visible_message("\red [user] draws the [holstered], ready to shoot!</span>", \
			"<span class='warning'>You draw the [holstered], ready to shoot!</span>")
		else
			user.visible_message("<span class='notice'>[user] draws the [holstered], pointing it at the ground.</span>", \
			"<span class='notice'>You draw the [holstered], pointing it at the ground.</span>")
		user.put_in_hands(holstered)
		holstered.add_fingerprint(user)
		holstered = null

/obj/item/clothing/accessory/holster/attack_hand(mob/user as mob)
	if (has_suit)	//if we are part of a suit
		if (holstered)
			unholster(user)
		return
{'fraction_non_alphanumeric': 0.15216003404979783, 'fraction_numerical': 0.0029793573100659713, 'mean_word_length': 4.669481302774427, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '972942', 'n_tokens_mistral': 1847, 'n_tokens_neox': 1758, 'n_words': 385}