mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 13:09:11 +01:00
Merge pull request #10767 from VOREStation/Arokha/EEquip
Improve E-quip hotkey
This commit is contained in:
@@ -50,7 +50,7 @@ var/list/slot_equipment_priority = list( \
|
||||
/mob/proc/equip_to_slot_if_possible(obj/item/W as obj, slot, del_on_fail = 0, disable_warning = 0, redraw_mob = 1)
|
||||
if(!W)
|
||||
return 0
|
||||
if(!W.mob_can_equip(src, slot))
|
||||
if(!W.mob_can_equip(src, slot, disable_warning))
|
||||
if(del_on_fail)
|
||||
qdel(W)
|
||||
|
||||
@@ -93,7 +93,7 @@ var/list/slot_equipment_priority = list( \
|
||||
|
||||
return 0
|
||||
|
||||
/mob/proc/equip_to_storage(obj/item/newitem)
|
||||
/mob/proc/equip_to_storage(obj/item/newitem, user_initiated = FALSE)
|
||||
return 0
|
||||
|
||||
/* Hands */
|
||||
|
||||
@@ -16,13 +16,40 @@ This saves us from having to call add_fingerprint() any time something is put in
|
||||
if(!I)
|
||||
to_chat(H, "<span class='notice'>You are not holding anything to equip.</span>")
|
||||
return
|
||||
|
||||
var/moved = FALSE
|
||||
|
||||
// Try an equipment slot
|
||||
if(H.equip_to_appropriate_slot(I))
|
||||
moved = TRUE
|
||||
|
||||
// No? Try a storage item.
|
||||
else if(H.equip_to_storage(I, TRUE))
|
||||
moved = TRUE
|
||||
|
||||
// No?! Well, give up.
|
||||
if(!moved)
|
||||
to_chat(H, "<span class='warning'>You are unable to equip that.</span>")
|
||||
|
||||
// Update hand icons
|
||||
else
|
||||
if(hand)
|
||||
update_inv_l_hand(0)
|
||||
else
|
||||
update_inv_r_hand(0)
|
||||
else
|
||||
to_chat(H, "<font color='red'>You are unable to equip that.</font>")
|
||||
|
||||
/mob/living/carbon/human/equip_to_storage(obj/item/newitem, user_initiated = FALSE)
|
||||
// Try put it in their belt first
|
||||
if(istype(src.belt,/obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/wornbelt = src.belt
|
||||
if(wornbelt.can_be_inserted(newitem, 1))
|
||||
if(user_initiated)
|
||||
wornbelt.handle_item_insertion(newitem)
|
||||
else
|
||||
newitem.forceMove(wornbelt)
|
||||
return wornbelt
|
||||
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/proc/equip_in_one_of_slots(obj/item/W, list/slots, del_on_fail = 1)
|
||||
for (var/slot in slots)
|
||||
|
||||
@@ -6,19 +6,25 @@
|
||||
var/obj/item/weapon/tank/internal = null//Human/Monkey
|
||||
var/obj/item/clothing/mask/wear_mask = null//Carbon
|
||||
|
||||
/mob/living/equip_to_storage(obj/item/newitem)
|
||||
/mob/living/equip_to_storage(obj/item/newitem, user_initiated = FALSE)
|
||||
// Try put it in their backpack
|
||||
if(istype(src.back,/obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/backpack = src.back
|
||||
if(backpack.can_be_inserted(newitem, 1))
|
||||
newitem.forceMove(src.back)
|
||||
return 1
|
||||
if(user_initiated)
|
||||
backpack.handle_item_insertion(newitem)
|
||||
else
|
||||
newitem.forceMove(src.back)
|
||||
return src.back
|
||||
|
||||
// Try to place it in any item that can store stuff, on the mob.
|
||||
for(var/obj/item/weapon/storage/S in src.contents)
|
||||
if (S.can_be_inserted(newitem, 1))
|
||||
newitem.forceMove(S)
|
||||
return 1
|
||||
if(user_initiated)
|
||||
S.handle_item_insertion(newitem)
|
||||
else
|
||||
newitem.forceMove(S)
|
||||
return S
|
||||
return 0
|
||||
|
||||
//Returns the thing in our active hand
|
||||
|
||||
Reference in New Issue
Block a user