diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index e53e3c9fd4d..471f82c1511 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -35,7 +35,7 @@ /mob/proc/put_in_l_hand(var/obj/item/W) if(!put_in_hand_check(W)) return 0 - if(!l_hand) + if(!l_hand && has_left_hand()) W.forceMove(src) //TODO: move to equipped? l_hand = W W.layer = 20 //TODO: move to equipped? @@ -51,7 +51,7 @@ /mob/proc/put_in_r_hand(var/obj/item/W) if(!put_in_hand_check(W)) return 0 - if(!r_hand) + if(!r_hand && has_right_hand()) W.forceMove(src) r_hand = W W.layer = 20 diff --git a/code/modules/mob/living/carbon/give.dm b/code/modules/mob/living/carbon/give.dm index 473715367b4..c0dba9b77e5 100644 --- a/code/modules/mob/living/carbon/give.dm +++ b/code/modules/mob/living/carbon/give.dm @@ -4,22 +4,15 @@ if(!iscarbon(target)) //something is bypassing the give arguments, no clue what, adding a sanity check JIC to_chat(usr, "Wait a second... \the [target] HAS NO HANDS! AHH!")//cheesy messages ftw + return + if(target.incapacitated() || usr.incapacitated() || target.client == null) return - if(target.stat == 2 || usr.stat == 2|| target.client == null) - return - var/obj/item/I - if(!usr.hand && usr.r_hand == null) - to_chat(usr, " You don't have anything in your right hand to give to [target.name]") - return - if(usr.hand && usr.l_hand == null) - to_chat(usr, " You don't have anything in your left hand to give to [target.name]") - return - if(usr.hand) - I = usr.l_hand - else if(!usr.hand) - I = usr.r_hand + + var/obj/item/I = get_active_hand() + if(!I) + to_chat(usr, " You don't have anything in your hand to give to [target.name]") return if((I.flags & NODROP) || (I.flags & ABSTRACT)) to_chat(usr, "That's not exactly something you can give.") @@ -29,35 +22,30 @@ if("Yes") if(!I) return + if(target.incapacitated() || usr.incapacitated()) + return if(!Adjacent(target)) to_chat(usr, " You need to stay in reaching distance while giving an object.") to_chat(target, " [usr.name] moved too far away.") return - if((usr.hand && usr.l_hand != I) || (!usr.hand && usr.r_hand != I)) + if((I.flags & NODROP) || (I.flags & ABSTRACT)) + to_chat(usr, "[I] stays stuck to your hand when you try to give it!") + to_chat(target, "[I] stays stuck to [usr.name]'s hand when you try to take it!") + return + if(I != get_active_hand()) to_chat(usr, " You need to keep the item in your active hand.") - to_chat(target, " [usr.name] seem to have given up on giving \the [I.name] to you.") + to_chat(target, " [usr.name] seem to have given up on giving [I] to you.") return if(target.r_hand != null && target.l_hand != null) to_chat(target, " Your hands are full.") to_chat(usr, " Their hands are full.") return - else - usr.drop_item() - if(target.r_hand == null) - target.r_hand = I - else - target.l_hand = I - I.loc = target - I.layer = 20 - I.plane = HUD_PLANE + usr.unEquip(I) + target.put_in_hands(I) I.add_fingerprint(target) - src.update_inv_l_hand() - src.update_inv_r_hand() - target.update_inv_l_hand() - target.update_inv_r_hand() - target.visible_message(" [usr.name] handed \the [I.name] to [target.name].") + target.visible_message(" [usr.name] handed [I] to [target.name].") I.on_give(usr, target) if("No") - target.visible_message(" [usr.name] tried to hand [I.name] to [target.name] but [target.name] didn't want it.") + target.visible_message(" [usr.name] tried to hand [I] to [target.name] but [target.name] didn't want it.") else to_chat(usr, " [target.name]'s hands are full.") diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 7d83c7eaa1d..79b41e47cc3 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -434,11 +434,11 @@ if(slot_l_hand) if(l_hand) return 0 - return 1 + return !incapacitated() if(slot_r_hand) if(r_hand) return 0 - return 1 + return !incapacitated() if(slot_wear_mask) if(wear_mask) return 0 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 3de38568a4a..52fde3d0d9e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -759,7 +759,7 @@ if(!silent) visible_message("[src] tries to put [what] on [who].") if(do_mob(src, who, what.put_on_delay)) - if(what && Adjacent(who)) + if(what && Adjacent(who) && !(what.flags & NODROP)) unEquip(what) who.equip_to_slot_if_possible(what, where, 0, 1) add_attack_logs(src, who, "Equipped [what]")