diff --git a/code/datums/keybindings/human.dm b/code/datums/keybindings/human.dm index 4e0180266a9..93156b24a5f 100644 --- a/code/datums/keybindings/human.dm +++ b/code/datums/keybindings/human.dm @@ -4,6 +4,33 @@ /datum/keybinding/human/can_use(client/C, mob/M) return ishuman(M) && ..() +/datum/keybinding/human/bag_equip + name = "Equip Held Object To Bag" + keys = list("ShiftB") + +/datum/keybinding/human/bag_equip/down(client/C) + . = ..() + var/mob/living/carbon/human/M = C.mob + M.quick_equip_item(slot_back) + +/datum/keybinding/human/belt_equip + name = "Equip Held Object To Belt" + keys = list("ShiftE") + +/datum/keybinding/human/belt_equip/down(client/C) + . = ..() + var/mob/living/carbon/human/M = C.mob + M.quick_equip_item(slot_belt) + +/datum/keybinding/human/suit_equip + name = "Equip Held Object To Suit Storage" + keys = list("ShiftQ") + +/datum/keybinding/human/suit_equip/down(client/C) + . = ..() + var/mob/living/carbon/human/M = C.mob + M.quick_equip_item(slot_s_store) + /datum/keybinding/human/toggle_holster name = "Toggle Holster" keys = list("H") diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index da32a7d30d8..9b3f6ce5817 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -432,3 +432,15 @@ /mob/living/carbon/human/proc/delete_equipment() for(var/slot in get_all_slots())//order matters, dependant slots go first qdel(slot) + +/mob/living/carbon/human/proc/quick_equip_item(slot_item) // puts things in belt or bag + var/obj/item/thing = get_active_hand() + var/obj/item/storage/equipped_item = get_item_by_slot(slot_item) + if(ismecha(loc) || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED)) + return + if(!istype(equipped_item)) // We also let you equip things like this + equip_to_slot_if_possible(thing, slot_item) + return + if(thing && equipped_item.can_be_inserted(thing)) // put thing in belt or bag + equipped_item.handle_item_insertion(thing) + playsound(loc, "rustle", 50, 1, -5)