Merge pull request #11117 from farie82/fixe-antidrop-and-resting-issue

Fixes some antidrop edge cases and can't give items to resting people now
This commit is contained in:
Fox McCloud
2019-04-01 19:50:48 -04:00
committed by GitHub
4 changed files with 23 additions and 35 deletions
+2 -2
View File
@@ -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
+18 -30
View File
@@ -4,22 +4,15 @@
if(!iscarbon(target)) //something is bypassing the give arguments, no clue what, adding a sanity check JIC
to_chat(usr, "<span class='danger'>Wait a second... \the [target] HAS NO HANDS! AHH!</span>")//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, "<span class='warning'> You don't have anything in your right hand to give to [target.name]</span>")
return
if(usr.hand && usr.l_hand == null)
to_chat(usr, "<span class='warning'> You don't have anything in your left hand to give to [target.name]</span>")
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, "<span class='warning'> You don't have anything in your hand to give to [target.name]</span>")
return
if((I.flags & NODROP) || (I.flags & ABSTRACT))
to_chat(usr, "<span class='notice'>That's not exactly something you can give.</span>")
@@ -29,35 +22,30 @@
if("Yes")
if(!I)
return
if(target.incapacitated() || usr.incapacitated())
return
if(!Adjacent(target))
to_chat(usr, "<span class='warning'> You need to stay in reaching distance while giving an object.</span>")
to_chat(target, "<span class='warning'> [usr.name] moved too far away.</span>")
return
if((usr.hand && usr.l_hand != I) || (!usr.hand && usr.r_hand != I))
if((I.flags & NODROP) || (I.flags & ABSTRACT))
to_chat(usr, "<span class='warning'>[I] stays stuck to your hand when you try to give it!</span>")
to_chat(target, "<span class='warning'>[I] stays stuck to [usr.name]'s hand when you try to take it!</span>")
return
if(I != get_active_hand())
to_chat(usr, "<span class='warning'> You need to keep the item in your active hand.</span>")
to_chat(target, "<span class='warning'> [usr.name] seem to have given up on giving \the [I.name] to you.</span>")
to_chat(target, "<span class='warning'> [usr.name] seem to have given up on giving [I] to you.</span>")
return
if(target.r_hand != null && target.l_hand != null)
to_chat(target, "<span class='warning'> Your hands are full.</span>")
to_chat(usr, "<span class='warning'> Their hands are full.</span>")
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("<span class='notice'> [usr.name] handed \the [I.name] to [target.name].</span>")
target.visible_message("<span class='notice'> [usr.name] handed [I] to [target.name].</span>")
I.on_give(usr, target)
if("No")
target.visible_message("<span class='warning'> [usr.name] tried to hand [I.name] to [target.name] but [target.name] didn't want it.</span>")
target.visible_message("<span class='warning'> [usr.name] tried to hand [I] to [target.name] but [target.name] didn't want it.</span>")
else
to_chat(usr, "<span class='warning'> [target.name]'s hands are full.</span>")
@@ -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
+1 -1
View File
@@ -759,7 +759,7 @@
if(!silent)
visible_message("<span class='notice'>[src] tries to put [what] on [who].</span>")
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]")